-
Notifications
You must be signed in to change notification settings - Fork 228
Reaction Objects and Methods
- all types of reaction object classes and functions
- how kinetics are stored (e.g. differences Arrhenius and ArrheniusEP)
In RMG Py, a chemical reaction is represented in memory as a:
class:Reaction
object. This module also provides the: class: ReactionModel
class for representing a set of chemical reactions and the species involved.
class Reaction
contains:
index
: class: int
A unique nonnegative integer index
label
: str
A descriptive string label
reactants
: class:list
The reactant species (as :class:Species
objects)
products
: class: list
The product species (as :class:Species
objects)
kinetics
: class: KineticsModel
The kinetics model to use for the reaction
reversible
: bool
True
if the reaction is reversible, False
if not
transitionState
: class: TransitionState
The transition state
duplicate
: bool
True
if the reaction is known to be a duplicate, False
if not
degeneracy': class:
double` The reaction path degeneracy for the reaction
pairs
: class: `list`` Reactant-product pairings to use in converting reaction flux to species flux
The __init__
function is used to set the initial values for all the listed attributes above, there's also a conditional statement to check whether the diffusion_limiter is enabled or not. If it's enabled add an another attribute called as k_effective_cache.
The __repr__
function is used to return a string representation that can be used to reconstruct the object. It checks whether any of the attributes are empty and assigns some value if they are empty using the conditional statements.
The __str__
function returns a neatly arranged chemical reaction with reactants and products from __self.reactants__
and __self.products__
attributes and connects them with arrow ' <=> '
The __reduce__
function is a helper function used when pickling an object.
to_chemkin
function takes three arguments self , speciesList , kinetics and returns 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.
-
The
to_cantera
function converts the RMG Reaction object to a Cantera Reaction object with the appropriate reaction class. From kinetics module, various models are imported, for example, Arrhenius, ArrheniusEP. -
Creating an empty list that will be filled with species later as speciesList
-
The dictionary for reactants are created in the next line using for loop to iterate through the reactants and reactant name is assigned using recursive function and the reactants are added to the dictionary by checking them whether they are already present in the dictionary or not using conditional statements.
-
The same procedure is followed to create the products dictionary.
-
The kinetics models are set in the next setup according to their type. The types of kinetics and their representative kinetics models from cantera is listed below.
- Arrhenius
- Cantera: ElementaryReaction
- ElementaryReaction: A reaction which follows mass-action kinetics with a modified Arrhenius reaction rate.
- ArrheniusEP
- Arrhenius but with an Evans-Polanyi rate rule
- MultiArrhenius
- Cantera: multiple ElementaryReaction types with
duplicate
attribute set True
- PDepArrhenius
- Cantera: PlogReaction
- PlogReaction: A pressure-dependent reaction parameterized by logarithmically interpolating between Arrhenius rate expressions at various pressures.
- Chemkin: PLOG
- MultiPDepArrhenius
- Cantera: mulpiple PlogReaction types with
duplicate
attribute set True
- Chebyshev
- Cantera: ChebyshevReaction
- ChebyshevReaction: A pressure-dependent reaction parameterized by a bivariate Chebyshev polynomial in temperature and pressure.
- Chemkin: CHEB
- ThirdBody
- Cantera: ThreeBodyReaction
- ThreeBodyReaction: A reaction with a non-reacting third body “M” that acts to add or remove energy from the reacting species.
- Lindemann
- Cantera: FalloffReaction or ChemicallyActivatedReaction (though we always translate to FalloffReaction)
- FalloffReaction : A parameterization used to describe the fall-off in reaction rate constants due to intermolecular energy transfer. These functions are used by reactions defined using the FalloffReaction and ChemicallyActivatedReaction classes.
- Troe
- Cantera: FalloffReaction or ChemicallyActivatedReaction (though we always translate to FalloffReaction)
-
Setting the reversibility, duplicate and ID attributes. The duplicate is set to
True
and the ID to original rmg index. -
The function will print an error if there are no kinetics to convert at the end.
The get_URL
functions create an URL from official RMG-website to search for the specific reaction.
- An empty string is declared which will be filled with reactants and products after running the loops and adds the reactant species to an empty string. Then the URL is generated by concatenating the base URL with an empty string.
- All these functions return
True
if the reaction represents isomerization, association, dissipation, unimolecular.
The function matches_species returns 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: class:Molecule
objects. It checks the forward reaction for any isomorphism, using a is_isomorphic
function which is defined in the next step.