rmgpy.solver.
ReactionSystem
¶A base class for all RMG reaction systems.
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.
computeRateDerivative
()¶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
()¶Initialize the arrays containing network information:
generate_reactant_product_indices
()¶Creates a matrix for the reactants and products.
generate_reaction_indices
()¶Assign an index to each reaction (core first, then edge) and store the (reaction, index) pair in a dictionary.
generate_species_indices
()¶Assign an index to each species (core first, then edge) and store the (species, index) pair in a dictionary.
get_species_index
()¶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
()¶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.
initiate_tolerances
()¶Computes the number of differential equations and initializes the tolerance arrays.
logConversions
()¶Log information about the current conversion values.
logRates
()¶Log information about the current maximum species and network rates.
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).
set_initial_conditions
()¶Sets the common initial conditions of the rate equations that represent the reaction system.
set_initial_derivative
()¶Sets the derivative of the species moles with respect to the independent variable (time) equal to the residual.
simulate
()¶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.
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.