Skip to content

Commit

Permalink
Trevor's constrain issue command added
Browse files Browse the repository at this point in the history
  • Loading branch information
sakim8048 committed Mar 4, 2024
1 parent f731ba7 commit c234d10
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions pynta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]

Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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]])
Expand All @@ -168,27 +174,29 @@ 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
elif comparison:
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
Expand Down

0 comments on commit c234d10

Please sign in to comment.