The generated ReactionSystem
and Reaction
s
The @reaction_network
macro generates a ReactionSystem
object, which has a number of fields that can be accessed directly or via the Catalyst.jl API (the recommended route). Below we list these components, with the recommended API method listed first:
species(rn)
andstates(rn)
is a vector of all the chemical species within the system, each represented as aModelingToolkit.Term
.params(rn)
andparameters(rn)
is a vector of all the parameters within the system, each represented as aModelingToolkit.Sym
.reactions(rn)
andequations(rn)
is a vector of all theReaction
s within the system.independent_variable(rn)
andModelingToolkit.get_iv(rn)
are the independent variable of the system, usuallyt
for time, represented as aModelingToolkit.Sym
.
Each Reaction
within reactions(rn)
has a number of subfields. For rx
a Reaction
we have:
rx.substrates
, a vector of ModelingToolkit expressions storing each substrate variable.rx.products
, a vector of ModelingToolkit expressions storing each product variable.rx.substoich
, a vector storing the corresponding integer stoichiometry of each substrate species inrx.substrates
.rx.prodstoich
, a vector storing the corresponding integer stoichiometry of each product species inrx.products
.rx.rate
, aNumber,
ModelingToolkit.Symor ModelingToolkit expression representing the reaction rate. E.g., for a reaction like
kX, Y –> X+Y, we'd have
rate = kX`.rx.netstoich
, a vector of pairs mapping the ModelingToolkit expression for each species that changes numbers by the reaction to how much it changes. E.g., fork, X + 2Y --> X + W
, we'd haverx.netstoich = [Y(t) => -2, W(t) => 1]
.rx.only_use_rate
, a boolean that istrue
if the reaction was made with non-filled arrows and should ignore mass action kinetics.false
by default.
Empty ReactionSystem
s can be generated via make_empty_network
or @reaction_network
with no arguments (giving one argument to the latter will specify a system name). ReactionSystem
s can be programmatically extended using addspecies!
, addparam!
, addreaction!
, @add_reactions
, or composed using merge
and merge!
.