|
1 | 1 | # [The Catalyst DSL - Advanced Features and Options](@id dsl_advanced_options)
|
2 | 2 | Within the Catalyst DSL, each line can represent either *a reaction* or *an option*. The [previous DSL tutorial](@ref dsl_description) described how to create reactions. This one will focus on options. These are typically used to supply a model with additional information. Examples include the declaration of initial condition/parameter default values, or the creation of observables.
|
3 | 3 |
|
4 |
| -All option designations begin with a declaration starting with `@`, followed by its input. E.g. the `@observables` option allows for the generation of observables. Each option can only be used once within each use of `@reaction_network`. A full list of options can be found [here](@ref ref), with most (but not all) being described in more detail below. This tutorial will also describe some additional advanced DSL features that do not involve using an option. |
| 4 | +All option designations begin with a declaration starting with `@`, followed by its input. E.g. the `@observables` option allows for the generation of observables. Each option can only be used once within each use of `@reaction_network`. This tutorial will also describe some additional advanced DSL features that do not involve using an option. |
5 | 5 |
|
6 | 6 | As a first step, we import Catalyst (which is required to run the tutorial):
|
7 | 7 | ```@example dsl_advanced_explicit_definitions
|
@@ -130,7 +130,6 @@ oprob = ODEProblem(rn, u0, tspan, p)
|
130 | 130 | sol = solve(oprob)
|
131 | 131 | plot(sol)
|
132 | 132 | ```
|
133 |
| -API for checking the default values of species and parameters can be found [here](@ref ref). |
134 | 133 |
|
135 | 134 | ### [Setting parametric initial conditions](@id dsl_advanced_options_parametric_initial_conditions)
|
136 | 135 | In the previous section, we designated default values for initial conditions and parameters. However, the right-hand side of the designation accepts any valid expression (not only numeric values). While this can be used to set up some advanced default values, the most common use case is to designate a species's initial condition as a parameter. E.g. in the following example we represent the initial condition of `X` using the parameter `X₀`.
|
@@ -198,13 +197,11 @@ two_state_system = @reaction_network begin
|
198 | 197 | end
|
199 | 198 | ```
|
200 | 199 |
|
201 |
| -Each metadata has its own getter functions. E.g. we can get the description of the parameter `kA` using `ModelingToolkit.getdescription` (here we use [system indexing](@ref ref) to access the parameter): |
| 200 | +Each metadata has its own getter functions. E.g. we can get the description of the parameter `kA` using `ModelingToolkit.getdescription`: |
202 | 201 | ```@example dsl_advanced_metadata
|
203 | 202 | ModelingToolkit.getdescription(two_state_system.kA)
|
204 | 203 | ```
|
205 | 204 |
|
206 |
| -It is not possible for the user to directly designate their own metadata. These have to first be added to Catalyst. Doing so is somewhat involved, and described in detail [here](@ref ref). A full list of metadata that can be used for species and/or parameters can be found [here](@ref ref). |
207 |
| - |
208 | 205 | ### [Designating constant-valued/fixed species parameters](@id dsl_advanced_options_constant_species)
|
209 | 206 |
|
210 | 207 | Catalyst enables the designation of parameters as `constantspecies`. These parameters can be used as species in reactions, however, their values are not changed by the reaction and remain constant throughout the simulation (unless changed by e.g. the [occurrence of an event]@ref constraint_equations_events). Practically, this is done by setting the parameter's `isconstantspecies` metadata to `true`. Here, we create a simple reaction where the species `X` is converted to `Xᴾ` at rate `k`. By designating `X` as a constant species parameter, we ensure that its quantity is unchanged by the occurrence of the reaction.
|
@@ -391,11 +388,11 @@ Some final notes regarding observables:
|
391 | 388 | - The left-hand side of the observable declaration must contain a single symbol only (with the exception of metadata, which can also be supplied).
|
392 | 389 | - All quantities appearing on the right-hand side must be declared elsewhere within the `@reaction_network` call (either by being part of a reaction, or through the `@species`, `@parameters`, or `@variables` options).
|
393 | 390 | - Observables may not depend on other observables.
|
394 |
| -- Observables have their [dependent variable(s)](@ref ref) automatically assigned as the union of the dependent variables of the species and variables on which it depends. |
| 391 | +- Observables have their dependent variable(s) automatically assigned as the union of the dependent variables of the species and variables on which it depends. |
395 | 392 |
|
396 | 393 | ## [Specifying non-time independent variables](@id dsl_advanced_options_ivs)
|
397 | 394 |
|
398 |
| -As [described elsewhere](@ref ref), Catalyst's `ReactionSystem` models depend on a *time independent variable*, and potentially one or more *spatial independent variables*. By default, the independent variable `t` is used. We can declare another independent variable (which is automatically used as the default one) using the `@ivs` option. E.g. to use `τ` instead of `t` we can use |
| 395 | +Catalyst's `ReactionSystem` models depend on a *time independent variable*, and potentially one or more *spatial independent variables*. By default, the independent variable `t` is used. We can declare another independent variable (which is automatically used as the default one) using the `@ivs` option. E.g. to use `τ` instead of `t` we can use |
399 | 396 | ```@example dsl_advanced_ivs
|
400 | 397 | using Catalyst # hide
|
401 | 398 | rn = @reaction_network begin
|
@@ -466,5 +463,3 @@ A reaction's metadata can be accessed using specific functions, e.g. `Catalyst.h
|
466 | 463 | rx = @reaction p, 0 --> X, [description="A production reaction"]
|
467 | 464 | Catalyst.getdescription(rx)
|
468 | 465 | ```
|
469 |
| - |
470 |
| -A list of all available reaction metadata can be found [here](@ref ref). |
0 commit comments