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:




The species and reactions of the current model core


The species and reactions of the current model edge


A dictionary of pressure-dependent reaction networks (Network objects) indexed by source.


A list of pressure-dependent reaction networks (Network objects)


A counter for the number of pressure-dependent networks created


A dictionary with a unique index pointing to the species objects


String describing solvent name for liquid reactions. Empty for non-liquid estimation


The surface site density (a SurfaceConcentration quantity) or None if no heterogeneous catalyst.

add_new_surface_objects(obj, new_surface_species, new_surface_reactions, reaction_system)

obj is the list of objects for enlargement coming from simulate new_surface_species and new_surface_reactions are the current lists of surface species and surface reactions following simulation reaction_system 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


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


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


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).


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).

add_reaction_to_unimolecular_networks(newReaction, new_species, 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.

add_seed_mechanism_to_core(seed_mechanism, react=False)

Add all species and reactions from seed_mechanism, 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.


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.


Add a species spec to the reaction model edge.


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)


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


Generate thermo for species. QM calculations are parallelized if requested.


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).


Check to see if an existing species contains the same molecule.Molecule as molecule. Comparison is done using isomorphism without consideration of electrons. Therefore, resonance structures of a species will all match each other.

Returns the matched species if found and None otherwise.


empties surface tracking varaibles

enlarge(new_object=None, react_edge=False, unimolecular_react=None, bimolecular_react=None, trimolecular_react=None)

Enlarge a reaction model by processing the objects in the list new_object. If new_object 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 new_object is a rmg.unirxn.network.Network object, then reactions are generated for the species in the network with the largest leak flux.

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


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

generate_thermo(spc, rename=False)

Generate thermo for species.


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.


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


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.


Populates the core species dictionary

integer -> core Species

with the species that are currently in the core.

log_enlarge_summary(new_core_species, new_core_reactions, new_edge_species, new_edge_reactions, reactions_moved_from_edge=None, react_edge=False)

Output a summary of a model enlargement step to the log. The details of the enlargement are passed in the new_core_species, new_core_reactions, new_edge_species, and new_edge_reactions objects.


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 reaction_counter is incremented, however, since the returned reaction can and will exist in the model edge and/or core.

make_new_reaction(forward, check_existing=True, generate_thermo=True, generate_kinetics=True, perform_cut=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.new_reaction_list if it is new.

make_new_species(object, label='', reactive=True, check_existing=True, generate_thermo=True, check_decay=False, check_cut=False)

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.


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.


Process the coverage dependence kinetics.

This ensures that species that are used in coverage-dependent kinetic expressions exist in the model. (Before this is called, they may have only existed in a reaction libary instance).

If <CoreEdgeReactionModel>self.coverage_dependence is False then it instead removes any coverage_dependence from the kinetics.

process_new_reactions(new_reactions, new_species, pdep_network=None, generate_thermo=True, generate_kinetics=True)

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

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

prune(reaction_systems, tol_keep_in_edge, tol_move_to_core, maximum_edge_species, min_species_exist_iterations_for_prune)

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


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.


searches for and deletes any empty pdep networks

remove_species_from_edge(reaction_systems, 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.


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.

set_thermodynamic_filtering_parameters(Tmax, thermo_tol_keep_spc_in_edge, min_core_size_for_prune, maximum_edge_species, reaction_systems)

sets parameters for thermodynamic filtering based on the current core Tmax is the maximum reactor temperature in K thermo_tol_keep_spc_in_edge is the Gibbs number above which species will be filtered min_core_size_for_prune is the core size at which thermodynamic filtering will start maximum_edge_species is the maximum allowed number of edge species reaction_systems is a list of reaction_system objects

thermo_filter_down(maximum_edge_species, min_species_exist_iterations_for_prune=0)

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


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


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, phases=None, interfaces={})

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


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