From e67f7d1b0b1d481781c2b4f76edf55d87dd00c73 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Thu, 8 Aug 2024 15:39:54 -0400 Subject: [PATCH] updates --- HISTORY.md | 32 +++++++++++++++++-- Project.toml | 4 +-- README.md | 11 ++++--- docs/Project.toml | 4 +-- .../catalyst_for_new_julia_users.md | 14 ++++---- .../introduction_to_catalyst.md | 2 +- 6 files changed, 48 insertions(+), 19 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index ca0a517189..f9ef87e663 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 @@ -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 diff --git a/Project.toml b/Project.toml index 6fd0a97390..1ae8250a58 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -54,7 +54,7 @@ Graphs = "1.4" HomotopyContinuation = "2.9" JumpProcesses = "9.13" LaTeXStrings = "1.3.0" -Latexify = "0.14, 0.15, 0.16" +Latexify = "0.16.5" MacroTools = "0.5.5" ModelingToolkit = "9.16.0" Parameters = "0.12" diff --git a/README.md b/README.md index 2746b1fe06..a1cf202795 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/Project.toml b/docs/Project.toml index 59a4c8842d..f05f9d75a2 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -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" @@ -53,7 +53,7 @@ Graphs = "1.11.1" HomotopyContinuation = "2.9" IncompleteLU = "0.2" JumpProcesses = "9.13" -Latexify = "0.16" +Latexify = "0.16.5" LinearSolve = "2.30" ModelingToolkit = "9.16.0" NonlinearSolve = "3.12" diff --git a/docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md b/docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md index 4dc4c5d44b..061c33f93e 100644 --- a/docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md +++ b/docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md @@ -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) ``` @@ -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") diff --git a/docs/src/introduction_to_catalyst/introduction_to_catalyst.md b/docs/src/introduction_to_catalyst/introduction_to_catalyst.md index 986b63dbf6..c2e21c3d63 100644 --- a/docs/src/introduction_to_catalyst/introduction_to_catalyst.md +++ b/docs/src/introduction_to_catalyst/introduction_to_catalyst.md @@ -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 ```