From b24ca4ea1404eaa90816c5b0d4098f12b4a47a4d Mon Sep 17 00:00:00 2001 From: Richard West Date: Tue, 18 Jul 2023 17:00:29 -0400 Subject: [PATCH] Consistently use T=298. K for fitting and evaluating Blowers-Masel rates. Closes https://github.com/ReactionMechanismGenerator/RMG-Py/issues/1748 --- rmgpy/data/kinetics/family.py | 8 ++++---- rmgpy/kinetics/arrhenius.pyx | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index 8258a99b17c..89e49c395ad 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -3863,13 +3863,13 @@ def cross_validate(self, folds=5, template_rxn_map=None, test_rxn_inds=None, T=1 if kinetics.E0.value_si < 0.0 or len(L) == 1: kinetics = average_kinetics([r.kinetics for r in L]) else: - kinetics = kinetics.to_arrhenius(rxn.get_enthalpy_of_reaction(298.0)) + kinetics = kinetics.to_arrhenius(rxn.get_enthalpy_of_reaction(298.)) else: kinetics = ArrheniusChargeTransferBM().fit_to_reactions(L, recipe=self.forward_recipe.actions) if kinetics.E0.value_si < 0.0 or len(L) == 1: kinetics = average_kinetics([r.kinetics for r in L]) else: - kinetics = kinetics.to_arrhenius_charge_transfer(rxn.get_enthalpy_of_reaction(298.0)) + kinetics = kinetics.to_arrhenius_charge_transfer(rxn.get_enthalpy_of_reaction(298.)) k = kinetics.get_rate_coefficient(T) errors[rxn] = np.log(k / krxn) @@ -4803,7 +4803,7 @@ def _make_rule(rr): dlnks = np.array([ np.log( arr().fit_to_reactions(rs[list(set(range(len(rs))) - {i})], recipe=recipe) - .to_arrhenius(rxn.get_enthalpy_of_reaction(Tref)) + .to_arrhenius(rxn.get_enthalpy_of_reaction(298.)) .get_rate_coefficient(T=Tref) / rxn.get_rate_coefficient(T=Tref) ) for i, rxn in enumerate(rs) ]) # 1) fit to set of reactions without the current reaction (k) 2) compute log(kfit/kactual) at Tref @@ -4811,7 +4811,7 @@ def _make_rule(rr): dlnks = np.array([ np.log( arr().fit_to_reactions(rs[list(set(range(len(rs))) - {i})], recipe=recipe) - .to_arrhenius_charge_transfer(rxn.get_enthalpy_of_reaction(Tref)) + .to_arrhenius_charge_transfer(rxn.get_enthalpy_of_reaction(298.)) .get_rate_coefficient(T=Tref) / rxn.get_rate_coefficient(T=Tref) ) for i, rxn in enumerate(rs) ]) # 1) fit to set of reactions without the current reaction (k) 2) compute log(kfit/kactual) at Tref diff --git a/rmgpy/kinetics/arrhenius.pyx b/rmgpy/kinetics/arrhenius.pyx index 504f80e3987..cd903f49653 100644 --- a/rmgpy/kinetics/arrhenius.pyx +++ b/rmgpy/kinetics/arrhenius.pyx @@ -559,7 +559,7 @@ cdef class ArrheniusBM(KineticsModel): """ Return the rate coefficient in the appropriate combination of m^3, mol, and s at temperature `T` in K and enthalpy of reaction `dHrxn` - in J/mol. + in J/mol, evaluated at 298 K. """ cdef double A, n, Ea Ea = self.get_activation_energy(dHrxn) @@ -570,7 +570,7 @@ cdef class ArrheniusBM(KineticsModel): cpdef double get_activation_energy(self, double dHrxn) except -1: """ Return the activation energy in J/mol corresponding to the given - enthalpy of reaction `dHrxn` in J/mol. + enthalpy of reaction `dHrxn` in J/mol, evaluated at 298 K. """ cdef double w0, E0 E0 = self._E0.value_si @@ -586,7 +586,8 @@ cdef class ArrheniusBM(KineticsModel): cpdef Arrhenius to_arrhenius(self, double dHrxn): """ Return an :class:`Arrhenius` instance of the kinetics model using the - given enthalpy of reaction `dHrxn` to determine the activation energy. + given enthalpy of reaction `dHrxn` (in J/mol, evaluated at 298 K) + to determine the activation energy. """ return Arrhenius( A=self.A, @@ -615,7 +616,6 @@ cdef class ArrheniusBM(KineticsModel): w0 = sum(w0s) / len(w0s) if len(rxns) == 1: - T = 1000.0 rxn = rxns[0] dHrxn = rxn.get_enthalpy_of_reaction(298.0) A = rxn.kinetics.A.value_si @@ -632,7 +632,7 @@ cdef class ArrheniusBM(KineticsModel): self.Tmin = rxn.kinetics.Tmin self.Tmax = rxn.kinetics.Tmax self.solute = None - self.comment = 'Fitted to {0} reaction at temperature: {1} K'.format(len(rxns), T) + self.comment = 'Fitted to 1 reaction.' else: # define optimization function def kfcn(xs, lnA, n, E0):