rmgpy.solver.ReactionSystem

class rmgpy.solver.ReactionSystem(termination=None, sensitive_species=None, sensitivity_threshold=0.001)

A base class for all RMG reaction systems.

Keq

numpy.ndarray

Type:

Keq

add_reactions_to_surface(self, list new_surface_reactions, list new_surface_reaction_inds, list surface_species, list surface_reactions, list edge_species)

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

numpy.ndarray

Type:

atol_array

bimolecular_threshold

numpy.ndarray

Type:

bimolecular_threshold

compute_network_variables(self, pdep_networks=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.

compute_rate_derivative(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.

core_reaction_rates

numpy.ndarray

Type:

core_reaction_rates

core_species_concentrations

numpy.ndarray

Type:

core_species_concentrations

core_species_consumption_rates

numpy.ndarray

Type:

core_species_consumption_rates

core_species_production_rates

numpy.ndarray

Type:

core_species_production_rates

core_species_rates

numpy.ndarray

Type:

core_species_rates

dydt0

numpy.ndarray

Type:

dydt0

edge_reaction_rates

numpy.ndarray

Type:

edge_reaction_rates

edge_species_rates

numpy.ndarray

Type:

edge_species_rates

generate_reactant_product_indices(self, core_reactions, edge_reactions)

Creates a matrix for the reactants and products.

generate_reaction_indices(self, core_reactions, edge_reactions)

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

generate_species_indices(self, core_species, edge_species)

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

get_layering_indices(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.

initialize_model(self, list core_species, list core_reactions, list edge_species, list edge_reactions, list surface_species=None, list surface_reactions=None, list pdep_networks=None, atol=1e-16, rtol=1e-8, sensitivity=False, sens_atol=1e-6, sens_rtol=1e-4, filter_reactions=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 core_species, list core_reactions, list surface_species, list surface_reactions)
removes surface_species and surface_reactions 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-08, sensitivity=False, sens_atol=1e-06, sens_rtol=0.0001)

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

jacobian_matrix

numpy.ndarray

Type:

jacobian_matrix

kb

numpy.ndarray

Type:

kb

kf

numpy.ndarray

Type:

kf

log_conversions(self, species_index, y0)

Log information about the current conversion values.

log_rates(self, double char_rate, species, double species_rate, double max_dif_ln_accum_num, network, double network_rate)

Log information about the current maximum species and network rates.

max_edge_species_rate_ratios

numpy.ndarray

Type:

max_edge_species_rate_ratios

max_network_leak_rate_ratios

numpy.ndarray

Type:

max_network_leak_rate_ratios

neq

‘Py_ssize_t’

Type:

neq

network_indices

numpy.ndarray

Type:

network_indices

network_leak_coefficients

numpy.ndarray

Type:

network_leak_coefficients

network_leak_rates

numpy.ndarray

Type:

network_leak_rates

num_core_reactions

‘Py_ssize_t’

Type:

num_core_reactions

num_core_species

‘Py_ssize_t’

Type:

num_core_species

num_edge_reactions

‘Py_ssize_t’

Type:

num_edge_reactions

num_edge_species

‘Py_ssize_t’

Type:

num_edge_species

num_pdep_networks

‘Py_ssize_t’

Type:

num_pdep_networks

product_indices

numpy.ndarray

Type:

product_indices

prunable_network_indices

numpy.ndarray

Type:

prunable_network_indices

prunable_networks

list

Type:

prunable_networks

prunable_species

list

Type:

prunable_species

prunable_species_indices

numpy.ndarray

Type:

prunable_species_indices

reactant_indices

numpy.ndarray

Type:

reactant_indices

reaction_index

dict

Type:

reaction_index

reset_max_edge_species_rate_ratios(self)

This function sets max_edge_species_rate_ratios 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

numpy.ndarray

Type:

rtol_array

sensitive_species

list

Type:

sensitive_species

sensitivity_coefficients

numpy.ndarray

Type:

sensitivity_coefficients

sensitivity_threshold

‘double’

Type:

sensitivity_threshold

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, edge_species, pdep_networks)
simulate(self, list core_species, list core_reactions, list edge_species, list edge_reactions, list surface_species, list surface_reactions, list pdep_networks=None, bool prune=False, bool sensitivity=False, list sens_worksheet=None, model_settings=None, simulator_settings=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

list

Type:

snapshots

species_index

dict

Type:

species_index

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.

surface_reaction_indices

numpy.ndarray

Type:

surface_reaction_indices

surface_species_indices

numpy.ndarray

Type:

surface_species_indices

t0

‘float’

Type:

t0

termination

list

Type:

termination

trimolecular

‘bool’

Type:

trimolecular

trimolecular_threshold

numpy.ndarray

Type:

trimolecular_threshold

unimolecular_threshold

numpy.ndarray

Type:

unimolecular_threshold

valid_layering_indices

numpy.ndarray

Type:

valid_layering_indices

y0

numpy.ndarray

Type:

y0