Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -3791,10 +3791,17 @@ def simple_regularization(self, node, template_rxn_map, test=True):

if isinstance(node.item, Group):
indistinguishable = []

if node.children==[]: #if this is a leaf node, run it through get_extension_edge so that the regularization info is passed to leaf node
print('extending leaf nodes to get regularization info')
_, _ = self.get_extension_edge(node, template_rxn_map, obj=None, T=1000.0, iter_max=1, iter_item_cap=1)

for i, atm1 in enumerate(grp.atoms):

skip = False
if node.children == []: # if the atoms or bonds are graphically indistinguishable don't regularize
if node.children == []:

# if the atoms or bonds are graphically indistinguishable don't regularize
bdpairs = {(atm, tuple(bd.order)) for atm, bd in atm1.bonds.items()}
for atm2 in grp.atoms:
if atm1 is not atm2 and atm1.atomtype == atm2.atomtype and len(atm1.bonds) == len(atm2.bonds):
Expand Down
30 changes: 29 additions & 1 deletion rmgpy/molecule/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ def get_extensions(self, r=None, r_bonds=None, r_un=None, basename='', atm_ind=N
"""
cython.declare(atoms=list, atm=GroupAtom, atm2=GroupAtom, bd=GroupBond, i=int, j=int,
extents=list, RnH=list, typ=list)

extents = []
if r_bonds is None:
r_bonds = [1, 1.5, 2, 3, 4]
Expand Down Expand Up @@ -1726,6 +1726,8 @@ def specify_atom_extensions(self, i, basename, r):

grps = []
Rset = set(r)

#consider node splitting
for item in r:
grp = deepcopy(self)
grpc = deepcopy(self)
Expand All @@ -1751,6 +1753,32 @@ def specify_atom_extensions(self, i, basename, r):
grps.append(
(grp, grpc, basename + '_' + str(i + 1) + old_atom_type_str + '->' + item.label, 'atomExt', (i,)))

#generate an extension without node splitting
if len(self.atoms[i].atomtype)>len(Rset):
print('generating a non-splitting extension')
if all(r in self.atoms[i].atomtype for r in Rset):
#that means even if we update the atomtype of the atom to the Rset, it will still be a specification
grp = deepcopy(self)
grp.atoms[i].atomtype = list(Rset)

#rename
old_atom_type = grp.atoms[i].atomtype

if len(old_atom_type) > 1:
labelList = []
old_atom_type_str = ''
for k in old_atom_type:
labelList.append(k.label)
for p in sorted(labelList):
old_atom_type_str += p
elif len(old_atom_type) == 0:
old_atom_type_str = ""
else:
old_atom_type_str = old_atom_type[0].label

grps.append(
(grp, None, basename + '_' + str(i + 1) + old_atom_type_str + '->' + ''.join(r.label for r in Rset), 'atomExt', (i,)))

return grps

def specify_ring_extensions(self, i, basename):
Expand Down
Loading