Skip to content

Commit

Permalink
Merge pull request #1014 from isaacsas/updates
Browse files Browse the repository at this point in the history
misc updates
  • Loading branch information
isaacsas authored Aug 8, 2024
2 parents fe27ca3 + 3a30bd0 commit d7ed9e0
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 19 deletions.
32 changes: 29 additions & 3 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,35 @@

## Catalyst unreleased (master branch)

## Catalyst 14.2
- Support for auto-algorithm selection in `JumpProblem`s. For systems with only
propensities that do not have an explicit time-dependence (i.e. that are not
`VariableRateJump`s in JumpProcesses), one can now run model simulations via
```julia
using Catalyst, JumpProcesses
model = @reaction_network begin
kB, S + E --> SE
kD, SE --> S + E
kP, SE --> P + E
end
u0 = [:S => 50, :E => 10, :SE => 0, :P => 0]
tspan = (0., 200.)
ps = [:kB => 0.01, :kD => 0.1, :kP => 0.1]
dprob = DiscreteProblem(model, u0, tspan, ps)
jprob = JumpProblem(model, dprob)
sol = solve(jprob)
```
For small systems this will just use Gillespie's `Direct` method, transitioning to using `RSSA` and `RSSACR` as system size increase. Once can still manually select a given SSA, but no longer needs to specify `SSAStepper` when calling `solve`, i.e.
```julia
# use the SortingDirect method instead
jprob = JumpProblem(model, dprob, SortingDirect())
sol = solve(jprob)
```
- Latexify recipe improvements including display fixes for array symbolics.
- Deficiency one and concentration robustness checks.

## Catalyst 14.1.1
The expansion of `ReactionSystem` models to spatial lattices has been enabled. Here follows a
The expansion of `ReactionSystem` models to spatial lattices has been enabled. Here follows a
simple example where a Brusselator model is expanded to a 20x20 grid of compartments, with diffusion
for species X, and then simulated using ODEs. Finally, an animation of the simulation is created.
```julia
Expand Down Expand Up @@ -35,8 +61,8 @@ The addition of spatial modelling in Catalyst contains a large number of new fea
described in the [corresponding documentation](https://docs.sciml.ai/Catalyst/stable/spatial_modelling/lattice_reaction_systems/).

## Catalyst 14.0.1
Bug fix to address that independent variables, like time, should now be `@parameters`
according to MTKv9. Converted internal time variables to consistently use `default_t()`
Bug fix to address that independent variables, like time, should now be `@parameters`
according to MTKv9. Converted internal time variables to consistently use `default_t()`
to hopefully avoid such issues going forward.

## Catalyst 14.0
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Catalyst"
uuid = "479239e8-5488-4da2-87a7-35f2df7eef83"
version = "14.1.1-DEV"
version = "14.2"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down Expand Up @@ -54,7 +54,7 @@ Graphs = "1.4"
HomotopyContinuation = "2.9"
JumpProcesses = "9.13.1"
LaTeXStrings = "1.3.0"
Latexify = "0.14, 0.15, 0.16"
Latexify = "0.16.5"
MacroTools = "0.5.5"
ModelingToolkit = "9.30.1"
Parameters = "0.12"
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,18 @@ plot(sol; lw = 5)
![ODE simulation](docs/src/assets/readme_ode_plot.svg)

#### Stochastic jump simulations
The same model can be used as input to other types of simulations. E.g. here we instead generate and simulate a stochastic chemical kinetics jump process model.
The same model can be used as input to other types of simulations. E.g. here we
instead generate and simulate a stochastic chemical kinetics jump process model
for the reaction network. An exact realization of the jump process is sampled
using an auto-selected stochastic simulation algorithm (SSA) (which for the
small network in the current example ends up being Gillespie's Direct method):
```julia
# Create and simulate a jump process (here using Gillespie's direct algorithm).
# The initial conditions are now integers as we track exact populations for each species.
using JumpProcesses
u0_integers = [:S => 50, :E => 10, :SE => 0, :P => 0]
dprob = DiscreteProblem(model, u0_integers, tspan, ps)
jprob = JumpProblem(model, dprob, Direct())
jump_sol = solve(jprob, SSAStepper())
jprob = JumpProblem(model, dprob)
jump_sol = solve(jprob)
plot(jump_sol; lw = 2)
```
![Jump simulation](docs/src/assets/readme_jump_plot.svg)
Expand Down
4 changes: 2 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
BenchmarkTools = "1.5"
BifurcationKit = "0.3.4"
CairoMakie = "0.12"
Catalyst = "14"
Catalyst = "14.2"
DataFrames = "1.6"
DiffEqParamEstim = "2.2"
Distributions = "0.25"
Expand All @@ -53,7 +53,7 @@ Graphs = "1.11.1"
HomotopyContinuation = "2.9"
IncompleteLU = "0.2"
JumpProcesses = "9.13.1"
Latexify = "0.16"
Latexify = "0.16.5"
LinearSolve = "2.30"
ModelingToolkit = "9.30.1"
NonlinearSolve = "3.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,19 @@ params = [:b => 0.2, :k => 1.0]
nothing # hide
```

