From 0f47554d4953f2d56fb441688c027f0af8f3ca46 Mon Sep 17 00:00:00 2001 From: sivasathyaseeelan Date: Sat, 4 Jan 2025 18:18:42 +0530 Subject: [PATCH 1/3] Added some edge cases in reactionsystems and networkanalysis Signed-off-by: sivasathyaseeelan --- test/network_analysis/network_properties.jl | 29 +++++++++++++++++++++ test/reactionsystem_core/reactionsystem.jl | 3 +++ 2 files changed, 32 insertions(+) diff --git a/test/network_analysis/network_properties.jl b/test/network_analysis/network_properties.jl index 21f7cb402e..7581cc534e 100644 --- a/test/network_analysis/network_properties.jl +++ b/test/network_analysis/network_properties.jl @@ -180,6 +180,17 @@ let rates = Dict(zip(parameters(rn4), k)) @test Catalyst.iscomplexbalanced(rn4, rates) == true end + +let + rn = @reaction_network begin + (k1, k2), C1 <--> C2 + (k3, k4), C2 <--> C3 + (k5, k6), C3 <--> C1 + end + + incorrect_params = Dict(:k1 => 0.5) + @test_throws ErrorException Catalyst.iscomplexbalanced(rn, incorrect_params) +end ### Tests Reversibility ### @@ -708,6 +719,13 @@ let Catalyst.ratematrix(rn, rates_vec) == rate_mat Catalyst.ratematrix(rn, rates_tup) == rate_mat Catalyst.ratematrix(rn, rates_dict) == rate_mat + + # Tests that throws error in rate matrix. + incorrect_param_dict = Dict(:k1 => 1.0) + + @test_throws ErrorException Catalyst.ratematrix(rn, 123) + @test_throws ErrorException Catalyst.ratematrix(rn, incorrect_param_dict) + @test_throws Exception Catalyst.iscomplexbalanced(rn, rates_invalid) end @@ -739,6 +757,17 @@ let @test Catalyst.robustspecies(EnvZ_OmpR) == [6] end +let + # Define a reaction network with bi-directional reactions + non_deficient_network = @reaction_network begin + (k1, k2), A <--> B + (k3, k4), B <--> C + end + + # Test: Check that the error is raised for networks with deficiency != 1 + @test_throws ErrorException Catalyst.robustspecies(non_deficient_network) +end + ### Complex and detailed balance tests diff --git a/test/reactionsystem_core/reactionsystem.jl b/test/reactionsystem_core/reactionsystem.jl index 505781305a..0045b04c3c 100644 --- a/test/reactionsystem_core/reactionsystem.jl +++ b/test/reactionsystem_core/reactionsystem.jl @@ -107,6 +107,9 @@ end let @named rs2 = ReactionSystem(rxs, t) @test Catalyst.isequivalent(rs, rs2) + + # Test with a type mismatch + @test Catalyst.isequivalent(rs, "Not a ReactionSystem") == false end # Defaults test. From 1e6132cb240364d655a70d12cab39d8777470547 Mon Sep 17 00:00:00 2001 From: vyudu Date: Thu, 9 Jan 2025 12:04:29 -0500 Subject: [PATCH 2/3] comment out stability doc --- docs/pages.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages.jl b/docs/pages.jl index bc77aaf459..bbc977797c 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -40,7 +40,7 @@ pages = Any[ "Steady state analysis" => Any[ "steady_state_functionality/homotopy_continuation.md", "steady_state_functionality/nonlinear_solve.md", - "steady_state_functionality/steady_state_stability_computation.md", + # "steady_state_functionality/steady_state_stability_computation.md", "steady_state_functionality/bifurcation_diagrams.md", "steady_state_functionality/dynamical_systems.md" ], From 5c97cc00d2b1a6c423191f43c4707d2f24eb1f80 Mon Sep 17 00:00:00 2001 From: vyudu Date: Thu, 9 Jan 2025 12:52:10 -0500 Subject: [PATCH 3/3] up --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 92fdb42784..adbf3e8561 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -29,7 +29,7 @@ etc). - Models can be [coupled with events](@ref constraint_equations_events) that affect the system and its state during simulations. - By leveraging ModelingToolkit, users have a variety of options for generating optimized system representations to use in solvers. These include construction of [dense or sparse Jacobians](@ref ode_simulation_performance_sparse_jacobian), [multithreading or parallelization of generated derivative functions](@ref ode_simulation_performance_parallelisation), [automatic classification of reactions into optimized jump types for Gillespie type simulations](https://docs.sciml.ai/JumpProcesses/stable/jump_types/#jump_types), [automatic construction of dependency graphs for jump systems](https://docs.sciml.ai/JumpProcesses/stable/jump_types/#Jump-Aggregators-Requiring-Dependency-Graphs), and more. - [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) symbolic expressions and Julia `Expr`s can be obtained for all rate laws and functions determining the deterministic and stochastic terms within resulting ODE, SDE, or jump models. -- [Steady states](@ref homotopy_continuation) (and their [stabilities](@ref steady_state_stability)) can be computed for model ODE representations. +- [Steady states](@ref homotopy_continuation) can be computed for model ODE representations. #### [Features of Catalyst composing with other packages](@id doc_index_features_composed) - [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) Can be used to numerically solve generated reaction rate equation ODE models.