Skip to content

Commit 919e480

Browse files
authored
Merge pull request #925 from SciML/remove__empty_cross_references
[v14 - Ready] Remove empty cross references
2 parents 7ac4307 + 97e2d3d commit 919e480

12 files changed

+29
-36
lines changed

docs/src/model_creation/dsl_advanced.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [The Catalyst DSL - Advanced Features and Options](@id dsl_advanced_options)
22
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.
33

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.
55

66
As a first step, we import Catalyst (which is required to run the tutorial):
77
```@example dsl_advanced_explicit_definitions
@@ -130,7 +130,6 @@ oprob = ODEProblem(rn, u0, tspan, p)
130130
sol = solve(oprob)
131131
plot(sol)
132132
```
133-
API for checking the default values of species and parameters can be found [here](@ref ref).
134133

135134
### [Setting parametric initial conditions](@id dsl_advanced_options_parametric_initial_conditions)
136135
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
198197
end
199198
```
200199

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`:
202201
```@example dsl_advanced_metadata
203202
ModelingToolkit.getdescription(two_state_system.kA)
204203
```
205204

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-
208205
### [Designating constant-valued/fixed species parameters](@id dsl_advanced_options_constant_species)
209206

210207
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:
391388
- The left-hand side of the observable declaration must contain a single symbol only (with the exception of metadata, which can also be supplied).
392389
- 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).
393390
- 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.
395392

396393
## [Specifying non-time independent variables](@id dsl_advanced_options_ivs)
397394

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
399396
```@example dsl_advanced_ivs
400397
using Catalyst # hide
401398
rn = @reaction_network begin
@@ -466,5 +463,3 @@ A reaction's metadata can be accessed using specific functions, e.g. `Catalyst.h
466463
rx = @reaction p, 0 --> X, [description="A production reaction"]
467464
Catalyst.getdescription(rx)
468465
```
469-
470-
A list of all available reaction metadata can be found [here](@ref ref).

docs/src/model_creation/dsl_basics.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [The Catalyst DSL - Introduction](@id dsl_description)
22
In the [introduction to Catalyst](@ref introduction_to_catalyst) we described how the `@reaction_network` [macro](https://docs.julialang.org/en/v1/manual/metaprogramming/#man-macros) can be used to create chemical reaction network (CRN) models. This macro enables a so-called [domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language) (DSL) for creating CRN models. This tutorial will give a basic introduction on how to create Catalyst models using this macro (from now onwards called "*the Catalyst DSL*"). A [follow-up tutorial](@ref dsl_advanced_options) will describe some of the DSL's more advanced features.
33

4-
The Catalyst DSL generates a [`ReactionSystem`](@ref) (the [julia structure](https://docs.julialang.org/en/v1/manual/types/#Composite-Types) Catalyst uses to represent CRN models). These can be created through alternative methods (e.g. [programmatically](@ref programmatic_CRN_construction) or [compositionally](@ref compositional_modeling)). A summary of the various ways to create `ReactionSystems`s can be found [here](@ref ref). [Previous](@ref introduction_to_catalyst) and [following](@ref simulation_intro) tutorials describe how to simulate models once they have been created using the DSL. This tutorial will solely focus on model creation.
4+
The Catalyst DSL generates a [`ReactionSystem`](@ref) (the [julia structure](https://docs.julialang.org/en/v1/manual/types/#Composite-Types) Catalyst uses to represent CRN models). These can be created through alternative methods (e.g. [programmatically](@ref programmatic_CRN_construction) or [compositionally](@ref compositional_modeling)). [Previous](@ref introduction_to_catalyst) and [following](@ref simulation_intro) tutorials describe how to simulate models once they have been created using the DSL. This tutorial will solely focus on model creation.
55

66
Before we begin, we will first load the Catalyst package (which is required to run the code).
77
```@example dsl_basics_intro
@@ -217,7 +217,7 @@ latexify(rn_13_alt; form=:ode)
217217
```
218218
Here, while these models will generate identical ODE, SDE, and jump simulations, the chemical reaction network models themselves are not equivalent. Generally, as pointed out in the two notes below, using the second form is preferable.
219219
!!! warn
220-
While `rn_13` and `rn_13_alt` will generate equivalent simulations, for jump simulations, the first model will have [reduced performance](@ref ref) (which generally are more performant when rates are constant).
220+
While `rn_13` and `rn_13_alt` will generate equivalent simulations, for jump simulations, the first model will have reduced performance (which generally are more performant when rates are constant).
221221

222222
!!! danger
223223
Catalyst automatically infers whether quantities appearing in the DSL are species or parameters (as described [here](@ref dsl_advanced_options_declaring_species_and_parameters)). Generally, anything that does not appear as a reactant is inferred to be a parameter. This means that if you want to model a reaction activated by a species (e.g. `kp*A, 0 --> P`), but that species does not occur as a reactant, it will be interpreted as a parameter. This can be handled by [manually declaring the system species](@ref dsl_advanced_options_declaring_species_and_parameters).
@@ -282,7 +282,7 @@ end
282282
```
283283

