From 2ac9f4e5cc76b4bd11b46f4d008d13bf0a59e119 Mon Sep 17 00:00:00 2001 From: tdprice-858 <76229513+tdprice-858@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:18:23 -0700 Subject: [PATCH] Remove constraints before comparison Fixes a bug where leaving constraints on throws an error within the ase comparison algorithm --- pynta/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pynta/utils.py b/pynta/utils.py index e901e330..56264bfd 100644 --- a/pynta/utils.py +++ b/pynta/utils.py @@ -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) @@ -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) @@ -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) @@ -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) @@ -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]]) @@ -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]: @@ -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) \ No newline at end of file + return constructor(**constraint_dict)