Fix App Domain Bug when a Rule can be applied more than once (#49)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#49
This commit is contained in:
2025-08-19 22:10:18 +12:00
parent c3c1d4f5cf
commit fc8192fb0d
4 changed files with 286 additions and 94 deletions

View File

@ -639,20 +639,23 @@ class IndigoUtils(object):
environment.add(mappedAtom.index())
for k, v in functional_groups.items():
try:
sanitized = IndigoUtils.sanitize_functional_group(k)
sanitized = IndigoUtils.sanitize_functional_group(k)
query = indigo.loadSmarts(sanitized)
query = indigo.loadSmarts(sanitized)
for match in matcher.iterateMatches(query):
if match is not None:
for match in matcher.iterateMatches(query):
if match is not None:
for atom in query.iterateAtoms():
mappedAtom = match.mapAtom(atom)
if mappedAtom is None or mappedAtom.index() in environment:
continue
for atom in query.iterateAtoms():
mappedAtom = match.mapAtom(atom)
if mappedAtom is None or mappedAtom.index() in environment:
continue
counts[mappedAtom.index()] = max(v, counts[mappedAtom.index()])
counts[mappedAtom.index()] = max(v, counts[mappedAtom.index()])
except IndigoException as e:
logger.debug(f'Colorizing failed due to {e}')
for k, v in counts.items():
if is_reaction: