diff --git a/rmgpy/molecule/symmetry.py b/rmgpy/molecule/symmetry.py index 5f5c40dca5..fc2180d3e1 100644 --- a/rmgpy/molecule/symmetry.py +++ b/rmgpy/molecule/symmetry.py @@ -99,6 +99,9 @@ def calculateAtomSymmetryNumber(molecule, atom): elif double == 2: # Two double bonds if count == [2]: symmetryNumber *= 2 + # for nitrogen resonance hybrids + elif single == 0: + if count == [2]: symmetryNumber *=2 elif atom.radicalElectrons == 1: if single == 3: # Three single bonds @@ -111,11 +114,6 @@ def calculateAtomSymmetryNumber(molecule, atom): if count == [2]: symmetryNumber *= 2 - if atom.isNitrogen(): - for groupN in groups: - if groupN.toSMILES() == "[N+](=O)[O-]": - symmetryNumber *= 2 - return symmetryNumber ################################################################################ diff --git a/rmgpy/species.py b/rmgpy/species.py index 985d3f5ea8..c627b38ee1 100644 --- a/rmgpy/species.py +++ b/rmgpy/species.py @@ -403,7 +403,14 @@ def getSymmetryNumber(self): if self.symmetryNumber < 1: cython.declare(resonanceHybrid = Molecule, maxSymmetryNum = cython.short) resonanceHybrid = self.getResonanceHybrid() - self.symmetryNumber = resonanceHybrid.getSymmetryNumber() + try: + self.symmetryNumber = resonanceHybrid.getSymmetryNumber() + except KeyError: + logging.error('Wrong bond order generated by resonance hybrid.') + logging.error('Resonance Hybrid: {}'.format(resonanceHybrid.toAdjacencyList())) + for index, mol in enumerate(self.molecule): + logging.error("Resonance Structure {}: {}".format(index,mol.toAdjacencyList())) + raise return self.symmetryNumber def getResonanceHybrid(self):