rmgpy.reaction.Reaction

class rmgpy.reaction.Reaction(index=-1, label='', reactants=None, products=None, specificCollider=None, kinetics=None, reversible=True, transitionState=None, duplicate=False, degeneracy=1, pairs=None, comment='')

A chemical reaction. The attributes are:

Attribute Type Description
index int A unique nonnegative integer index
label str A descriptive string label
reactants list The reactant species (as Species objects)
products list The product species (as Species objects)
‘specificCollider’ Species The collider species (as a Species object)
kinetics KineticsModel The kinetics model to use for the reaction
reversible bool True if the reaction is reversible, False if not
transitionState TransitionState The transition state
duplicate bool True if the reaction is known to be a duplicate, False if not
degeneracy double The reaction path degeneracy for the reaction
pairs list Reactant-product pairings to use in converting reaction flux to species flux
comment str A description of the reaction source (optional)
calculateMicrocanonicalRateCoefficient(self, ndarray Elist, ndarray Jlist, ndarray reacDensStates, ndarray prodDensStates=None, double T=0.0)

Calculate the microcanonical rate coefficient \(k(E)\) for the reaction reaction at the energies Elist in J/mol. reacDensStates and prodDensStates are the densities of states of the reactant and product configurations for this reaction. If the reaction is irreversible, only the reactant density of states is required; if the reaction is reversible, then both are required. This function will try to use the best method that it can based on the input data available:

  • If detailed information has been provided for the transition state (i.e. the molecular degrees of freedom), then RRKM theory will be used.
  • If the above is not possible but high-pressure limit kinetics \(k_\infty(T)\) have been provided, then the inverse Laplace transform method will be used.

The density of states for the product prodDensStates and the temperature of interest T in K can also be provided. For isomerization and association reactions prodDensStates is required; for dissociation reactions it is optional. The temperature is used if provided in the detailed balance expression to determine the reverse kinetics, and in certain cases in the inverse Laplace transform method.

calculateTSTRateCoefficient(self, double T) → double

Evaluate the forward rate coefficient for the reaction with corresponding transition state TS at temperature T in K using (canonical) transition state theory. The TST equation is

\[k(T) = \kappa(T) \frac{k_\mathrm{B} T}{h} \frac{Q^\ddagger(T)}{Q^\mathrm{A}(T) Q^\mathrm{B}(T)} \exp \left( -\frac{E_0}{k_\mathrm{B} T} \right)\]

where \(Q^\ddagger\) is the partition function of the transition state, \(Q^\mathrm{A}\) and \(Q^\mathrm{B}\) are the partition function of the reactants, \(E_0\) is the ground-state energy difference from the transition state to the reactants, \(T\) is the absolute temperature, \(k_\mathrm{B}\) is the Boltzmann constant, and \(h\) is the Planck constant. \(\kappa(T)\) is an optional tunneling correction.

calculateTSTRateCoefficients(self, ndarray Tlist) → ndarray
canTST(self) → bool

Return True if the necessary parameters are available for using transition state theory – or the microcanonical equivalent, RRKM theory – to compute the rate coefficient for this reaction, or False otherwise.

comment

comment: str

copy(self)

Create a deep copy of the current reaction.

degeneracy

Reaction.__getDegneneracy(self)

draw(self, path)

Generate a pictorial representation of the chemical reaction using the draw module. Use path to specify the file to save the generated image to; the image type is automatically determined by extension. Valid extensions are .png, .svg, .pdf, and .ps; of these, the first is a raster format and the remainder are vector formats.

duplicate

duplicate: ‘bool’

fixBarrierHeight(self, bool forcePositive=False)

Turns the kinetics into Arrhenius (if they were ArrheniusEP) and ensures the activation energy is at least the endothermicity for endothermic reactions, and is not negative only as a result of using Evans Polanyi with an exothermic reaction. If forcePositive is True, then all reactions are forced to have a non-negative barrier.

fixDiffusionLimitedA(self, T)

Decrease the pre-exponential factor (A) by the diffusion factor to account for the diffusion limit at the specified temperature.

generate3dTS(self, reactants, products)

Generate the 3D structure of the transition state. Called from model.generateKinetics().

self.reactants is a list of reactants self.products is a list of products

generatePairs(self)

Generate the reactant-product pairs to use for this reaction when performing flux analysis. The exact procedure for doing so depends on the reaction type:

Reaction type Template Resulting pairs
Isomerization A -> C (A,C)
Dissociation A -> C + D (A,C), (A,D)
Association A + B -> C (A,C), (B,C)
Bimolecular A + B -> C + D (A,C), (B,D) or (A,D), (B,C)

There are a number of ways of determining the correct pairing for bimolecular reactions. Here we try a simple similarity analysis by comparing the number of heavy atoms (carbons and oxygens at the moment). This should work most of the time, but a more rigorous algorithm may be needed for some cases.

generateReverseRateCoefficient(self)

Generate and return a rate coefficient model for the reverse reaction. Currently this only works if the kinetics attribute is one of several (but not necessarily all) kinetics types.

