From 7aceea2a609d8589f67341f098cc7b28af238681 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Thu, 27 Jul 2023 14:41:27 -0700 Subject: [PATCH] fix atomtype charge checking checks that the first group_atom.atomtype is either an appropriate charged atomtype or is a general version of an appropriate charged atomtype --- rmgpy/molecule/group.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rmgpy/molecule/group.py b/rmgpy/molecule/group.py index 27f809f9bd..e2bfe4441d 100644 --- a/rmgpy/molecule/group.py +++ b/rmgpy/molecule/group.py @@ -2993,7 +2993,9 @@ def make_sample_molecule(self): 'O0sc', 'P0sc', 'P1sc', 'P1dc', 'P5sc', 'S0sc', 'S2sc', 'S2dc', 'S2tc', 'S4sc', 'S4dc', 'S4tdc', 'S6sc', 'S6dc', 'S6tdc'] - if group_atom.atomtype[0] in [ATOMTYPES[x] for x in positive_charged] and atom.charge > 0: + if atom.charge > 0 and any([group_atom.atomtype[0] is ATOMTYPES[x] or ATOMTYPES[x].is_specific_case_of(group_atom.atomtype[0]) for x in positive_charged]): + pass + elif atom.charge < 0 and any([group_atom.atomtype[0] is ATOMTYPES[x] or ATOMTYPES[x].is_specific_case_of(group_atom.atomtype[0]) for x in negative_charged]): pass elif atom.charge in group_atom.atomtype[0].charge: # declared charge in original group is same as new charge