diff --git a/pynta/utils.py b/pynta/utils.py index 100223c9..a4a63ac8 100644 --- a/pynta/utils.py +++ b/pynta/utils.py @@ -25,19 +25,21 @@ def get_unique_sym(geoms): ''' comparator = SymmetryEquivalenceCheck() - + geoms_copy = deepcopy(geoms) + good_adsorbates_atom_obj_list = [] geos_out = [] - for geom in geoms: + for i, geom in enumerate(geoms_copy): adsorbate_atom_obj = read(geom) adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints comparision = comparator.compare( adsorbate_atom_obj, good_adsorbates_atom_obj_list) if comparision is False: good_adsorbates_atom_obj_list.append(adsorbate_atom_obj) - geos_out.append(geom) + geos_out.append(geoms[i]) return geos_out @@ -50,19 +52,20 @@ def get_unique_sym_indices(geoms): ''' comparator = SymmetryEquivalenceCheck() - + geoms_copy = deepcopy(geoms) good_adsorbates_atom_obj_list = [] geos_out = [] - for geom in geoms: + for i, geom in enumerate(geoms_copy): adsorbate_atom_obj = read(geom) adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints comparision = comparator.compare( adsorbate_atom_obj, good_adsorbates_atom_obj_list) if comparision is False: good_adsorbates_atom_obj_list.append(adsorbate_atom_obj) - geos_out.append(geom) + geos_out.append(geoms[i]) indices = [geoms.index(g) for g in geos_out] @@ -87,6 +90,7 @@ def get_unique_sym_structs(geoms): for i,geom in enumerate(geoms_copy): adsorbate_atom_obj = geom adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints comparision = comparator.compare( adsorbate_atom_obj, good_adsorbates_atom_obj_list) @@ -115,6 +119,7 @@ def get_unique_sym_struct_indices(geoms): for i,geom in enumerate(geoms_copy): adsorbate_atom_obj = geom adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints comparision = comparator.compare( adsorbate_atom_obj, good_adsorbates_atom_obj_list) @@ -143,6 +148,7 @@ def get_unique_sym_struct_index_clusters(geoms): for i,geom in enumerate(geoms_copy): adsorbate_atom_obj = geom adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints comparison = None for j,adlist in enumerate(good_adsorbates_atom_obj_list): comparison = comparator.compare(adsorbate_atom_obj, [adlist[0]]) @@ -168,19 +174,21 @@ def filter_nonunique_TS_guess_indices(geoms,Es): geoms: list of paths to .xyz or .traj files to compare ''' + geoms_copy = deepcopy(geoms) comparator = SymmetryEquivalenceCheck() good_adsorbates_atom_obj_list = [] geos_out = [] Esout = [] - for j,geom in enumerate(geoms): + for j,geom in enumerate(geoms_copy): adsorbate_atom_obj = read(geom) adsorbate_atom_obj.pbc = True + adsorbate_atom_obj.set_constraint() # Reset constraints for i,good_adsorbate in enumerate(good_adsorbates_atom_obj_list): comparison = comparator.compare(adsorbate_atom_obj,good_adsorbate) if comparison and Es[j] < Esout[i]: - geos_out[i] = geom + geos_out[i] = geoms[j] good_adsorbates_atom_obj_list[i] = adsorbate_atom_obj Esout[i] = Es[j] break @@ -188,7 +196,7 @@ def filter_nonunique_TS_guess_indices(geoms,Es): break else: good_adsorbates_atom_obj_list.append(adsorbate_atom_obj) - geos_out.append(geom) + geos_out.append(geoms[j]) Esout.append(Es[j]) return geos_out,Esout