Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small atom mapping debugging #740

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to modify the generate_resonance_structures func so it always returns at least the original Molecule. Please see where else this func is used and whether this change will be appropriate

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