Skip to content

Commit

Permalink
break Pynta so that it does not detect the uniqueness of adsorbates
Browse files Browse the repository at this point in the history
handle naming of duplicate adsorbates properly
this is intended for scale testing only
  • Loading branch information
mjohnson541 committed Mar 4, 2024
1 parent 6f66480 commit 55e41ac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
21 changes: 11 additions & 10 deletions pynta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ def generate_mol_dict(self):
mols.append(mol)
r["product_mols"].append(mol)

unique_mols = []
for mol in mols:
for m in unique_mols:
if mol.is_isomorphic(m):
break
else:
unique_mols.append(mol)

# unique_mols = []
# for mol in mols:
# for m in unique_mols:
# if mol.is_isomorphic(m):
# break
# else:
# unique_mols.append(mol)
unique_mols = mols[:]
for mol in unique_mols:
mol.multiplicity = mol.get_radical_count() + 1

mol_dict = {get_name(mol):mol for mol in unique_mols}
mol_dict = dict()
for mol in unique_mols:
mol_dict[get_name(mol,mol_dict.keys())] = mol
self.mol_dict = mol_dict
self.name_to_adjlist_dict = {sm:mol.to_adjacency_list() for sm,mol in mol_dict.items()}

Expand Down
12 changes: 9 additions & 3 deletions pynta/mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,14 @@ def get_bond_lengths_sites(mol,ads,atom_map,surf_atom_map,nslab,facet="fcc111",m

return bondlengths,sites,sitelengths

def get_name(mol):
def get_name(mol,mol_names):
try:
return mol.to_smiles()
basename = mol.to_smiles()
except:
return mol.to_adjacency_list().replace("\n"," ")[:-1]
basename = mol.to_adjacency_list().replace("\n"," ")[:-1]
i = 0
name = basename
while name in mol_names:
i += 1
name = basename + "-" + str(i)
return name

0 comments on commit 55e41ac

Please sign in to comment.