rmgpy.reaction.Reaction

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

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
network_kinetics Arrhenius The kinetics model to use for PDep network exploration if the kinetics attribute is :class:PDepKineticsModel:
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
allow_pdep_route bool True if the reaction has an additional PDep pathway, False if not (by default), used for LibraryReactions
elementary_high_p bool If True, pressure dependent kinetics will be generated (relevant only for unimolecular library reactions) If False (by default), this library reaction will not be explored. Only unimolecular library reactions with high pressure limit kinetics should be flagged (not if the kinetics were measured at some relatively low pressure)
comment str A description of the reaction source (optional)
is_forward bool Indicates if the reaction was generated in the forward (true) or reverse (false)
allow_max_rate_violation

allow_max_rate_violation – ‘bool’

allow_pdep_route

allow_pdep_route – ‘bool’

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
calculate_coll_limit(self, float temp, bool reverse=False)

Calculate the collision limit rate for the given temperature implemented as recommended in Wang et al. doi 10.1016/j.combustflame.2017.08.005 (Eq. 1)

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.

check_collision_limit_violation(self, float t_min, float t_max, float p_min, float p_max) → list

Warn if a core reaction violates the collision limit rate in either the forward or reverse direction at the relevant extreme T/P conditions. Assuming a monotonic behaviour of the kinetics. Returns a list with the reaction object and the direction in which the violation was detected.

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’

elementary_high_p

elementary_high_p – ‘bool’

ensure_species(self, bool reactant_resonance=False, bool product_resonance=True)

Ensure the reaction contains species objects in its reactant and product attributes. If the reaction is found to hold molecule objects, it modifies the reactant, product and pairs to hold Species objects.

Generates resonance structures for Molecules if the corresponding options, reactant_resonance and/or product_resonance, are True. Does not generate resonance for reactants or products that start as Species objects.

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 (C/O/N/S at the moment). This should work most of the time, but a more rigorous algorithm may be needed for some cases.

generateReverseRateCoefficient(self, bool network_kinetics=False)

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.

get_mean_sigma_and_epsilon(self, bool reverse=False)

Calculates the collision diameter (sigma) using an arithmetic mean Calculates the well depth (epsilon) using a geometric mean If reverse is False the above is calculated for the reactants, otherwise for the products

get_reduced_mass(self, bool reverse=False)

Returns the reduced mass of the reactants if reverse is False Returns the reduced mass of the products if reverse is True

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 checkTemplateRxnProducts=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
checkTemplateRxnProducts indicates that only the products of the
reaction are checked for isomorphism. This is used when we know the reactants are identical, i.e. in generating reactions.
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.

is_forward

is_forward – ‘bool’

k_effective_cache

k_effective_cache – dict

kinetics

kinetics – rmgpy.kinetics.model.KineticsModel

label

label – str

matchesSpecies(self, list reactants, list products=None) → bool

Compares the provided reactants and products against the reactants and products of this reaction. Both directions are checked.

Parameters:
  • reactants (list) – Species required on one side of the reaction
  • products (list, optional) – Species required on the other side
network_kinetics

network_kinetics – rmgpy.kinetics.arrhenius.Arrhenius

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