-
Notifications
You must be signed in to change notification settings - Fork 230
Reaction Objects and Methods
-
all types of reaction object classes and functions
-
how kinetics are stored (eg. 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```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 and 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.
##str 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 ' <=> '
##reduce The reduce function is a helper function used when pickling an object.
##tochemkin
toChemkin 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.
#toCantera 1.The tocantera 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 and cantera is also imported. Creating an empty list that will be filled with species later as speciesList
2.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.
3.The same procedure is followed to create the products dictionary.
4.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.
##Types of kinetics
- 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)
5.Setting the reversibility, duplicate and ID attributes. The duplicate is set to True and the ID to original rmg index.
6.The function will print an error if there are no kinetics to convert at the end.
The getURL functions creates 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 reacatant species to empty string. Then the url is generated by concatanating the base URL with empty string.
eg:http://dev.rmg.mit.edu/database/kinetics/reaction/reactant1=1%20C%200%20%7B2,S%7D;2%20O%200%20%7B1,S%7D;__reactant2=1%20C%202T;__product1=1%20C%201;__product2=1%20C%200%20%7B2,S%7D;2%20O%201%20%7B1,S%7D;
##Functions(isIsomerization, isAssociation, isDissociation, isUnimolecular, hasTemplate)
- All these functions return True if the reaction represents isomerization, association, dissipation, unimolecular.