Skip to content

Commit df673f9

Browse files
authored
Merge pull request #111 from isaacsas/doc-updates
Doc updates
2 parents dc3cd73 + 7b2c35d commit df673f9

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

src/maketype.jl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ function gentypefun_exprs(name; esc_exprs=true, gen_inplace=true, gen_outofplace
133133
exprs
134134
end
135135

136+
"""
137+
addodes!(network; build_jac=true, build_symfuncs=true)
138+
139+
Extend an `AbstractReactionNetwork` generated with the `@min_reaction_network`
140+
macro with everything needed to use ODE solvers.
141+
142+
Optional kwargs can be used to disable the construction of additional ODE solver
143+
components.
144+
"""
136145
function addodes!(rn::DiffEqBase.AbstractReactionNetwork; kwargs...)
137146
@unpack reactions, syms_to_ints, params_to_ints, syms = rn
138147

@@ -152,6 +161,15 @@ function addodes!(rn::DiffEqBase.AbstractReactionNetwork; kwargs...)
152161
nothing
153162
end
154163

164+
"""
165+
addsdes!(network; build_jac=true, build_symfuncs=true)
166+
167+
Extend an `AbstractReactionNetwork` generated with the `@min_reaction_network`
168+
macro with everything needed to use SDE solvers.
169+
170+
Optional kwargs can be used to disable the construction of additional SDE solver
171+
components.
172+
"""
155173
function addsdes!(rn::DiffEqBase.AbstractReactionNetwork)
156174
@unpack reactions, syms_to_ints, params_to_ints, scale_noise = rn
157175

@@ -169,6 +187,30 @@ function addsdes!(rn::DiffEqBase.AbstractReactionNetwork)
169187
nothing
170188
end
171189

190+
"""
191+
addjumps!(network; build_jumps=true, build_regular_jumps=true, minimal_jumps=false)
192+
193+
Extend an `AbstractReactionNetwork` generated with the `@min_reaction_network`
194+
macro with everything needed to use jump SSA solvers.
195+
196+
Optional kwargs can be used to disable the construction of additional jump solver
197+
components.
198+
199+
Keyword arguments:
200+
201+
* `build_jumps`: if true jump rates and affects will be calculated for use in
202+
DiffEqJump SSAs.
203+
204+
* `build_regular_jumps`: if true a `RegularJump` representation of the
205+
stochastic chemical kinetics model will be calculated for use in τ-leaping
206+
methods.
207+
208+
* `minimal_jumps`: if true `ConstantRate` jumps are only constructed for
209+
non-mass action jumps. (Note, mass action jumps are still resolved within any
210+
jump simulation. This option simply speeds up the construction of the jump
211+
problem since it avoids building redundant `ConstantRate` jumps that encode
212+
`MassActionJump`s, which are subsequently ignored within jump simulations.)
213+
"""
172214
function addjumps!(rn::DiffEqBase.AbstractReactionNetwork;
173215
build_jumps=true,
174216
build_regular_jumps=true,

src/network_properties.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ reaction with index `rxidx`. Note, for a reaction defined by
239239
`k*X*Y, X+Z --> 2X + Y`
240240
241241
the expression that is returned will be `:(k*X*Y)`, while the *rate law* used in
242-
ODEs, SDEs and jumps would be `k*X^2*Y*Z`.
242+
ODEs and SDEs would be `k*X^2*Y*Z`.
243243
"""
244244
function rateexpr(network, rxidx)
245245
network.reactions[rxidx].rate_org
@@ -424,7 +424,7 @@ end
424424
"""
425425
rxtospecies_depgraph(network)
426426
427-
Given an `AbstractReactionNetwork`, returns a Vector{Vector{Int}} mapping a
427+
Given an `AbstractReactionNetwork`, returns a `Vector{Vector{Int}}` mapping each
428428
reaction index to the indices of species that depend on it.
429429
"""
430430
function rxtospecies_depgraph(network)
@@ -437,7 +437,7 @@ end
437437
"""
438438
speciestorx_depgraph(network)
439439
440-
Given an `AbstractReactionNetwork`, returns a Vector{Vector{Int}} mapping a
440+
Given an `AbstractReactionNetwork`, returns a `Vector{Vector{Int}}` mapping each
441441
species index to the indices of reactions that depend on it.
442442
"""
443443
function speciestorx_depgraph(network)
@@ -459,7 +459,7 @@ end
459459
"""
460460
rxtorx_depgraph(network)
461461
462-
Given an `AbstractReactionNetwork`, returns a Vector{Vector{Int}} mapping a
462+
Given an `AbstractReactionNetwork`, returns a `Vector{Vector{Int}}` mapping each
463463
reaction index to the indices of reactions that depend on it.
464464
"""
465465
function rxtorx_depgraph(network, sptorxs=speciestorx_depgraph(network))

src/reaction_network.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ Example systems:
4747
probSDE = SDEProblem(rn, args...; kwargs...)
4848
probJump = JumpProblem(prob,aggregator::Direct,rn)
4949
"""
50+
51+
"""
52+
@reaction_network
53+
54+
Generates a subtype of an `AbstractReactionNetwork` that encodes a chemical
55+
reaction network, and complete ODE, SDE and jump representations
56+
of the system.
57+
"""
5058
macro reaction_network(name, ex::Expr, p...)
5159
coordinate(name, MacroTools.striplines(ex), p, :no___noise___scaling)
5260
end
@@ -63,6 +71,14 @@ macro reaction_network(ex::Expr, p...)
6371
end
6472

6573
################# query-based macros:
74+
75+
"""
76+
@min_reaction_network
77+
78+
Generates a subtype of an `AbstractReactionNetwork` that only encodes a chemical
79+
reaction network. Use [`addodes!`](@ref), [`addsdes!`](@ref) or
80+
[`addjumps!`](@ref) to complete the network for specific problem types.
81+
"""
6682
macro min_reaction_network(name, ex::Expr, p...)
6783
min_coordinate(name, MacroTools.striplines(ex), p, :no___noise___scaling)
6884
end

0 commit comments

Comments
 (0)