284284
!!! warn
285-
Jump simulations cannot be performed for models with time-dependent rates without additional considerations, which are discussed [here](@ref ref).
285+
Jump simulations cannot be performed for models with time-dependent rates without additional considerations.
286286

287287
## [Non-standard stoichiometries](@id dsl_description_stoichiometries)
288288

@@ -294,7 +294,7 @@ rn_16 = @reaction_network begin
294294
d, X --> 0
295295
end
296296
```
297-
It is also possible to have non-integer stoichiometric coefficients for substrates. However, in this case the [`combinatoric_ratelaw = false`](@ref ref) option must be used. We note that non-integer stoichiometric coefficients do not make sense in most fields, however, this feature is available for use for models where it does make sense.
297+
It is also possible to have non-integer stoichiometric coefficients for substrates. However, in this case the `combinatoric_ratelaw = false` option must be used. We note that non-integer stoichiometric coefficients do not make sense in most fields, however, this feature is available for use for models where it does make sense.
298298

299299
### [Parametric stoichiometries](@id dsl_description_stoichiometries_parameters)
300300
It is possible for stoichiometric coefficients to be parameters. E.g. here we create a generic polymerisation system where `n` copies of `X` bind to form `Xn`:
@@ -368,4 +368,4 @@ It should be noted that the following symbols are *not permitted* to be used as
368368
- `` ([used for production/degradation reactions](@ref dsl_description_symbols_empty_set)).
369369
- `im` (used in Julia to represent [complex numbers](https://docs.julialang.org/en/v1/manual/complex-and-rational-numbers/#Complex-Numbers)).
370370
- `nothing` (used in Julia to denote [nothing](https://docs.julialang.org/en/v1/base/constants/#Core.nothing)).
371-
- `Γ` (used by Catalyst to represent [conserved quantities](@ref ref)).
371+
- `Γ` (used by Catalyst to represent conserved quantities).

docs/src/model_creation/examples/basic_CRN_library.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ oplt = plot(osol; idxs = X₁ + X₂, title = "Reaction rate equation (ODE)")
7979
splt = plot(ssol; idxs = X₁ + X₂, title = "Chemical Langevin equation (SDE)")
8080
plot(oplt, splt; lw = 3, ylimit = (99,101), size = (800,450), layout = (2,1))
8181
```
82-
Catalyst has special methods for working with conserved quantities, which are described [here](@ref ref).
8382

