rmgpy.solver.ReactionSystem¶

class rmgpy.solver.ReactionSystem(termination=None, sensitiveSpecies=None, sensitivityThreshold=1e-3)

A base class for all RMG reaction systems.

Keq

Keq – numpy.ndarray

addReactionsToSurface(self, list newSurfaceReactions, list newSurfaceReactionInds, list surfaceSpecies, list surfaceReactions, list edgeSpecies)

moves new surface reactions to the surface done after the while loop before the simulate call ends

advance()

Simulate from the current value of the independent variable to a specified value tout, taking as many steps as necessary. The resulting values of $$t$$, $$\mathbf{y}$$, and $$\frac{d \mathbf{y}}{dt}$$ can then be accessed via the t, y, and dydt attributes.

atol_array

atol_array – numpy.ndarray

bimolecularThreshold

bimolecularThreshold – numpy.ndarray

computeRateDerivative(self)

Returns derivative vector df/dk_j where dy/dt = f(y, t, k) and k_j is the rate parameter for the jth core reaction.

compute_network_variables(self, pdepNetworks=None)

Initialize the arrays containing network information:

• NetworkLeakCoefficients is a n x 1 array with
n the number of pressure-dependent networks.
• NetworkIndices is a n x 3 matrix with
n the number of pressure-dependent networks and 3 the maximum number of molecules allowed in either the reactant or product side of a reaction.
coreReactionRates

coreReactionRates – numpy.ndarray

coreSpeciesConcentrations

coreSpeciesConcentrations – numpy.ndarray

coreSpeciesConsumptionRates

coreSpeciesConsumptionRates – numpy.ndarray

coreSpeciesProductionRates

coreSpeciesProductionRates – numpy.ndarray

coreSpeciesRates

coreSpeciesRates – numpy.ndarray

dydt0

dydt0 – numpy.ndarray

edgeReactionRates

edgeReactionRates – numpy.ndarray

edgeSpeciesRates

edgeSpeciesRates – numpy.ndarray

generate_reactant_product_indices(self, coreReactions, edgeReactions)

Creates a matrix for the reactants and products.

generate_reaction_indices(self, coreReactions, edgeReactions)

Assign an index to each reaction (core first, then edge) and store the (reaction, index) pair in a dictionary.

generate_species_indices(self, coreSpecies, edgeSpecies)

Assign an index to each species (core first, then edge) and store the (species, index) pair in a dictionary.

getLayeringIndices(self)

determines the edge reaction indices that indicate reactions that are valid for movement from edge to surface based on the layering constraint

get_species_index(self, spc)

Retrieves the index that is associated with the parameter species from the species index dictionary.

initialize()

Initialize the DASPK solver by setting the initial values of the independent variable t0, dependent variables y0, and first derivatives dydt0. If provided, the derivatives must be consistent with the other initial conditions; if not provided, DASPK will attempt to estimate a consistent set of initial values for the derivatives. You can also set the absolute and relative tolerances atol and rtol, respectively, either as single values for all dependent variables or individual values for each dependent variable.

initializeModel(self, list coreSpecies, list coreReactions, list edgeSpecies, list edgeReactions, list surfaceSpecies=None, list surfaceReactions=None, list pdepNetworks=None, atol=1e-16, rtol=1e-8, sensitivity=False, sens_atol=1e-6, sens_rtol=1e-4, filterReactions=False, dict conditions=None)

Initialize a simulation of the reaction system using the provided kinetic model. You will probably want to create your own version of this method in the derived class; don’t forget to also call the base class version, too.

initialize_solver(self)
initialize_surface(self, list coreSpecies, list coreReactions, list surfaceSpecies, list surfaceReactions)
removes surfaceSpecies and surfaceReactions from until they are self consistent:
1. every reaction has one species in the surface
2. every species participates in a surface reaction
initiate_tolerances(self, atol=1e-16, rtol=1e-8, sensitivity=False, sens_atol=1e-6, sens_rtol=1e-4)

Computes the number of differential equations and initializes the tolerance arrays.

jacobianMatrix

