Skip to content

Commit f2c460c

Browse files
committed
add non-autonomous errors to bifurcation computations and homotopy continuation computation.
1 parent 3d4afd7 commit f2c460c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

ext/CatalystBifurcationKitExtension/bifurcation_kit_extension.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Creates a BifurcationProblem, using a ReactionSystem as an input.
44
function BK.BifurcationProblem(rs::ReactionSystem, u0_bif, ps, bif_par, args...;
55
plot_var=nothing, record_from_solution=BK.record_sol_default, jac=true, u0=[], kwargs...)
6+
is_autonomous(rs) || error("Attempting to compute steady state for non-autonomous system (e.g. does some rate depend on $(rs.iv)?), this is not possible.")
67

78
# Converts symbols to symbolics.
89
(bif_par isa Symbol) && (bif_par = ModelingToolkit.get_var_to_name(rs)[bif_par])

ext/CatalystHomotopyContinuationExtension/homotopy_continuation_extension.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Notes:
3636
```
3737
"""
3838
function Catalyst.hc_steady_states(rs::ReactionSystem, ps; filter_negative=true, neg_thres=-1e-20, u0=[], kwargs...)
39+
is_autonomous(rs) || error("Attempting to compute steady state for non-autonomous system (e.g. does some rate depend on $(rs.iv)?), this is not possible.")
3940
ss_poly = steady_state_polynomial(rs, ps, u0)
4041
sols = HC.real_solutions(HC.solve(ss_poly; kwargs...))
4142
reorder_sols!(sols, ss_poly, rs)

test/extensions/homotopy_continuation.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,13 @@ let
138138

139139
# Computes bifurcation diagram.
140140
@test_throws Exception hc_steady_states(incomplete_network, p_start)
141+
end
142+
143+
# Tests that non-autonomous system throws an error
144+
let
145+
rs = @reaction_network begin
146+
(k,t), 0 <--> X
147+
end
148+
ps = [k => 1.0]
149+
@test_throws Exception hc_steady_states(rs, ps)
141150
end

0 commit comments

Comments
 (0)