diff --git a/rmgpy/molecule/resonanceTest.py b/rmgpy/molecule/resonanceTest.py index 4d968789835..b58492f9b32 100644 --- a/rmgpy/molecule/resonanceTest.py +++ b/rmgpy/molecule/resonanceTest.py @@ -258,13 +258,37 @@ def testAromaticWithLonePairResonance(self): molList = generate_resonance_structures(Molecule(SMILES="c1ccccc1CC=N[O]")) self.assertEqual(len(molList), 4) - @work_in_progress def testAromaticWithNResonance(self): - """Test resonance structure generation for aromatic species with N5ddc <=> N5tc resonance""" - # WIP: currently generate_N5dc_resonance_structures does not apply for aromatic structures + """Test resonance structure generation for aromatic species with lone pair resonance""" molList = generate_resonance_structures(Molecule(SMILES="c1ccccc1CCN=[N+]=[N-]")) - self.assertEqual(len(molList), 4) - # TODO: this test cannot be run because RDKit (which checks for aromaticity) cannot process hyper-valence N + self.assertEqual(len(molList), 2) + + def testAromaticWithONResonance(self): + """Test resonance structure generation for aromatic species with heteroatoms + + This test was specifically designed to recreate RMG-Py issue #1598. + Key conditions: having heteroatoms, starting with aromatic structure, and keep_isomorphic=True + """ + molList = generate_resonance_structures(Molecule().fromAdjacencyList(""" +multiplicity 2 +1 O u0 p2 c0 {4,S} {16,S} +2 O u1 p2 c0 {4,S} +3 O u0 p3 c-1 {4,S} +4 N u0 p0 c+1 {1,S} {2,S} {3,S} {5,S} +5 C u0 p0 c0 {4,S} {6,B} {7,B} +6 C u0 p0 c0 {5,B} {8,B} {11,S} +7 C u0 p0 c0 {5,B} {10,B} {15,S} +8 C u0 p0 c0 {6,B} {9,B} {12,S} +9 C u0 p0 c0 {8,B} {10,B} {13,S} +10 C u0 p0 c0 {7,B} {9,B} {14,S} +11 H u0 p0 c0 {6,S} +12 H u0 p0 c0 {8,S} +13 H u0 p0 c0 {9,S} +14 H u0 p0 c0 {10,S} +15 H u0 p0 c0 {7,S} +16 H u0 p0 c0 {1,S} +"""), keep_isomorphic=True) + self.assertEqual(len(molList), 1) def testNoClarStructures(self): """Test that we can turn off Clar structure generation."""