53
53
Macro for generating chemical reaction network models (Catalyst `ReactionSystem`s). See the
54
54
following two section ([DSL introduction](https://docs.sciml.ai/Catalyst/stable/model_creation/dsl_basics/)
55
55
and [advantage usage](https://docs.sciml.ai/Catalyst/stable/model_creation/dsl_advanced/)) of
56
- the Catalyst documentation for more details on the domain specific language (DSL) that the
57
- macro implements. The macros output (a `ReactionSystem` structure) are central to Catalyst
58
- and its functionality. How to e.g. simulate them is described in the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/).
56
+ the Catalyst documentation for more details on the domain- specific language (DSL) that the
57
+ macro implements. The macro's output (a `ReactionSystem` structure) is central to Catalyst
58
+ and its functionality. How to e.g. simulate these is described in the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/).
59
59
60
60
Returns:
61
61
- A Catalyst `ReactionSystem`, i.e. a symbolic model for the reaction network. The returned
62
62
system is marked `complete`. To obtain a `ReactionSystem` that is not marked complete, for
63
- example to then use in compositional modeling , see the otherwise equivalent `@network_component`
63
+ example to then use in compositional modelling , see the otherwise equivalent `@network_component`
64
64
macro.
65
65
66
66
Examples:
@@ -253,7 +253,7 @@ function extract_metadata(metadata_line::Expr)
253
253
return metadata
254
254
end
255
255
256
- # ## Specialised Error for @require_declaration Option ###
256
+ # ## Specialised @require_declaration Option Error ###
257
257
struct UndeclaredSymbolicError <: Exception
258
258
msg:: String
259
259
end
@@ -282,13 +282,13 @@ function make_reaction_system(ex::Expr, name)
282
282
any (! in (option_keys), keys (options)) &&
283
283
error (" The following unsupported options were used: $(filter (opt_in-> ! in (opt_in,option_keys), keys (options))) " )
284
284
285
- # Read options that explicitly declares some symbol. Compiles a list of all declared symbols
286
- # and checks that there has been no double-declarations.
287
- cmpexpr_init, cmps_declared = read_compound_options (options)
285
+ # Read options that explicitly declares some symbol (e.g. `@species`). Compiles a list of
286
+ # all declared symbols and checks that there has been no double-declarations.
288
287
sps_declared = extract_syms (options, :species )
289
288
ps_declared = extract_syms (options, :parameters )
290
289
vs_declared = extract_syms (options, :variables )
291
290
tiv, sivs, ivs, ivsexpr = read_ivs_option (options)
291
+ cmpexpr_init, cmps_declared = read_compound_options (options)
292
292
diffsexpr, diffs_declared = read_differentials_option (options)
293
293
syms_declared = collect (Iterators. flatten ((cmps_declared, sps_declared, ps_declared,
294
294
vs_declared, ivs, diffs_declared)))
@@ -340,15 +340,15 @@ function make_reaction_system(ex::Expr, name)
340
340
name = $ name
341
341
spatial_ivs = $ sivs
342
342
rx_eq_vec = $ rxsexprs
343
- vars = setdiff (union ($ spsvar, $ vsvar, $ cmpsvar), $ obs_syms)
343
+ us = setdiff (union ($ spsvar, $ vsvar, $ cmpsvar), $ obs_syms)
344
344
observed = $ obs_eqs
345
345
continuous_events = $ continuous_events_expr
346
346
discrete_events = $ discrete_events_expr
347
347
combinatoric_ratelaws = $ combinatoric_ratelaws
348
348
default_reaction_metadata = $ default_reaction_metadata
349
349
350
350
remake_ReactionSystem_internal (
351
- make_ReactionSystem_internal (rx_eq_vec, $ tiv, vars , $ psvar; name, spatial_ivs,
351
+ make_ReactionSystem_internal (rx_eq_vec, $ tiv, us , $ psvar; name, spatial_ivs,
352
352
observed, continuous_events, discrete_events, combinatoric_ratelaws);
353
353
default_reaction_metadata)
354
354
end ))
@@ -581,7 +581,7 @@ function get_rxexpr(rx::DSLReaction)
581
581
subs_stoich_init = deepcopy (subs_init)
582
582
prod_init = isempty (rx. products) ? nothing : :([])
583
583
prod_stoich_init = deepcopy (prod_init)
584
- rx_constructor = :(Reaction ($ rate, $ subs_init, $ subs_stoich_init , $ prod_init ,
584
+ rx_constructor = :(Reaction ($ rate, $ subs_init, $ prod_init , $ subs_stoich_init ,
585
585
$ prod_stoich_init; metadata = $ (rx. metadata)))
586
586
587
587
# Loops through all products and substrates, and adds them (and their stoichiometries)
@@ -876,22 +876,22 @@ macro (but permitting only a single reaction). A more detailed introduction to t
876
876
be found in the description of `@reaction_network`.
877
877
878
878
The `@reaction` macro is followed by a single line consisting of three parts:
879
- - A rate (at which the reaction occur ).
879
+ - A rate (at which the reaction occurs ).
880
880
- Any number of substrates (which are consumed by the reaction).
881
881
- Any number of products (which are produced by the reaction).
882
882
883
883
The output is a reaction (just like created using the `Reaction` constructor).
884
884
885
885
Examples:
886
- Here we create a simple binding reaction and stores it in the variable rx:
886
+ Here we create a simple binding reaction and store it in the variable rx:
887
887
```julia
888
888
rx = @reaction k, X + Y --> XY
889
889
```
890
890
The macro will automatically deduce `X`, `Y`, and `XY` to be species (as these occur as reactants)
891
- and `k` as a parameters (as it does not occur as a reactant).
891
+ and `k` as a parameter (as it does not occur as a reactant).
892
892
893
893
The `@reaction` macro provides a more concise notation to the `Reaction` constructor. I.e. here
894
- we create the same reaction using both approaches, and also confirms that they are identical.
894
+ we create the same reaction using both approaches, and also confirm that they are identical.
895
895
```julia
896
896
# Creates a reaction using the `@reaction` macro.
897
897
rx = @reaction k*v, A + B --> C + D
@@ -917,7 +917,7 @@ rx = @reaction b*\$ex*\$A, \$A --> C
917
917
Notes:
918
918
- `@reaction` does not support bi-directional type reactions (using `<-->`) or reaction bundling
919
919
(e.g. `d, (X,Y) --> 0`).
920
- - Interpolation of Julia variables into the macro works similar to the `@reaction_network`
920
+ - Interpolation of Julia variables into the macro works similarly to the `@reaction_network`
921
921
macro. See [The Reaction DSL](@ref dsl_description) tutorial for more details.
922
922
"""
923
923
macro reaction (ex)
0 commit comments