Hi everyone,
I am new in this forum and rather new to coding with julia (I have been using it for a while but more on a surface level). My question concerns the modeling of chemical reaction networks, specifically with the Catalyst.jl package:
so what I want to do is when I have a system of chemical reactions with known initial concentrations and parameters (i.e. rate constants) solve the corresponding ODE-system and then not only look at the time traces of the concentration of each compound (the solution of the ODEs) but also at the time trace of the reaction-flux (the reaction rate law) for each reaction!
For example, lets say I have the following simple reaction:
with the ODE-system
the solution then gives me A(t),B(t),C(t) and the reaction-flux I am looking for is:
I know I can use the @reaction_network
macro from Catalyst.jl to solve the ODE-system together with the DifferentialEquations.jl package like:
using DifferentialEquations
using Catalyst
rn = @reaction_network begin
k, A + B --> C
end k
u0 = [15.0,10.0,0.0]
p = [1.0]
tspan = (1.0,10.0)
oprob = ODEProblem(rn, u0, tspan, p)
solve(oprob)
and I also saw in the documentation of Catalyst.jl that there is a function called oderatelaw()
that if I understood it correctly should give me exactly what I want (the rate law of the reaction). But here I am starting to get lost, because if I do the following:
rx = reactions(rn)
reactions(rx[1])
I get as output:
(k * A(t)) * B(t)
which says is something like an Operation
, but I have never worked with these kind of types before. So how can I like “convert” this so I can use it with the time traces I get for the concentrations? Or am I missing something here? Or is there maybe a completely different, more quicker and easier solution than what the Catalyst.jl package offers?
Thank you in advance and sorry for the long post (as I said I am new here and I kinda wanted to make sure I get my point across)!
Cheers, Nino!