Skip to content

Commit

Permalink
Remove constraints before comparison
Browse files Browse the repository at this point in the history
Fixes a bug where leaving constraints on throws an error within the ase comparison algorithm
  • Loading branch information
tdprice-858 authored Mar 15, 2024
1 parent 70ec637 commit 2ac9f4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pynta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_unique_sym(geoms):
for geom in geoms:
adsorbate_atom_obj = read(geom)
adsorbate_atom_obj.pbc = True
adsorbate_atom_obj.set_constraint() # Reset constraints for comparison
comparision = comparator.compare(
adsorbate_atom_obj, good_adsorbates_atom_obj_list)

Expand All @@ -56,6 +57,7 @@ def get_unique_sym_indices(geoms):
for geom in geoms:
adsorbate_atom_obj = read(geom)
adsorbate_atom_obj.pbc = True
adsorbate_atom_obj.set_constraint() # Reset constraints before comparison
comparision = comparator.compare(
adsorbate_atom_obj, good_adsorbates_atom_obj_list)

Expand Down Expand Up @@ -86,6 +88,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 before comparison
comparision = comparator.compare(
adsorbate_atom_obj, good_adsorbates_atom_obj_list)

Expand Down Expand Up @@ -114,6 +117,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 before comparison
comparision = comparator.compare(
adsorbate_atom_obj, good_adsorbates_atom_obj_list)

Expand Down Expand Up @@ -142,6 +146,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 before comparison
comparison = None
for j,adlist in enumerate(good_adsorbates_atom_obj_list):
comparison = comparator.compare(adsorbate_atom_obj, [adlist[0]])
Expand Down Expand Up @@ -176,6 +181,7 @@ def filter_nonunique_TS_guess_indices(geoms,Es):
for j,geom in enumerate(geoms):
adsorbate_atom_obj = read(geom)
adsorbate_atom_obj.pbc = True
adsorbate_atom_obj.set_constraint() # Reset constraints before comparison
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]:
Expand Down Expand Up @@ -249,4 +255,4 @@ def construct_constraint(d):
constraint_dict = copy.deepcopy(d)
constructor = getattr(ase.constraints,constraint_dict["type"])
del constraint_dict["type"]
return constructor(**constraint_dict)
return constructor(**constraint_dict)

0 comments on commit 2ac9f4e

Please sign in to comment.