Skip to content

Commit

Permalink
Allow non-resonance species to pass isomorphism check
Browse files Browse the repository at this point in the history
If generate_resonance_structures returns None, then still pass the isomorphism check.
  • Loading branch information
kfir4444 committed May 6, 2024
1 parent 3631196 commit 9b8ddb2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arc/mapping/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,12 @@ def r_cut_p_cut_isomorphic(reactant, product):
bool: ``True`` if they are isomorphic, ``False`` otherwise.
"""
res1 = generate_resonance_structures(object_=reactant.mol.copy(deep=True), save_order = True)
for res in res1:
if res.fingerprint == product.mol.fingerprint or product.mol.is_isomorphic(res, save_order=True):
if res1 is not None:
for res in res1:
if res.fingerprint == product.mol.fingerprint or product.mol.is_isomorphic(res, save_order=True):
return True
else:
if reactant.mol.fingerprint == product.mol.fingerprint or product.mol.is_isomorphic(reactant.mol.copy(deep=True), save_order=True):
return True
return False

Expand Down

0 comments on commit 9b8ddb2

Please sign in to comment.