Skip to content

Commit b8d0201

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 31ba775 + 66c31b9 commit b8d0201

19 files changed

+221
-114
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
group:
1515
- Core
1616
version:
17-
- '1.10.2'
17+
- '1'
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: julia-actions/setup-julia@v2

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: julia-actions/setup-julia@latest
1616
with:
17-
version: '1.10.2'
17+
version: '1'
1818
- name: Install dependencies
1919
run: julia --project=docs/ -e 'ENV["JULIA_PKG_SERVER"] = ""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
2020
- name: Build and deploy

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ DataStructures = "0.18"
4242
Combinatorics = "1.0.2"
4343
DiffEqBase = "6.83.0"
4444
DocStringExtensions = "0.8, 0.9"
45+
DynamicPolynomials = "0.5"
4546
DynamicQuantities = "0.13.2"
4647
Graphs = "1.4"
4748
HomotopyContinuation = "2.9"
@@ -59,7 +60,7 @@ StructuralIdentifiability = "0.5.1"
5960
SymbolicUtils = "1.0.3"
6061
Symbolics = "5.27"
6162
Unitful = "1.12.4"
62-
julia = "1.9"
63+
julia = "1.10"
6364

6465
[extras]
6566
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
3737

3838
[compat]
3939
BenchmarkTools = "1.5"
40-
BifurcationKit = "0.3"
40+
BifurcationKit = "0.3.4"
4141
CairoMakie = "0.12"
4242
Catalyst = "13"
4343
DataFrames = "1.6"

