@@ -368,7 +368,8 @@ def sort_atom_names(self, type_map=None):
368
368
# atom_names must be a subset of type_map
369
369
assert (set (self .data ['atom_names' ]).issubset (set (type_map )))
370
370
# for the condition that type_map is a proper superset of atom_names
371
- new_atoms = set (type_map ) - set (self .data ["atom_names" ])
371
+ # new_atoms = set(type_map) - set(self.data["atom_names"])
372
+ new_atoms = [e for e in type_map if e not in self .data ["atom_names" ]]
372
373
if new_atoms :
373
374
self .add_atom_names (new_atoms )
374
375
# index that will sort an array by type_map
@@ -1455,8 +1456,10 @@ def check_atom_names(self, system):
1455
1456
"""
1456
1457
Make atom_names in all systems equal, prevent inconsistent atom_types.
1457
1458
"""
1458
- new_in_system = set (system ["atom_names" ]) - set (self .atom_names )
1459
- new_in_self = set (self .atom_names ) - set (system ["atom_names" ])
1459
+ # new_in_system = set(system["atom_names"]) - set(self.atom_names)
1460
+ # new_in_self = set(self.atom_names) - set(system["atom_names"])
1461
+ new_in_system = [e for e in system ["atom_names" ] if e not in self .atom_names ]
1462
+ new_in_self = [e for e in self .atom_names if e not in system ["atom_names" ]]
1460
1463
if len (new_in_system ):
1461
1464
# A new atom_name appear, add to self.atom_names
1462
1465
self .atom_names .extend (new_in_system )
@@ -1477,6 +1480,7 @@ def from_quip_gap_xyz_file(self,file_name):
1477
1480
# print(next(quip_gap_xyz_systems))
1478
1481
for info_dict in QuipGapxyzSystems (file_name ):
1479
1482
system = LabeledSystem (data = info_dict )
1483
+ system .sort_atom_names ()
1480
1484
self .append (system )
1481
1485
1482
1486
0 commit comments