Previously we have bundled this information into an `ODEProblem` (denoting a deterministic *ordinary differential equation*). Now we wish to simulate our model as a jump process (where each reaction event corresponds to a single jump in the state of the system). We do this by first creating a `DiscreteProblem`, and then using this as an input to a `JumpProblem`.
Previously we have bundled this information into an `ODEProblem` (denoting a deterministic *ordinary differential equation*). Now we wish to simulate our model as a jump process (where each reaction event corresponds to a discrete change in the state of the system). We do this by first creating a `DiscreteProblem`, and then using this as an input to a `JumpProblem`.
```@example ex2
using JumpProcesses # hide
dprob = DiscreteProblem(sir_model, u0, tspan, params)
jprob = JumpProblem(sir_model, dprob, Direct())
jprob = JumpProblem(sir_model, dprob)
nothing # hide
```
Again, the order in which the inputs are given to the `DiscreteProblem` and the `JumpProblem` is important. The last argument to the `JumpProblem` (`Direct()`) denotes which simulation method we wish to use. For now, we recommend that users simply use the `Direct()` option, and then consider alternative ones (see the [JumpProcesses.jl docs](https://docs.sciml.ai/JumpProcesses/stable/)) when they are more familiar with modelling in Catalyst and Julia.
Again, the order in which the inputs are given to the `DiscreteProblem` and the `JumpProblem` is important.

Finally, we can simulate our model using the `solve` function, and plot the solution using the `plot` function. For jump simulations, the `solve` function also requires a second argument (`SSAStepper()`). This is a time-stepping algorithm that calls the `Direct` solver to advance a simulation. Again, we recommend at this stage you simply use this option, and then explore exactly what this means at a later stage.
Finally, we can simulate our model using the `solve` function, and plot the solution using the `plot` function.
```@example ex2
sol = solve(jprob, SSAStepper())
sol = solve(jprob, SSAStepper(); seed=1234) # hide
sol = solve(jprob)
sol = solve(jprob; seed=1234) # hide
plot(sol)
```

Expand Down Expand Up @@ -222,7 +222,7 @@ We have previously described how to set up new Julia environments, how to instal
1. If Latexify is not already installed on your computer, install it.
2. Add Latexify as an available package to your current environment.

Here, while Catalyst has previously been installed on your computer, it has not been added to the new environment you created. To do so, simply run
Here, while Catalyst has previously been installed on your computer, it has not been added to the new environment you created. To do so, simply run
```julia
using Pkg
Pkg.add("Latexify")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ dprob = DiscreteProblem(rn, u₀map, tspan, pmap)
jprob = JumpProblem(rn, dprob, Direct())
# now, let's solve and plot the jump process:
sol = solve(jprob, SSAStepper())
sol = solve(jprob)
plot(sol)
Catalyst.PNG(plot(sol; fmt = :png, dpi = 200)) # hide
```
Expand Down

0 comments on commit d7ed9e0

Please sign in to comment.