# rmgpy.rmg.model.CoreEdgeReactionModel¶

class rmgpy.rmg.model.CoreEdgeReactionModel(core=None, edge=None, surface=None)

Represent a reaction model constructed using a rate-based screening algorithm. The species and reactions in the model itself are called the core; the species and reactions identified as candidates for inclusion in the model are called the edge. The attributes are:

Attribute Description
core The species and reactions of the current model core
edge The species and reactions of the current model edge
networkDict A dictionary of pressure-dependent reaction networks (Network objects) indexed by source.
networkList A list of pressure-dependent reaction networks (Network objects)
networkCount A counter for the number of pressure-dependent networks created
indexSpeciesDict A dictionary with a unique index pointing to the species objects
solventName String describing solvent name for liquid reactions. Empty for non-liquid estimation
addNewSurfaceObjects(obj, newSurfaceSpecies, newSurfaceReactions, reactionSystem)

obj is the list of objects for enlargement coming from simulate newSurfaceSpecies and newSurfaceReactions are the current lists of surface species and surface reactions following simulation reactionSystem is the current reactor manages surface species and reactions being moved to and from the surface moves them to appropriate newSurfaceSpc/RxnsAdd/loss sets returns false if the surface has changed

addReactionLibraryToEdge(reactionLibrary)

Add all species and reactions from reactionLibrary, a KineticsPrimaryDatabase object, to the model edge.

addReactionLibraryToOutput(reactionLib)

Add all species and reactions from reactionLibrary, a KineticsPrimaryDatabase object, to the output. This does not bring any of the reactions or species into the core itself.

addReactionToCore(rxn)

Add a reaction rxn to the reaction model core (and remove from edge if necessary). This function assumes rxn has already been checked to ensure it is supposed to be a core reaction (i.e. all of its reactants AND all of its products are in the list of core species).

addReactionToEdge(rxn)

Add a reaction rxn to the reaction model edge. This function assumes rxn has already been checked to ensure it is supposed to be an edge reaction (i.e. all of its reactants OR all of its products are in the list of core species, and the others are in either the core or the edge).

addReactionToUnimolecularNetworks(newReaction, newSpecies, network=None)

Given a newly-created Reaction object newReaction, update the corresponding unimolecular reaction network. If no network exists, a new one is created. If the new reaction is an isomerization that connects two existing networks, the two networks are merged. This function is called whenever a new high-pressure limit edge reaction is created. Returns the network containing the new reaction.

addSeedMechanismToCore(seedMechanism, react=False)

Add all species and reactions from seedMechanism, a KineticsPrimaryDatabase object, to the model core. If react is True, then reactions will also be generated between the seed species. For large seed mechanisms this can be prohibitively expensive, so it is not done by default.

addSpeciesToCore(spec)

Add a species spec to the reaction model core (and remove from edge if necessary). This function also moves any reactions in the edge that gain core status as a result of this change in status to the core. If this are any such reactions, they are returned in a list.

addSpeciesToEdge(spec)

Add a species spec to the reaction model edge.

adjustSurface()

Here we add species intended to be added and remove any species that need to be moved out of the core. For now we remove reactions from the surface that have become part of a PDepNetwork by intersecting the set of surface reactions with the core so that all surface reactions are in the core thus the surface algorithm currently (June 2017) is not implemented for pdep networks (however it will function fine for non-pdep reactions on a pdep run)

applyKineticsToReaction(reaction)

retrieve the best kinetics for the reaction and apply it towards the forward or reverse direction (if reverse, flip the direaction).

checkForExistingReaction(rxn)

Check to see if an existing reaction has the same reactants, products, and family as rxn. Returns True or False and the matched reaction (if found).

First, a shortlist of reaction is retrieved that have the same reaction keys as the parameter reaction.

Next, the reaction ID containing an identifier (e.g. label) of the reactants and products is compared between the parameter reaction and the each of the reactions in the shortlist. If a match is found, the discovered reaction is returned.

If a match is not yet found, the Library (seed mechs, reaction libs) in the reaction database are iterated over to check if a reaction was overlooked (a reaction with a different “family” key as the parameter reaction).

checkForExistingSpecies(molecule)

Check to see if an existing species contains the same molecule.Molecule as molecule. Returns True, reactive, and the matched species (if found) or False, False, and None (if not found). reactive is a boolean argument which is False if this molecule is an unrepresentative resonance structure of an existing species (i.e., was found to be isomorphic only by generating its unfiltered resonance structures) and True otherwise. It is emphasized that reactive relates to the Molecule attribute.

clearSurfaceAdjustments()

empties surface tracking varaibles

enlarge(newObject=None, reactEdge=False, unimolecularReact=None, bimolecularReact=None, trimolecularReact=None)

Enlarge a reaction model by processing the objects in the list newObject. If newObject is a rmg.species.Species object, then the species is moved from the edge to the core and reactions generated for that species, reacting with itself and with all other species in the model core. If newObject is a rmg.unirxn.network.Network object, then reactions are generated for the species in the network with the largest leak flux.

If the reactEdge flag is True, then no newObject is needed, and instead the algorithm proceeds to react the core species together to form edge reactions.

generateKinetics(reaction)

Generate best possible kinetics for the given reaction using the kinetics database.

getLists()

Return lists of all of the species and reactions in the core and the edge.

getModelSize()

Return the numbers of species and reactions in the model core and edge. Note that this is not necessarily equal to the lengths of the corresponding species and reaction lists.

getSpecies(obj)

Retrieve species object, by polling the index species dictionary.

