From b6acc737c2e7e0ec426bc5ac5fd3172feff1f4e3 Mon Sep 17 00:00:00 2001 From: Fabian Gruenewald Date: Mon, 4 Mar 2024 16:35:33 +0100 Subject: [PATCH] skip termini mods if none atoms are different --- polyply/src/molecule_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/polyply/src/molecule_utils.py b/polyply/src/molecule_utils.py index a960ca85..f4249d74 100644 --- a/polyply/src/molecule_utils.py +++ b/polyply/src/molecule_utils.py @@ -286,6 +286,10 @@ def find_termini_mods(meta_molecule, molecule, force_field): for attr in ['atype', 'mass']: if target_attrs[attr] != ref_attrs[attr]: replace_dict[node][attr] = target_attrs[attr] + # a little dangerous but mostly ok; if there are no changes to + # the atoms we can continue + if len(replace_dict) == 0: + continue # bonded interactions could be different too so we need to check them overwrite_inters = defaultdict(list)