Skip to content

Commit 99e9b9d

Browse files
authored
Bug fix: Product enumeration geometry generation (#44)
Verbose statement makes a call to `prod` yarpecule in case where it is a None object. Fixed, to avoid this, while still printing the useful information.
1 parent 6078584 commit 99e9b9d

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

yarp/reaction/generate_rxns.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ def generate_rxns(inp):
6161
)
6262

6363
for prod in clean_products:
64-
prod = quick_geom_opt(prod)
65-
if prod is None:
64+
opt_prod = quick_geom_opt(prod)
65+
if opt_prod is None:
66+
reactant.get_smiles()
67+
prod.get_smiles()
6668
if verbose:
67-
print(f" + SKIPPED! Unable to form valid product ({prod.canon_smi}) geom from reactant ({mol.canon_smi}) geom")
69+
print(f" + SKIPPED! Unable to form valid product ({prod.canon_smi}) geom from reactant ({reactant.canon_smi}) geom")
6870
continue
69-
r2p = reaction(reactant, prod)
71+
r2p = reaction(reactant, opt_prod)
7072
output[r2p.hash] = r2p
7173

7274
# Enumerating from reaction object(s)
@@ -129,13 +131,15 @@ def generate_rxns(inp):
129131
)
130132

131133
for prod in clean_products:
132-
prod = quick_geom_opt(prod)
133-
if prod is None:
134+
opt_prod = quick_geom_opt(prod)
135+
if opt_prod is None:
136+
mol.get_smiles()
137+
prod.get_smiles()
134138
if verbose:
135-
print(f" + SKIPPED! Unable to form valid product ({prod.canon_smi}) geom from reactant ({mol.canon_smi}) geom")
139+
print(f" + SKIPPED! Unable to form valid product ({prod.canon_smi}) geom from reactant ({mol.canon_smi}) geom")
136140
continue
137-
r2p = reaction(mol, prod)
138-
p2r = reaction(mol, prod)
141+
r2p = reaction(mol, opt_prod)
142+
p2r = reaction(opt_prod, mol)
139143

140144
# Skip reactions already discovered (forward/reverse)
141145
if r2p.hash in og_rxns_hash or p2r.hash in og_rxns_hash:

0 commit comments

Comments
 (0)