@@ -345,6 +345,17 @@ def prepare_pair_lists(self):
345345 else :
346346 self .pair_list_old .append (map_split [0 ])
347347 self .pair_list_new .append (map_split [1 ])
348+
349+ # Special case: 100% transformation with only 1 mapping
350+ # LAMMPS expects elements for all atom types in the system
351+ # Example: Al→Mg only, but system has 2 types → need ['Al', 'Al'] and ['Mg', 'Mg']
352+ n_elements = len (self .calc .element )
353+ if len (self .unique_mappings ) == 1 and n_elements > 1 :
354+ # Duplicate the single mapping to match number of element types
355+ for _ in range (n_elements - 1 ):
356+ self .pair_list_old .append (self .pair_list_old [0 ])
357+ self .pair_list_new .append (self .pair_list_new [0 ])
358+
348359 self .new_atomtype = np .array (range (len (self .unique_mappings ))) + 1
349360 self .mappingdict = dict (zip (self .unique_mappings , self .new_atomtype ))
350361
@@ -435,12 +446,15 @@ def update_pair_coeff(self, pair_coeff):
435446
436447 def get_swap_types (self ):
437448 """
438- Get swapping types
449+ Get swapping types for configurational entropy calculation.
450+
451+ Returns types that share the same initial element but have different
452+ transformation paths (e.g., Al→Al vs Al→Mg).
439453 """
440454 swap_list = []
441455 for mapping in self .unique_mappings :
442456 map_split = mapping .split ("-" )
443- # conserved atom
457+ # conserved atom - skip
444458 if map_split [0 ] == map_split [1 ]:
445459 pass
446460 else :
@@ -449,12 +463,19 @@ def get_swap_types(self):
449463 first_map = f"{ first_type } -{ first_type } "
450464 second_map = mapping
451465
452- # get the numbers from dict
453- first_swap_type = self .mappingdict [first_map ]
454- second_swap_type = self .mappingdict [second_map ]
466+ # Check if conserved mapping exists
467+ if first_map in self .mappingdict :
468+ # get the numbers from dict
469+ first_swap_type = self .mappingdict [first_map ]
470+ second_swap_type = self .mappingdict [second_map ]
471+ swap_list .append ([first_swap_type , second_swap_type ])
472+ else :
473+ # 100% transformation case - no conserved atoms of this type
474+ # Only the transforming type exists
475+ second_swap_type = self .mappingdict [second_map ]
476+ swap_list .append ([second_swap_type ])
455477
456- swap_list .append ([first_swap_type , second_swap_type ])
457- return swap_list [0 ]
478+ return swap_list [0 ] if swap_list else []
458479
459480 def write_structure (self , outfilename ):
460481 # create some species dict
0 commit comments