Skip to content

Commit a1338eb

Browse files
committed
add some documentation
1 parent 55e0a51 commit a1338eb

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

HISTORY.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,27 @@
123123
plot_network(brusselator)
124124
```
125125
- The letter Ø (used in Danish/Norwegian alphabet) is now conisdred the same as ∅ (empty set). It can no longer be used as a species/parameter.
126-
126+
- When converting a Catalyst `ReactionSystem` to a ModelingToolkit system, for
127+
example an `ODESystem`, Catalyst defined functions like `hill(A,B,C,D)` are
128+
now replaced with the explicit rational function they represent in the
129+
equations of the generated system. For example `mm(X,v,K)` will be replaced
130+
with `v*X / (X + K)`. This can be disabled by passing the keyword argument
131+
`expand_catalyst_funs = false`. e.g.
132+
```julia
133+
using Catalyst
134+
rn = @reaction_network begin
135+
hill(X,v,K,n), A --> 0
136+
end
137+
osys = convert(ODESystem, rn)
138+
```
139+
generates an ODE system with `D(A) ~ ~ -((v*A(t)*(X^n)) / (K^n + X^n))`, while
140+
```julia
141+
osys = convert(ODESystem, rn; expand_catalyst_funs = false)
142+
```
143+
generates an ODE system with `D(A) ~ -A(t)*hill(X, v, K, n)`. This keyword
144+
argument can also be passed to problems defined over `ReactionSystem`s, i.e.
145+
when calling `ODEProblem(rn, u0, tspan, p; expand_catalyst_funs = false)`.
146+
127147
## Catalyst 14.4.1
128148
- Support for user-defined functions on the RHS when providing coupled equations
129149
for CRNs using the @equations macro. For example, the following now works:

src/reactionsystem_conversions.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ Keyword args and default values:
491491
- `remove_conserved=false`, if set to `true` will calculate conservation laws of the
492492
underlying set of reactions (ignoring constraint equations), and then apply them to reduce
493493
the number of equations.
494+
- `expand_catalyst_funs = true`, replaces Catalyst defined functions like `hill(A,B,C,D)`
495+
with their rational function representation when converting to another system type. Set to
496+
`false`` to disable.
494497
"""
495498
function Base.convert(::Type{<:ODESystem}, rs::ReactionSystem; name = nameof(rs),
496499
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
@@ -557,6 +560,9 @@ Keyword args and default values:
557560
conservation laws. See the [FAQ
558561
entry](https://docs.sciml.ai/Catalyst/stable/faqs/#faq_remake_nonlinprob) for more
559562
details.
563+
- `expand_catalyst_funs = true`, replaces Catalyst defined functions like `hill(A,B,C,D)`
564+
with their rational function representation when converting to another system type. Set to
565+
`false`` to disable.
560566
"""
561567
function Base.convert(::Type{<:NonlinearSystem}, rs::ReactionSystem; name = nameof(rs),
562568
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
@@ -637,6 +643,9 @@ Notes:
637643
- `remove_conserved=false`, if set to `true` will calculate conservation laws of the
638644
underlying set of reactions (ignoring constraint equations), and then apply them to reduce
639645
the number of equations.
646+
- `expand_catalyst_funs = true`, replaces Catalyst defined functions like `hill(A,B,C,D)`
647+
with their rational function representation when converting to another system type. Set to
648+
`false`` to disable.
640649
"""
641650
function Base.convert(::Type{<:SDESystem}, rs::ReactionSystem;
642651
name = nameof(rs), combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
@@ -690,6 +699,9 @@ Notes:
690699
differential equations.
691700
- Does not currently support continuous events as these are not supported by
692701
`ModelingToolkit.JumpSystems`.
702+
- `expand_catalyst_funs = true`, replaces Catalyst defined functions like `hill(A,B,C,D)`
703+
with their rational function representation when converting to another system type. Set to
704+
`false`` to disable.
693705
"""
694706
function Base.convert(::Type{<:JumpSystem}, rs::ReactionSystem; name = nameof(rs),
695707
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
@@ -775,6 +787,9 @@ Keyword args and default values:
775787
conservation laws. See the [FAQ
776788
entry](https://docs.sciml.ai/Catalyst/stable/faqs/#faq_remake_nonlinprob) for more
777789
details.
790+
- `expand_catalyst_funs = true`, replaces Catalyst defined functions like `hill(A,B,C,D)`
791+
with their rational function representation when converting to another system type. Set to
792+
`false`` to disable.
778793
"""
779794
function DiffEqBase.NonlinearProblem(rs::ReactionSystem, u0,
780795
p = DiffEqBase.NullParameters(), args...;

0 commit comments

Comments
 (0)