From cfce9f1c661e7927e6ce4c4d6f6b9126981c3022 Mon Sep 17 00:00:00 2001 From: Nestor Aguirre Date: Tue, 14 Nov 2023 12:49:15 +0100 Subject: [PATCH] Progress on implementing temperature scanning calculations -- SO-- --- core/ElementaryReaction.py | 15 ++++++++ core/Mechanism.py | 10 ++++++ core/RKFLoader.py | 26 +++++++++----- core/RKFPrefactors.py | 70 ++++++++++++++++++++++++++++++++++++++ core/ZacrosJob.py | 3 ++ 5 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 core/RKFPrefactors.py diff --git a/core/ElementaryReaction.py b/core/ElementaryReaction.py index 84a6fdc..221d9a6 100644 --- a/core/ElementaryReaction.py +++ b/core/ElementaryReaction.py @@ -113,6 +113,10 @@ def __init__(self, self.__label = None self.__updateLabel() + # Hidden attributes. Only for using with AMS + self._kf_prefactors_forward = RKFPrefactors() + self._kf_prefactors_backward = RKFPrefactors() + def __eq__(self, other): """ @@ -325,3 +329,14 @@ def replace_site_types( self, site_types_old, site_types_new ): self.site_types[j] = site_types_new[i] self.__updateLabel() + + + def set_temperature( self, temperature ): + """ + Sets the temperature of the reaction. It recalculates the pre-exponential factors if needed. + + * ``temperature`` -- Temperature in K + """ + + for erxn in self: + erxn.set_temperature( temperature ) diff --git a/core/Mechanism.py b/core/Mechanism.py index d174354..08dc8f7 100644 --- a/core/Mechanism.py +++ b/core/Mechanism.py @@ -345,3 +345,13 @@ def find_one( self, label ): """ return next(rxn for rxn in self if rxn.label().find(label) != -1) + + def set_temperature( self, temperature ): + """ + Sets the temperature of the mechanism. It recalculates the pre-exponential factors if needed. + + * ``temperature`` -- Temperature in K + """ + + for erxn in self: + erxn.set_temperature( temperature ) diff --git a/core/RKFLoader.py b/core/RKFLoader.py index 4d847b3..fa532db 100644 --- a/core/RKFLoader.py +++ b/core/RKFLoader.py @@ -60,6 +60,7 @@ def __deriveLatticeAndMechanism( self, results ): isTS = results.readrkf("EnergyLandscape", "isTS") reactants = results.readrkf("EnergyLandscape", "reactants") products = results.readrkf("EnergyLandscape", "products") + prefactorsTemperature = results.readrkf("EnergyLandscape", "prefactorsTemperature") prefactorsFromReactant = results.readrkf("EnergyLandscape", "prefactorsFromReactant") prefactorsFromProduct = results.readrkf("EnergyLandscape", "prefactorsFromProduct") @@ -491,6 +492,11 @@ def getGasFormationEnergy( mol, energy ): pe_ratio=pe_ratio, activation_energy=activationEnergy ) + reaction._prefactors_temperature = prefactorsTemperature + reaction._prefactors_model = REACTION_MEDIATED_BY_A_TRANSITION_STATE + reaction._kf_reactants = fileName[idReactant] + reaction._kf_products = fileName[idProduct] + #self.clusterExpansion.extend( [clusterReactant, clusterProduct] ) self.mechanism.append( reaction ) @@ -543,14 +549,18 @@ def getGasFormationEnergy( mol, energy ): activationEnergy = 0.0 if state2Energy[idState]