8483
## [Michaelis-Menten enzyme kinetics](@id basic_CRN_library_mm)
8584
[Michaelis-Menten enzyme kinetics](https://en.wikipedia.org/wiki/Michaelis%E2%80%93Menten_kinetics) is a simple description of an enzyme ($E$) transforming a substrate ($S$) into a product ($P$). Under certain assumptions, it can be simplified to a single function (a Michaelis-Menten function) and used as a reaction rate. Here we instead present the full system model:

docs/src/model_creation/examples/programmatic_generative_linear_pathway.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ plot!(sol_n10; idxs = :X10, label = "n = 10")
7777
## [Modelling linear pathways using programmatic, generative, modelling](@id programmatic_generative_linear_pathway_generative)
7878
Above, we investigated the impact of linear pathways' lengths on their behaviours. Since the models were implemented using the DSL, we had to implement a new model for each pathway (in each case writing out all reactions). Here, we will instead show how [programmatic modelling](@ref programmatic_CRN_construction) can be used to generate pathways of arbitrary lengths.
7979

80-
First, we create a function, `generate_lp`, which creates a linear pathway model of length `n`. It utilises [*vector variables*](@ref ref) to create an arbitrary number of species, and also creates an [observable](@ref ref) for the final species of the chain.
80+
First, we create a function, `generate_lp`, which creates a linear pathway model of length `n`. It utilises *vector variables* to create an arbitrary number of species, and also creates an observable for the final species of the chain.
8181
```@example programmatic_generative_linear_pathway_generative
8282
using Catalyst # hide
8383
t = default_t()

docs/src/model_creation/model_visualisation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Here, we note that the output of `latexify(brusselator)` is identical to how a m
2424
latexify(brusselator; form = :ode)
2525
```
2626
!!! note
27-
Internally, `latexify(brusselator; form = :ode)` calls `latexify(convert(ODESystem, brusselator))`. Hence, if you have already [generated the `ODESystem` corresponding to your model](@ref ref), it can be used directly as input to `latexify`.
27+
Internally, `latexify(brusselator; form = :ode)` calls `latexify(convert(ODESystem, brusselator))`. Hence, if you have already generated the `ODESystem` corresponding to your model, it can be used directly as input to `latexify`.
2828

2929
!!! note
3030
It should be possible to also generate SDEs through the `form = :sde` input. This feature is, however, currently broken.

docs/src/model_simulation/ode_simulation_performance.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# [Advice for performant ODE simulations](@id ode_simulation_performance)
2-
We have previously described how to perform ODE simulations of *chemical reaction network* (CRN) models. These simulations are typically fast and require little additional consideration. However, when a model is simulated many times (e.g. as a part of solving an [inverse problem](@ref ref)), or is very large, simulation run times may become noticeable. Here we will give some advice on how to improve performance for these cases [^1].
2+
We have previously described how to perform ODE simulations of *chemical reaction network* (CRN) models. These simulations are typically fast and require little additional consideration. However, when a model is simulated many times (e.g. as a part of solving an inverse problem), or is very large, simulation run
3+
times may become noticeable. Here we will give some advice on how to improve performance for these cases [^1].
34

45
Generally, there are few good ways to, before a simulation, determine the best options. Hence, while we below provide several options, if you face an application for which reducing run time is critical (e.g. if you need to simulate the same ODE many times), it might be required to manually trial these various options to see which yields the best performance ([BenchmarkTools.jl's](https://github.com/JuliaCI/BenchmarkTools.jl) `@btime` macro is useful for this purpose). It should be noted that the default options typically perform well, and it is primarily for large models where investigating alternative options is worthwhile. All ODE simulations of Catalyst models are performed using the OrdinaryDiffEq.jl package, [which documentation](https://docs.sciml.ai/DiffEqDocs/stable/) provides additional advice on performance.
56

@@ -303,7 +304,7 @@ nothing # hide
303304
```
304305
Here have we increased the number of simulations to 10,000, since this is a more appropriate number for GPU parallelisation (as compared to the 100 simulations we performed in our CPU example).
305306
!!! note
306-
Currently, declaration of static vectors requires [symbolic, rather than symbol, form](@ref ref) for species and parameters. Hence, we here first [`@unpack` these](@ref ref) before constructing `u0` and `ps` using `@SVector`.
307+
Currently, declaration of static vectors requires symbolic, rather than symbol, form for species and parameters. Hence, we here first `@unpack` these before constructing `u0` and `ps` using `@SVector`.
307308

308309
We can now simulate our model using a GPU-based ensemble algorithm. Currently, two such algorithms are available, `EnsembleGPUArray` and `EnsembleGPUKernel`. Their differences are that
309310
- Only `EnsembleGPUKernel` requires arrays to be static arrays (although it is still advantageous for `EnsembleGPUArray`).

0 commit comments

Comments
 (0)