getStoichiometryMatrix()

Return the stoichiometry matrix for all generated species and reactions. The id of each species and reaction is the corresponding row and column, respectively, in the matrix.

inflate(rxn)

Convert reactions from reactants/products that are referring to the core species index, to the respective Species objects.

initializeIndexSpeciesDict()

Populates the core species dictionary

integer -> core Species

with the species that are currently in the core.

makeNewPDepReaction(forward)

Make a new pressure-dependent reaction based on a list of reactants and a list of products. The reaction belongs to the specified network and has pressure-dependent kinetics given by kinetics.

No checking for existing reactions is made here. The returned PDepReaction object is not added to the global list of reactions, as that is intended to represent only the high-pressure-limit set. The reactionCounter is incremented, however, since the returned reaction can and will exist in the model edge and/or core.

makeNewReaction(forward, checkExisting=True)

Make a new reaction given a Reaction object forward. The reaction is added to the global list of reactions. Returns the reaction in the direction that corresponds to the estimated kinetics, along with whether or not the reaction is new to the global reaction list.

The forward direction is determined using the “is_reverse” attribute of the reaction’s family. If the reaction family is its own reverse, then it is made such that the forward reaction is exothermic at 298K.

The forward reaction is appended to self.newReactionList if it is new.

makeNewSpecies(object, label='', reactive=True, checkForExisting=True)

Formally create a new species from the specified object, which can be either a Molecule object or an rmgpy.species.Species object. It is emphasized that reactive relates to the Species attribute, while reactive_structure relates to the Molecule attribute.

markChemkinDuplicates()

Check that all reactions that will appear the chemkin output have been checked as duplicates.

Call this if you’ve done something that may have introduced undetected duplicate reactions, like add a reaction library or seed mechanism. Anything added via the expand() method should already be detected.

printEnlargeSummary(newCoreSpecies, newCoreReactions, newEdgeSpecies, newEdgeReactions, reactionsMovedFromEdge=None, reactEdge=False)

Output a summary of a model enlargement step to the log. The details of the enlargement are passed in the newCoreSpecies, newCoreReactions, newEdgeSpecies, and newEdgeReactions objects.

processNewReactions(newReactions, newSpecies, pdepNetwork=None)

Process a list of newly-generated reactions involving the new core species or explored isomer newSpecies in network pdepNetwork.

Makes a reaction and decides where to put it: core, edge, or PDepNetwork.

prune(reactionSystems, toleranceKeepInEdge, toleranceMoveToCore, maximumEdgeSpecies, minSpeciesExistIterationsForPrune)

Remove species from the model edge based on the simulation results from the list of reactionSystems.

registerReaction(rxn)

Adds the reaction to the reaction database.

The reaction database is structured as a multi-level dictionary, for efficient search and retrieval of existing reactions.

The database has two types of dictionary keys: - reaction family - reactant(s) keys

First, the keys are generated for the parameter reaction.

Next, it is checked whether the reaction database already contains similar keys. If not, a new container is created, either a dictionary for the family key and first reactant key, or a list for the second reactant key.

Finally, the reaction is inserted as the first element in the list.

removeEmptyPdepNetworks()

searches for and deletes any empty pdep networks

removeSpeciesFromEdge(reactionSystems, spec)

Remove species spec from the reaction model edge.

retrieve(family_label, key1, key2)

Returns a list of reactions from the reaction database with the same keys as the parameters.

Returns an empty list when one of the keys could not be found.

retrieveNewSpecies(deflatedRxn)

Searches for the first reactant or product in the deflated reaction that is represented by an integer.

Such an object refers to a core species that was used to generate the reaction in the first place. Reactants or products represented by an object that is not an integer will be a newly-generated structure.

searchRetrieveReactions(rxn)

Searches through the reaction database for reactions with an identical reaction key as the key of the parameter reaction.

Both the reaction key based on the reactants as well as on the products is used to search for possible candidate reactions.

setThermodynamicFilteringParameters(Tmax, toleranceThermoKeepSpeciesInEdge, minCoreSizeForPrune, maximumEdgeSpecies, reactionSystems)

sets parameters for thermodynamic filtering based on the current core Tmax is the maximum reactor temperature in K toleranceThermoKeepSpeciesInEdge is the Gibbs number above which species will be filtered minCoreSizeForPrune is the core size at which thermodynamic filtering will start maximumEdgeSpecies is the maximum allowed number of edge species reactionSystems is a list of reactionSystem objects

thermoFilterDown(maximumEdgeSpecies, minSpeciesExistIterationsForPrune=0)

removes species from the edge based on their Gibbs energy until maximumEdgeSpecies is reached under the constraint that all removed species are older than minSpeciesExistIterationsForPrune iterations maximumEdgeSpecies is the maximum allowed number of edge species minSpeciesExistIterationsForPrune is the number of iterations a species must be in the edge before it is eligible for thermo filtering

thermoFilterSpecies(spcs)

checks Gibbs energy of the species in species against the maximum allowed Gibbs energy

updateUnimolecularReactionNetworks()

Iterate through all of the currently-existing unimolecular reaction networks, updating those that have been marked as invalid. In each update, the phenomonological rate coefficients $$k(T,P)$$ are computed for each net reaction in the network, and the resulting reactions added or updated.

class rmgpy.rmg.model.ReactionModel(species=None, reactions=None)

Represent a generic reaction model. A reaction model consists of species, a list of species, and reactions, a list of reactions.

merge(other)

Return a new ReactionModel object that is the union of this model and other.