jacobianMatrix – numpy.ndarray

kb

kb – numpy.ndarray

kf

kf – numpy.ndarray

logConversions(self, speciesIndex, y0)

logRates(self, double charRate, species, double speciesRate, double maxDifLnAccumNum, network, double networkRate)

Log information about the current maximum species and network rates.

maxEdgeSpeciesRateRatios

maxEdgeSpeciesRateRatios – numpy.ndarray

maxNetworkLeakRateRatios

maxNetworkLeakRateRatios – numpy.ndarray

neq

neq – ‘int’

networkIndices

networkIndices – numpy.ndarray

networkLeakCoefficients

networkLeakCoefficients – numpy.ndarray

networkLeakRates

networkLeakRates – numpy.ndarray

numCoreReactions

numCoreReactions – ‘int’

numCoreSpecies

numCoreSpecies – ‘int’

numEdgeReactions

numEdgeReactions – ‘int’

numEdgeSpecies

numEdgeSpecies – ‘int’

numPdepNetworks

numPdepNetworks – ‘int’

productIndices

productIndices – numpy.ndarray

prunableNetworkIndices

prunableNetworkIndices – numpy.ndarray

prunableNetworks

prunableNetworks – list

prunableSpecies

prunableSpecies – list

prunableSpeciesIndices

prunableSpeciesIndices – numpy.ndarray

reactantIndices

reactantIndices – numpy.ndarray

reactionIndex

reactionIndex – dict

reset_max_edge_species_rate_ratios(self)

This function sets maxEdgeSpeciesRateRatios back to zero for pruning of ranged reactors it is important to avoid doing this every initialization

residual()

Evaluate the residual function for this model, given the current value of the independent variable t, dependent variables y, and first derivatives dydt. Return a numpy array with the values of the residual function and an integer with status information (0 if okay, -2 to terminate).

rtol_array

rtol_array – numpy.ndarray

sensitiveSpecies

sensitiveSpecies – list

sensitivityCoefficients

sensitivityCoefficients – numpy.ndarray

sensitivityThreshold

sensitivityThreshold – ‘double’

set_initial_conditions(self)

Sets the common initial conditions of the rate equations that represent the reaction system.

• Sets the initial time of the reaction system to 0
• Initializes the species moles to a n x 1 array with zeros
set_initial_derivative(self)

Sets the derivative of the species moles with respect to the independent variable (time) equal to the residual.

set_initial_reaction_thresholds(self)
set_prunable_indices(self, edgeSpecies, pdepNetworks)
simulate(self, list coreSpecies, list coreReactions, list edgeSpecies, list edgeReactions, list surfaceSpecies, list surfaceReactions, list pdepNetworks=None, bool prune=False, bool sensitivity=False, list sensWorksheet=None, modelSettings=None, simulatorSettings=None, dict conditions=None)

Simulate the reaction system with the provided reaction model, consisting of lists of core species, core reactions, edge species, and edge reactions. As the simulation proceeds the system is monitored for validity. If the model becomes invalid (e.g. due to an excessively large edge flux), the simulation is interrupted and the object causing the model to be invalid is returned. If the simulation completes to the desired termination criteria and the model remains valid throughout, None is returned.

snapshots

snapshots – list

speciesIndex

speciesIndex – dict

step()

Perform one simulation step from the current value of the independent variable toward (but not past) a specified value tout. The resulting values of $$t$$, $$\mathbf{y}$$, and $$\frac{d \mathbf{y}}{dt}$$ can then be accessed via the t, y, and dydt attributes.

surfaceReactionIndices

surfaceReactionIndices – numpy.ndarray

surfaceSpeciesIndices

surfaceSpeciesIndices – numpy.ndarray

t0

t0 – ‘float’

termination

termination – list

trimolecular

trimolecular – ‘bool’

trimolecularThreshold

trimolecularThreshold – numpy.ndarray

unimolecularThreshold

unimolecularThreshold – numpy.ndarray

validLayeringIndices

validLayeringIndices – numpy.ndarray

y0

y0 – numpy.ndarray