From ad4c446f47d131e8d59fb358be9bd1ab24e83084 Mon Sep 17 00:00:00 2001 From: Shamel Merchant Date: Wed, 4 Dec 2013 18:21:11 -0500 Subject: [PATCH 1/5] Removing lingering references to LenardJones class Cantherm was failing because it was still refering to LenardJones class which is now removed after the transport branch has been merged. Made the writing of output of measure also consistent to use TransportModel --- convertFAME.py | 6 +++--- rmgpy/cantherm/input.py | 5 +++-- rmgpy/measure/main.py | 6 +++--- rmgpy/measure/output.py | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/convertFAME.py b/convertFAME.py index 01a352745f..12c82c338b 100644 --- a/convertFAME.py +++ b/convertFAME.py @@ -20,7 +20,7 @@ from rmgpy.pdep import Network, Configuration, SingleExponentialDown from rmgpy.species import Species, TransitionState from rmgpy.reaction import Reaction -from rmgpy.species import LennardJones +from rmgpy.transport import TransportData from rmgpy.statmech import HarmonicOscillator, HinderedRotor, Conformer from rmgpy.thermo import ThermoData from rmgpy.kinetics import Arrhenius @@ -146,7 +146,7 @@ def readMeaningfulLine(f): sigmaLJunits, sigmaLJ = readMeaningfulLine(f).split() epsilonLJunits, epsilonLJ = readMeaningfulLine(f).split() assert epsilonLJunits == 'J' - bathGas.lennardJones = LennardJones( + bathGas.transportData = TransportData( sigma = Quantity(float(sigmaLJ), sigmaLJunits), epsilon = Quantity(float(epsilonLJ) / constants.kB, 'K'), ) @@ -195,7 +195,7 @@ def readMeaningfulLine(f): sigmaLJunits, sigmaLJ = readMeaningfulLine(f).split() epsilonLJunits, epsilonLJ = readMeaningfulLine(f).split() assert epsilonLJunits == 'J' - species.lennardJones = LennardJones( + species.transportData = TransportData( sigma = Quantity(float(sigmaLJ), sigmaLJunits), epsilon = Quantity(float(epsilonLJ) / constants.kB, 'K'), ) diff --git a/rmgpy/cantherm/input.py b/rmgpy/cantherm/input.py index f4a6cb19c4..37b422372c 100644 --- a/rmgpy/cantherm/input.py +++ b/rmgpy/cantherm/input.py @@ -43,6 +43,7 @@ from rmgpy.pdep import * from rmgpy.pdep.collision import * from rmgpy.molecule import Molecule +from rmgpy.transport import TransportData from rmgpy.cantherm.gaussian import GaussianLog from rmgpy.cantherm.molepro import MoleProLog @@ -112,7 +113,7 @@ def species(label, *args, **kwargs): if structure: spec.molecule = [structure] spec.conformer = Conformer(E0=E0, modes=modes, spinMultiplicity=spinMultiplicity, opticalIsomers=opticalIsomers) spec.molecularWeight = molecularWeight - spec.lennardJones = collisionModel + spec.transportData = collisionModel spec.energyTransferModel = energyTransferModel spec.thermo = thermo @@ -325,7 +326,7 @@ def loadInputFile(path): 'False': False, 'range': range, # Collision - 'LennardJones': LennardJones, + 'TransportData': TransportData, 'SingleExponentialDown': SingleExponentialDown, # Kinetics 'Arrhenius': Arrhenius, diff --git a/rmgpy/measure/main.py b/rmgpy/measure/main.py index d1c96e0769..afcc68bc99 100644 --- a/rmgpy/measure/main.py +++ b/rmgpy/measure/main.py @@ -289,7 +289,7 @@ def loadFAMEInput(self, path, moleculeDict=None): from collision import SingleExponentialDown from rmgpy.species import Species, TransitionState from rmgpy.reaction import Reaction - from rmgpy.species import LennardJones + from rmgpy.transport import TransportData from rmgpy.statmech import HarmonicOscillator, HinderedRotor, StatesModel from rmgpy.thermo import ThermoData from rmgpy.kinetics import Arrhenius @@ -377,7 +377,7 @@ def readMeaningfulLine(f): bathGas.molecularWeight = Quantity(float(molWt), molWtunits) sigmaLJunits, sigmaLJ = readMeaningfulLine(f).split() epsilonLJunits, epsilonLJ = readMeaningfulLine(f).split() - bathGas.lennardJones = LennardJones( + bathGas.transportData = TransportData( sigma = Quantity(float(sigmaLJ), sigmaLJunits), epsilon = Quantity(float(epsilonLJ), epsilonLJunits), ) @@ -418,7 +418,7 @@ def readMeaningfulLine(f): species.molecularWeight = Quantity(float(molWt), molWtunits) sigmaLJunits, sigmaLJ = readMeaningfulLine(f).split() epsilonLJunits, epsilonLJ = readMeaningfulLine(f).split() - species.lennardJones = LennardJones( + species.transportData = TransportData( sigma = Quantity(float(sigmaLJ), sigmaLJunits), epsilon = Quantity(float(epsilonLJ), epsilonLJunits), ) diff --git a/rmgpy/measure/output.py b/rmgpy/measure/output.py index f13e9f0c96..7992bb0237 100644 --- a/rmgpy/measure/output.py +++ b/rmgpy/measure/output.py @@ -148,8 +148,8 @@ def writeSpecies(f, spec): writeStates(f, spec.states, prefix=' ') if spec.thermo is not None: f.write(' thermo={0!r},\n'.format(spec.thermo)) - if spec.lennardJones is not None: - f.write(' lennardJones={0!r},\n'.format(spec.lennardJones)) + if spec.transportData is not None: + f.write(' TransportData={0!r},\n'.format(spec.transportData)) if spec.molecularWeight is not None: f.write(' molecularWeight={0!r},\n'.format(spec.molecularWeight)) if spec.collisionModel is not None: From 64273169ccab534126f52fcc8c68f80b45e8425a Mon Sep 17 00:00:00 2001 From: Shamel Merchant Date: Fri, 6 Dec 2013 15:29:57 -0500 Subject: [PATCH 2/5] Fix to make standalone Cantherm work Commit 5c4a2da0aec8e7abcc0153e4bfd62f84fe9f88d6 would modify the label in the input file causing Cantherm to crash when its trying to calculate kinetics for that reaction. --- rmgpy/cantherm/input.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rmgpy/cantherm/input.py b/rmgpy/cantherm/input.py index 37b422372c..2c38bc53e2 100644 --- a/rmgpy/cantherm/input.py +++ b/rmgpy/cantherm/input.py @@ -161,9 +161,11 @@ def transitionState(label, *args, **kwargs): def reaction(label, reactants, products, transitionState, kinetics=None, tunneling=''): global reactionDict, speciesDict, transitionStateDict - label = 'reaction'+transitionState + #label = 'reaction'+transitionState if label in reactionDict: - raise ValueError('Multiple occurrences of reaction with label {0!r}.'.format(label)) + label = label+transitionState + if label in reactionDict: + raise ValueError('Multiple occurrences of reaction with label {0!r}.'.format(label)) logging.info('Loading reaction {0}...'.format(label)) reactants = sorted([speciesDict[spec] for spec in reactants]) products = sorted([speciesDict[spec] for spec in products]) @@ -178,6 +180,9 @@ def reaction(label, reactants, products, transitionState, kinetics=None, tunneli raise ValueError('Unknown tunneling model {0!r}.'.format(tunneling)) rxn = Reaction(label=label, reactants=reactants, products=products, transitionState=transitionState, kinetics=kinetics) reactionDict[label] = rxn + + print rxn + return rxn def network(label, isomers=None, reactants=None, products=None, pathReactions=None, bathGas=None): From 10b4d6953cf4bef6fb9caa416a3be9726957ff83 Mon Sep 17 00:00:00 2001 From: Beat Buesser Date: Fri, 20 Dec 2013 17:02:13 -0500 Subject: [PATCH 3/5] Add saturateH=True to fromAdjacencyList() in loadOldDictionary() --- rmgpy/data/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmgpy/data/base.py b/rmgpy/data/base.py index 860a5c6254..42b34ee471 100644 --- a/rmgpy/data/base.py +++ b/rmgpy/data/base.py @@ -371,9 +371,9 @@ def loadOldDictionary(self, path, pattern): self.entries[label].item = makeLogicNode(' '.join(lines[1:]) ) # Otherwise convert adjacency list to molecule or pattern elif pattern: - self.entries[label].item = Group().fromAdjacencyList(record) + self.entries[label].item = Group().fromAdjacencyList(record,saturateH=True) else: - self.entries[label].item = Molecule().fromAdjacencyList(record) + self.entries[label].item = Molecule().fromAdjacencyList(record,saturateH=True) except InvalidAdjacencyListError, e: logging.error('Error while loading old-style dictionary "{0}"'.format(path)) logging.error('Error occurred while parsing adjacency list "{0}"'.format(label)) From 46f576136750b76cda19838ec88a847e35ec7c5b Mon Sep 17 00:00:00 2001 From: Beat Buesser Date: Sun, 2 Feb 2014 00:34:58 -0500 Subject: [PATCH 4/5] change loop length over PdepNetworks in search for maximum leak rates - numPdepNetworks = self.networkCount was the number of PdepNetworks ever created in that model - len(self.networkList) is the number of actually existing PdepNetworks at any time fixes #176 --- rmgpy/rmg/model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rmgpy/rmg/model.py b/rmgpy/rmg/model.py index 36c0bcffa4..5d6679086e 100644 --- a/rmgpy/rmg/model.py +++ b/rmgpy/rmg/model.py @@ -1040,7 +1040,6 @@ def prune(self, reactionSystems, fluxToleranceKeepInEdge, maximumEdgeSpecies): numCoreSpecies = len(self.core.species) numEdgeSpecies = len(self.edge.species) - numPdepNetworks = self.networkCount # All edge species that have not existed for more than two enlarge # iterations are ineligible for pruning @@ -1057,7 +1056,7 @@ def prune(self, reactionSystems, fluxToleranceKeepInEdge, maximumEdgeSpecies): if maxEdgeSpeciesRates[i] < rate: maxEdgeSpeciesRates[i] = rate - for i in range(numPdepNetworks): + for i in range(len(self.networkList)): network = self.networkList[i] rate = reactionSystem.maxNetworkLeakRates[i] # Add the fraction of the network leak rate contributed by From 819b28a7c0e86e17d63edb9fba971af1d8c59b9a Mon Sep 17 00:00:00 2001 From: Beat Buesser Date: Tue, 4 Feb 2014 14:33:03 -0500 Subject: [PATCH 5/5] Limit the search for electronic states to atoms involved in reaction - limit search on labeled atoms - this is currently RMG-specific to track electronic states as attribute of single atoms, we have to consider moving on to tracking it as a species property --- rmgpy/data/kinetics/family.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index bdf154f492..b5db0c6cda 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1168,7 +1168,7 @@ def __generateProductStructures(self, reactantStructures, maps, forward, **optio radical1 = atom1.radicalElectrons spin1 = atom1.spinMultiplicity - if radical1 > 1 and radical1 < 4: + if atom1.label != '' and radical1 > 1 and radical1 < 4: if radical1 == 2 and spin1 == 3: atom1.setSpinMultiplicity(1) @@ -1245,7 +1245,7 @@ def __generateProductStructures(self, reactantStructures, maps, forward, **optio radical2 = atom2.radicalElectrons spin2 = atom2.spinMultiplicity - if radical2 > 1 and radical2 < 4: + if atom2.label != '' and radical2 > 1 and radical2 < 4: if radical2 == 2 and spin2 == 3: atom2.setSpinMultiplicity(1)