Skip to content

Commit 406c3f1

Browse files
authored
Merge pull request #580 from SciML/additional_LoMA_ignore_arrows
Enable `=>` and `<=` to ignore law of mass action in DSL
2 parents 574f860 + 2fec18e commit 406c3f1

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

docs/src/faqs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ rn = @reaction_network begin
193193
end k
194194
```
195195
occurs at the (ODE) rate ``d[X]/dt = -k[X]``, it is possible to override this by
196-
using any of the following non-filled arrows when declaring the reaction: ``,
197-
``, ``, ``, ``, ``. This means that the reaction
196+
using any of the following non-filled arrows when declaring the reaction: `<=`, ``,
197+
``, `=>`, ``, ``, ``, `` (`<=>` currently not possible due to Julia langauge technical reasons). This means that the reaction
198198
```julia
199199
rn = @reaction_network begin
200-
k, X
200+
k, X =>
201201
end k
202202
```
203203
will occur at rate ``d[X]/dt = -k`` (which might become a problem since ``[X]``

docs/src/tutorials/advanced.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ rn = @reaction_network begin
2424
end k
2525
```
2626
occurs at the rate ``d[X]/dt = -k[X]``, it is possible to ignore this by using
27-
any of the following non-filled arrows when declaring the reaction: ``, ``,
28-
``, ``, ``, ``. This means that the reaction
27+
any of the following non-filled arrows when declaring the reaction: `<=`, ``, ``,
28+
``, ``, `=>`, ``, `` (`<=>` currently not possible due to Julia langauge technical reasons). This means that the reaction
2929

3030
```julia
3131
rn = @reaction_network begin
32-
k, X
32+
k, X =>
3333
end k
3434
```
3535

src/reaction_network.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Example systems:
6060

6161
# Declare various arrow types symbols used for the empty set (also 0).
6262
const empty_set = Set{Symbol}([:∅])
63-
const fwd_arrows = Set{Symbol}([:>, :, :, :, :, :, :, :, :, :, :, :, :])
64-
const bwd_arrows = Set{Symbol}([:<, :, :, :, :, :, :, :, :, :, :, :, :,
63+
const fwd_arrows = Set{Symbol}([:>, :(=>), :, :, :, :, :, :, :, :, :, :, :, :])
64+
const bwd_arrows = Set{Symbol}([:<, :(<=), :, :, :, :, :, :, :, :, :, :, :, :,
6565
Symbol("<--")])
6666
const double_arrows = Set{Symbol}([:, :, :, :, :, :, :, :, Symbol("<-->")])
67-
const pure_rate_arrows = Set{Symbol}([:, :, :, :, :, :])
67+
const pure_rate_arrows = Set{Symbol}([:(=>), :(<=), :, :, :, :, :, :])
6868

6969
# Declares symbols which may neither be used as parameters not varriables.
7070
forbidden_symbols = [:t, , :pi, :ℯ, :im, :nothing, :∅]

test/make_model.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ differently_written_7 = @reaction_network begin
162162
end p1 p2 p3 k1 k2 k3 v1 K1 d1 d2 d3 d4 d5
163163
push!(identical_networks_2, reaction_networks_standard[7] => differently_written_7)
164164

165+
# Ignore mass action new arrows.
166+
differently_written_8 = @reaction_network begin
167+
(p1, p2, p3), ∅ => (X1, X2, X3)
168+
(k1 * X1 * X2^2 / 2, k2 * X4), X1 + 2X2 X4
169+
(mm(X3, v1, K1) * X4, k3 * X5), X4 X5
170+
(d1 * X1, d2 * X2, d3 * X3, d4 * X4, d5 * X5), ∅ <= (X1, X2, X3, X4, X5)
171+
end p1 p2 p3 k1 k2 k3 v1 K1 d1 d2 d3 d4 d5
172+
push!(identical_networks_2, reaction_networks_standard[7] => differently_written_8)
173+
165174
for networks in identical_networks_2
166175
f1 = ODEFunction(convert(ODESystem, networks[1]), jac = true)
167176
f2 = ODEFunction(convert(ODESystem, networks[2]), jac = true)

0 commit comments

Comments
 (0)