docs/pages.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ pages = Any[
99
"model_creation/dsl_basics.md",
1010
"model_creation/dsl_advanced.md",
1111
#"model_creation/programmatic_CRN_construction.md",
12-
#"model_creation/compositional_modeling.md",
12+
"model_creation/compositional_modeling.md",
1313
#"model_creation/constraint_equations.md",
1414
# Events.
15-
#"model_creation/parametric_stoichiometry.md",# Distributed parameters, rates, and initial conditions.
15+
"model_creation/parametric_stoichiometry.md",# Distributed parameters, rates, and initial conditions.
1616
"model_creation/model_file_loading_and_export.md",# Distributed parameters, rates, and initial conditions.
1717
# Loading and writing models to files.
1818
"model_creation/model_visualisation.md",
@@ -21,7 +21,7 @@ pages = Any[
2121
"Model creation examples" => Any[
2222
"model_creation/examples/basic_CRN_library.md",
2323
"model_creation/examples/programmatic_generative_linear_pathway.md",
24-
#"model_creation/examples/hodgkin_huxley_equation.md",
24+
"model_creation/examples/hodgkin_huxley_equation.md",
2525
#"model_creation/examples/smoluchowski_coagulation_equation.md"
2626
]
2727
],
@@ -66,6 +66,6 @@ pages = Any[
6666
# # Contributor's guide.
6767
# # Repository structure.
6868
# ],
69-
#"FAQs" => "faqs.md",
70-
#"API" => "api.md"
69+
"FAQs" => "faqs.md",
70+
"API" => "api.md"
7171
]

docs/src/api.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,41 @@ corresponding chemical reaction ODE models, chemical Langevin equation SDE
3535
models, and stochastic chemical kinetics jump process models.
3636

3737
```@example ex1
38-
using Catalyst, DifferentialEquations, Plots
38+
using Catalyst, OrdinaryDiffEq, StochasticDiffEq, JumpProcesses, Plots
3939
t = default_t()
4040
@parameters β γ
4141
@species S(t) I(t) R(t)
4242
4343
rxs = [Reaction(β, [S,I], [I], [1,1], [2])
4444
Reaction(γ, [I], [R])]
4545
@named rs = ReactionSystem(rxs, t)
46+
rs = complete(rs)
4647
4748
u₀map = [S => 999.0, I => 1.0, R => 0.0]
4849
parammap = [β => 1/10000, γ => 0.01]
4950
tspan = (0.0, 250.0)
5051
5152
# solve as ODEs
5253
odesys = convert(ODESystem, rs)
54+
odesys = complete(odesys)
5355
oprob = ODEProblem(odesys, u₀map, tspan, parammap)
5456
sol = solve(oprob, Tsit5())
5557
p1 = plot(sol, title = "ODE")
5658
5759
# solve as SDEs
5860
sdesys = convert(SDESystem, rs)
61+
sdesys = complete(sdesys)
5962
sprob = SDEProblem(sdesys, u₀map, tspan, parammap)
60-
sol = solve(sprob, EM(), dt=.01)
63+
sol = solve(sprob, EM(), dt=.01, saveat = 2.0)
6164
p2 = plot(sol, title = "SDE")
6265
6366
# solve as jump process
6467
jumpsys = convert(JumpSystem, rs)
68+
jumpsys = complete(jumpsys)
6569
u₀map = [S => 999, I => 1, R => 0]
6670
dprob = DiscreteProblem(jumpsys, u₀map, tspan, parammap)
67-
jprob = JumpProblem(jumpsys, dprob, Direct())
68-
sol = solve(jprob, SSAStepper())
71+
jprob = JumpProblem(jumpsys, dprob, Direct(); save_positions = (false,false))
72+
sol = solve(jprob, SSAStepper(), saveat = 2.0)
6973
p3 = plot(sol, title = "jump")
7074
7175
plot(p1, p2, p3; layout = (3,1))

docs/src/faqs.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ One can directly use symbolic variables to index into SciML solution objects.
55
Moreover, observables can also be evaluated in this way. For example,
66
consider the system
77
```@example faq1
8-
using Catalyst, DifferentialEquations, Plots
8+
using Catalyst, OrdinaryDiffEq, Plots
99
rn = @reaction_network ABtoC begin
1010
(k₊,k₋), A + B <--> C
1111
end
12-
13-
# initial condition and parameter values
14-
setdefaults!(rn, [:A => 1.0, :B => 2.0, :C => 0.0, :k₊ => 1.0, :k₋ => 1.0])
1512
nothing # hide
1613
```
1714
Let's convert it to a system of ODEs, using the conservation laws of the system
1815
to eliminate two of the species:
1916
```@example faq1
2017
osys = convert(ODESystem, rn; remove_conserved = true)
18+
osys = complete(osys)
2119
```
2220
Notice the resulting ODE system has just one ODE, while algebraic observables
2321
have been added for the two removed species (in terms of the conservation law
@@ -28,7 +26,9 @@ observed(osys)
2826
Let's solve the system and see how to index the solution using our symbolic
2927
variables
3028
```@example faq1
31-
oprob = ODEProblem(osys, [], (0.0, 10.0), [])
29+
u0 = [osys.A => 1.0, osys.B => 2.0, osys.C => 0.0]
30+
ps = [osys.k₊ => 1.0, osys.k₋ => 1.0]
31+
oprob = ODEProblem(osys, u0, (0.0, 10.0), ps)
3232
sol = solve(oprob, Tsit5())
3333
```
3434
Suppose we want to plot just species `C`, without having to know its integer
@@ -44,8 +44,8 @@ sol[C]
4444
```
4545
To evaluate `C` at specific times and plot it we can just do
4646
```@example faq1
47-
t = range(0.0, 10.0, length=101)
48-
plot(t, sol(t, idxs = C), label = "C(t)", xlabel = "t")
47+
t = range(0.0, 10.0, length = 101)
48+
plot(sol(t, idxs = C), label = "C(t)", xlabel = "t")
4949
```
5050
If we want to get multiple variables we can just do
5151
```@example faq1
@@ -65,7 +65,7 @@ constant, giving `k*X^2/2` instead of `k*X^2` for ODEs and `k*X*(X-1)/2` instead
6565
of `k*X*(X-1)` for jumps. This can be disabled when directly `convert`ing a
6666
[`ReactionSystem`](@ref). If `rn` is a generated [`ReactionSystem`](@ref), we can
6767
do
68-
```julia
68+
```@example faq1
6969
osys = convert(ODESystem, rn; combinatoric_ratelaws=false)
7070
```
7171
Disabling these rescalings should work for all conversions of `ReactionSystem`s
@@ -87,7 +87,9 @@ rx1 = Reaction(k,[B,C],[B,D], [2.5,1],[3.5, 2.5])
8787
rx2 = Reaction(2*k, [B], [D], [1], [2.5])
8888
rx3 = Reaction(2*k, [B], [D], [2.5], [2])
8989
@named mixedsys = ReactionSystem([rx1, rx2, rx3], t, [A, B, C, D], [k, b])
90+
mixedsys = complete(mixedsys)
9091
osys = convert(ODESystem, mixedsys; combinatoric_ratelaws = false)
92+
osys = complete(osys)
9193
```
9294
Note, when using `convert(ODESystem, mixedsys; combinatoric_ratelaws=false)` the
9395
`combinatoric_ratelaws=false` parameter must be passed. This is also true when
@@ -127,6 +129,7 @@ t = default_t()
127129
rx1 = Reaction(β, [S, I], [I], [1,1], [2])
128130
rx2 = Reaction(ν, [I], [R])
129131
@named sir = ReactionSystem([rx1, rx2], t)
132+
sir = complete(sir)
130133
oprob = ODEProblem(sir, [], (0.0, 250.0))
131134
sol = solve(oprob, Tsit5())
132135
plot(sol)
@@ -162,7 +165,7 @@ Julia `Symbol`s corresponding to each variable/parameter to their values, or
162165
from ModelingToolkit symbolic variables/parameters to their values. Using
163166
`Symbol`s we have
164167
```@example faq4
165-
using Catalyst, DifferentialEquations
168+
using Catalyst, OrdinaryDiffEq
166169
rn = @reaction_network begin
167170
α, S + I --> 2I
168171
β, I --> R
@@ -199,6 +202,7 @@ the second example, or one can use the `symmap_to_varmap` function to convert th
199202
`Symbol` mapping to a symbolic mapping. I.e. this works
200203
```@example faq4
201204
osys = convert(ODESystem, rn)
205+
osys = complete(osys)
202206
203207
# this works
204208
u0 = symmap_to_varmap(rn, [:S => 999.0, :I => 1.0, :R => 0.0])
@@ -221,6 +225,7 @@ rx1 = @reaction k, A --> 0
221225
rx2 = @reaction $f, 0 --> A
222226
eq = f ~ (1 + sin(t))
223227
@named rs = ReactionSystem([rx1, rx2, eq], t)
228+
rs = complete(rs)
224229
osys = convert(ODESystem, rs)
225230
```
226231
In the final ODE model, `f` can be eliminated by using

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Pkg.add("Catalyst")
8989
To solve Catalyst models and visualize solutions, it is also recommended to
9090
install DifferentialEquations.jl and Plots.jl
9191
```julia
92-
Pkg.add("DifferentialEquations")
92+
Pkg.add("OrdinaryDiffEq")
9393
Pkg.add("Plots")
9494
```
9595

@@ -114,7 +114,7 @@ which in Jupyter notebooks will give the figure
114114

115115
To generate and solve a mass action ODE version of the model we use
116116
```@example ind1
117-
using DifferentialEquations
117+
using OrdinaryDiffEq
118118
p = [:α => .1/1000, :β => .01]
119119
tspan = (0.0,250.0)
120120
u0 = [:S => 999.0, :I => 1.0, :R => 0.0]

docs/src/model_creation/compositional_modeling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ end
1818
Alternatively one can just build the `ReactionSystem` via the symbolic interface.
1919
```@example ex0
2020
@parameters d
21-
@variable t
21+
t = default_t()
2222
@species X(t)
2323
rx = Reaction(d, [X], nothing)
24-
@named degradation_component = ReactionSystem([rs], t)
24+
@named degradation_component = ReactionSystem([rx], t)
2525
```
2626
We can test whether a system is complete using the `ModelingToolkit.iscomplete` function:
2727
```@example ex0

docs/src/model_creation/examples/hodgkin_huxley_equation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cells such as neurons and muscle cells.
1313
We begin by importing some necessary packages.
1414
```@example hh1
1515
using ModelingToolkit, Catalyst, NonlinearSolve
16-
using DifferentialEquations, Symbolics
16+
using OrdinaryDiffEq, Symbolics
1717
using Plots
1818
t = default_t()
1919
D = default_time_deriv()
@@ -77,6 +77,7 @@ I = I₀ * sin(2*pi*t/30)^2
7777
# get the gating variables to use in the equation for dV/dt
7878
@unpack m,n,h = hhrn
7979
80+
Dₜ = default_time_deriv()
8081
eqs = [Dₜ(V) ~ -1/C * (ḡK*n^4*(V-EK) + ḡNa*m^3*h*(V-ENa) + ḡL*(V-EL)) + I/C]
8182
@named voltageode = ODESystem(eqs, t)
8283
nothing # hide
@@ -88,6 +89,7 @@ Finally, we add this ODE into the reaction model as
8889

8990
```@example hh1
9091
@named hhmodel = extend(voltageode, hhrn)
92+
hhmodel = complete(hhmodel)
9193
nothing # hide
9294
```
9395

0 commit comments

Comments
 (0)