Skip to content

Commit

Permalink
Allowing delocalization paths allyl to the radical center
Browse files Browse the repository at this point in the history
to include a birad.
This addresses issue ReactionMechanismGenerator#545 where RMG isn't able to calculate degeneracy
since the resonance structures weren't explored for molecules like [CH]=C[N]
  • Loading branch information
alongd committed Aug 23, 2017
1 parent f6d7f19 commit 6bf62e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rmgpy/molecule/pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def findAllDelocalizationPaths(atom1):
paths = []
for atom2, bond12 in atom1.edges.items():
# Vinyl bond must be capable of gaining an order
if (bond12.isSingle() or bond12.isDouble()) and atom1.radicalElectrons == 1:
if (bond12.isSingle() or bond12.isDouble()) and (atom1.radicalElectrons == 1 or atom1.radicalElectrons == 2):
for atom3, bond23 in atom2.edges.items():
# Allyl bond must be capable of losing an order without breaking
if atom1 is not atom3 and (bond23.isDouble() or bond23.isTriple()):
Expand Down
15 changes: 15 additions & 0 deletions rmgpy/molecule/pathfinderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,18 @@ def test_3_atoms(self):
self.assertEquals(distances, expected)


class FindAllDelocalizationPathsTest(unittest.TestCase):
"""
test the findAllDelocalizationPaths method
"""
def test_allyl_radical(self):
smi = "[CH2]C=C"
mol = Molecule().fromSMILES(smi)
paths = findAllDelocalizationPaths(mol.atoms[0])
self.assertIsNotNone(paths)

def test_nitrogenated_birad(self):
smi = '[CH]=C[N]'
mol = Molecule().fromSMILES(smi)
paths = findAllDelocalizationPaths(mol.atoms[0])
self.assertIsNotNone(paths)

0 comments on commit 6bf62e2

Please sign in to comment.