getEnthalpiesOfReaction(self, ndarray Tlist) → ndarray

Return the enthalpies of reaction in J/mol evaluated at temperatures Tlist in K.

getEnthalpyOfReaction(self, double T) → double

Return the enthalpy of reaction in J/mol evaluated at temperature T in K.

getEntropiesOfReaction(self, ndarray Tlist) → ndarray

Return the entropies of reaction in J/mol*K evaluated at temperatures Tlist in K.

getEntropyOfReaction(self, double T) → double

Return the entropy of reaction in J/mol*K evaluated at temperature T in K.

getEquilibriumConstant(self, double T, str type='Kc') → double

Return the equilibrium constant for the reaction at the specified temperature T in K. The type parameter lets you specify the quantities used in the equilibrium constant: Ka for activities, Kc for concentrations (default), or Kp for pressures. Note that this function currently assumes an ideal gas mixture.

getEquilibriumConstants(self, ndarray Tlist, str type='Kc') → ndarray

Return the equilibrium constants for the reaction at the specified temperatures Tlist in K. The type parameter lets you specify the quantities used in the equilibrium constant: Ka for activities, Kc for concentrations (default), or Kp for pressures. Note that this function currently assumes an ideal gas mixture.

getFreeEnergiesOfReaction(self, ndarray Tlist) → ndarray

Return the Gibbs free energies of reaction in J/mol evaluated at temperatures Tlist in K.

getFreeEnergyOfReaction(self, double T) → double

Return the Gibbs free energy of reaction in J/mol evaluated at temperature T in K.

getRateCoefficient(self, double T, double P=0) → double

Return the overall rate coefficient for the forward reaction at temperature T in K and pressure P in Pa, including any reaction path degeneracies.

If diffusionLimiter is enabled, the reaction is in the liquid phase and we use a diffusion limitation to correct the rate. If not, then use the intrinsic rate coefficient.

getStoichiometricCoefficient(self, Species spec) → int

Return the stoichiometric coefficient of species spec in the reaction. The stoichiometric coefficient is increased by one for each time spec appears as a product and decreased by one for each time spec appears as a reactant.

getURL(self)

Get a URL to search for this reaction in the rmg website.

hasTemplate(self, list reactants, list products) → bool

Return True if the reaction matches the template of reactants and products, which are both lists of Species objects, or False if not.

index

index: ‘int’

isAssociation(self) → bool

Return True if the reaction represents an association reaction \(\ce{A + B <=> C}\) or False if not.

isBalanced(self) → bool

Return True if the reaction has the same number of each atom on each side of the reaction equation, or False if not.

isDissociation(self) → bool

Return True if the reaction represents a dissociation reaction \(\ce{A <=> B + C}\) or False if not.

isIsomerization(self) → bool

Return True if the reaction represents an isomerization reaction \(\ce{A <=> B}\) or False if not.

isIsomorphic(self, Reaction other, bool eitherDirection=True, bool checkIdentical=False, bool checkOnlyLabel=False) → bool

Return True if this reaction is the same as the other reaction, or False if they are different. The comparison involves comparing isomorphism of reactants and products, and doesn’t use any kinetic information.

If eitherDirection=False then the directions must match.

checkIdentical indicates that atom ID’s must match and is used in
checking degeneracy
checkOnlyLabel indicates that the string representation will be
checked, ignoring the molecular structure comparisons
isUnimolecular(self) → bool

Return True if the reaction has a single molecule as either reactant or product (or both) \(\ce{A <=> B + C}\) or \(\ce{A + B <=> C}\) or \(\ce{A <=> B}\), or False if not.

k_effective_cache

k_effective_cache: dict

kinetics

kinetics: rmgpy.kinetics.model.KineticsModel

label

label: str

matchesMolecules(self, list reactants) → bool

Return True if the given reactants represent the total set of reactants or products for the current reaction, or False if not. The reactants should be Molecule objects.

pairs

pairs: list

products

products: list

reactants

reactants: list

reverseThisArrheniusRate(self, Arrhenius kForward, str reverseUnits)

Reverses the given kForward, which must be an Arrhenius type. You must supply the correct units for the reverse rate. The equilibrium constant is evaluated from the current reaction instance (self).

reversible

reversible: ‘bool’

specificCollider

specificCollider: rmgpy.species.Species

toCantera(self, speciesList=None, useChemkinIdentifier=False)

Converts the RMG Reaction object to a Cantera Reaction object with the appropriate reaction class.

If useChemkinIdentifier is set to False, the species label is used instead. Be sure that species’ labels are unique when setting it False.

toChemkin(self, speciesList=None, kinetics=True)

Return the chemkin-formatted string for this reaction.

If kinetics is set to True, the chemkin format kinetics will also be returned (requires the speciesList to figure out third body colliders.) Otherwise, only the reaction string will be returned.

toLabeledStr(self, use_index=False)

the same as __str__ except that the labels are assumed to exist and used for reactant and products rather than the labels plus the index in parentheses

transitionState

transitionState: rmgpy.species.TransitionState