The generated ReactionSystem and Reactions

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), states(rn) and rn.states is a vector of all the chemical species within the system, each represented as a ModelingToolkit.Term.
  • params(rn), parameters(rn) and rn.ps is a vector of all the parameters within the system, each represented as a ModelingToolkit.Sym.
  • reactions(rn), equations(rn) and rn.eqs is a vector of all the Reactions within the system.
  • independent_variable(rn) and rn.iv are the independent variable of the system, usually t for time, represented as a ModelingToolkit.Sym.

Each Reaction within reactions(rn) has a number of subfields. For rx a Reaction we have:

  • rx.substrates, a vector of ModelingToolkit.Terms storing each substrate variable.
  • rx.products, a vector of ModelingToolkit.Terms storing each product variable.
  • rx.substoich, a vector storing the corresponding integer stoichiometry of each substrate species in rx.substrates.
  • rx.prodstoich, a vector storing the corresponding integer stoichiometry of each product species in rx.products.
  • rx.rate, a Number,ModelingToolkit.SymorModelingToolkit.Termrepresenting the reaction rate. E.g., for a reaction likekX, Y –> X+Y, we'd haverate = kX`.
  • rx.netstoich, a vector of pairs mapping the ModelingToolkit.Term for each species that changes numbers by the reaction to how much it changes. E.g., for k, X + 2Y --> X + W, we'd have rx.netstoich = [Y(t) => -2, W(t) => 1].
  • rx.only_use_rate, a boolean that is true if the reaction was made with non-filled arrows and should ignore mass action kinetics. false by default.

Empty ReactionSystems can be generated via make_empty_network or @reaction_network with no arguments. ReactionSystems can be programmatically extended using addspecies!, addparam!, addreaction!, @add_reactions, or composed using merge and merge!.