From 0e1c3c4f170d266744ce351ef9991b3a7e035f7c Mon Sep 17 00:00:00 2001 From: Max Liu Date: Mon, 5 Feb 2018 18:17:18 -0500 Subject: [PATCH] Use is_same instead of isIsomorphic for species existence check --- rmgpy/rmg/model.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/rmgpy/rmg/model.py b/rmgpy/rmg/model.py index 0c3b6e70ea..fe035a7fef 100644 --- a/rmgpy/rmg/model.py +++ b/rmgpy/rmg/model.py @@ -245,24 +245,12 @@ def checkForExistingSpecies(self, molecule): # object if it has a match obj = molecule - # For cyclic molecules, obj is `Species` object and aromatic resonance - # isomers are generated. This is due to the hysteresis of isomer generation - # for aromatic/polyaromatic compounds: not all kekulized forms can be found - # within the list of isomers for a species object describing a unique aromatic compound - if molecule.isCyclic(): - obj = Species(molecule=[molecule]) - from rmgpy.molecule.resonance import generate_aromatic_resonance_structures - aromaticIsomers = generate_aromatic_resonance_structures(molecule) - obj.molecule.extend(aromaticIsomers) - # First check cache and return if species is found for i, spec in enumerate(self.speciesCache): - if spec is not None: - for mol in spec.molecule: - if obj.isIsomorphic(mol): - self.speciesCache.pop(i) - self.speciesCache.insert(0, spec) - return True, spec + if spec is not None and spec.is_same(obj): + self.speciesCache.pop(i) + self.speciesCache.insert(0, spec) + return True, spec # Return an existing species if a match is found formula = molecule.getFormula() @@ -271,7 +259,7 @@ def checkForExistingSpecies(self, molecule): except KeyError: return False, None for spec in speciesList: - if spec.isIsomorphic(obj): + if spec.is_same(obj): self.speciesCache.pop() self.speciesCache.insert(0, spec) return True, spec