From 4d8275e8c21380e0a371a48323587f3f0b8a605f Mon Sep 17 00:00:00 2001 From: Connie Gao Date: Fri, 18 Apr 2014 17:55:05 -0400 Subject: [PATCH 1/2] Change the way cyclic and polycyclic corrections are handled AND don't include gauche correcitons. Use overall ring correction instead of most destabilizing one for enthalpy. (We were using cyclopentane corrections for cyclopentene.) Now it is corrected. Don't include gauche corrections if the molecule is cyclic. (Still need to include them for parts of the molecule that aren't in the rings.. but we'll figure that out later. --- rmgpy/data/thermo.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/rmgpy/data/thermo.py b/rmgpy/data/thermo.py index 35014a60a41..b96483f22cb 100644 --- a/rmgpy/data/thermo.py +++ b/rmgpy/data/thermo.py @@ -878,6 +878,7 @@ def estimateThermoViaGroupAdditivity(self, molecule): return self.estimateRadicalThermoViaHBI(molecule, self.estimateThermoViaGroupAdditivity ) else: # non-radical species + cyclic = molecule.isCyclic() # Generate estimate of thermodynamics for atom in molecule.atoms: # Iterate over heavy (non-hydrogen) atoms @@ -891,9 +892,10 @@ def estimateThermoViaGroupAdditivity(self, molecule): logging.error(molecule.toAdjacencyList()) raise # Correct for gauche and 1,5- interactions - try: - self.__addGroupThermoData(thermoData, self.groups['gauche'], molecule, {'*':atom}) - except KeyError: pass + if not cyclic: + try: + self.__addGroupThermoData(thermoData, self.groups['gauche'], molecule, {'*':atom}) + except KeyError: pass try: self.__addGroupThermoData(thermoData, self.groups['int15'], molecule, {'*':atom}) except KeyError: pass @@ -904,7 +906,7 @@ def estimateThermoViaGroupAdditivity(self, molecule): # Do ring corrections separately because we only want to match # each ring one time - if molecule.isCyclic(): + if cyclic: if molecule.getAllPolycyclicVertices(): # If the molecule has fused ring atoms, this implies that we are dealing # with a polycyclic ring system, for which separate ring strain corrections may not @@ -923,21 +925,14 @@ def estimateThermoViaGroupAdditivity(self, molecule): for ring in rings: # Make a temporary structure containing only the atoms in the ring # NB. if any of the ring corrections depend on ligands not in the ring, they will not be found! - ringCorrection = None - for atom in ring: + try: + self.__addGroupThermoData(thermoData, self.groups['ring'], molecule, {}) + except KeyError: + logging.error("Couldn't find in ring database:") + logging.error(ring) + logging.error(ring.toAdjacencyList()) + raise - try: - correction = self.__addGroupThermoData(None, self.groups['ring'], molecule, {'*':atom}) - except KeyError: - logging.error("Couldn't find in ring database:") - logging.error(ring) - logging.error(ring.toAdjacencyList()) - raise - - if ringCorrection is None or ringCorrection.H298.value_si < correction.H298.value_si: - ringCorrection = correction - - self.__addThermoData(thermoData, ringCorrection) # Correct entropy for symmetry number molecule.calculateSymmetryNumber() From 5b292ebc9bc946c270894cf0b95b53faa2ffb1c3 Mon Sep 17 00:00:00 2001 From: Connie Gao Date: Fri, 18 Apr 2014 17:55:20 -0400 Subject: [PATCH 2/2] Update the debugging lines for thermogroups. They were outdated. --- rmgpy/data/thermo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rmgpy/data/thermo.py b/rmgpy/data/thermo.py index b96483f22cb..384ea5dc460 100644 --- a/rmgpy/data/thermo.py +++ b/rmgpy/data/thermo.py @@ -989,12 +989,12 @@ def __addGroupThermoData(self, thermoData, database, molecule, atom): data.comment = '{0}({1})'.format(database.label, comment) # This code prints the hierarchy of the found node; useful for debugging - #result = '' - #while node is not None: - # result = ' -> ' + node + result - # node = database.tree.parent[node] - #print result[4:] - +# result = '' +# while node is not None: +# result = ' -> ' + node.label + result +# node = node.parent +# print result[4:] + if thermoData is None: return data else: