From 9b8ddb2392872094fdde195cbb4e4206f286c25f Mon Sep 17 00:00:00 2001 From: kfir4444 Date: Sun, 21 Apr 2024 16:20:21 +0300 Subject: [PATCH] Allow non-resonance species to pass isomorphism check If generate_resonance_structures returns None, then still pass the isomorphism check. --- arc/mapping/engine.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arc/mapping/engine.py b/arc/mapping/engine.py index 45d97ce724..28632c51de 100644 --- a/arc/mapping/engine.py +++ b/arc/mapping/engine.py @@ -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