Skip to content

Commit f4d9b7b

Browse files
committed
equations are now supported, rather than throwing an error.
1 parent 7494d15 commit f4d9b7b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ext/CatalystHomotopyContinuationExtension/homotopy_continuation_extension.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ function Catalyst.hc_steady_states(rs::ReactionSystem, ps; filter_negative=true,
4343
end
4444

4545
# For a given reaction system, parameter values, and initial conditions, find the polynomial that HC solves to find steady states.
46-
function steady_state_polynomial(rs_in::ReactionSystem, ps, u0)
47-
any(!(eq isa Reaction) for eq in rs_in.eqs) && error("This feature is currently not supported for reaction systems containing (non-reaction) equations.")
48-
rs = @set rs_in.rxs = [Catalyst.expand_registered_functions(rx) for rx in rs_in.rxs]
46+
function steady_state_polynomial(rs::ReactionSystem, ps, u0)
47+
rs = expand_registered_functions(rs)
4948
ns = convert(NonlinearSystem, rs; remove_conserved = true)
5049
pre_varmap = [symmap_to_varmap(rs,u0)..., symmap_to_varmap(rs,ps)...]
5150
conservationlaw_errorcheck(rs, pre_varmap)

src/registered_functions.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ function expand_registered_functions(expr)
132132
end
133133
return expr
134134
end
135-
# If applied to a reaction, return a reaction with its rate modified.
135+
# If applied to a Reaction, return a reaction with its rate modified.
136136
function expand_registered_functions(rx::Reaction)
137137
Reaction(expand_registered_functions(rx.rate), rx.substrates, rx.products, rx.substoich, rx.prodstoich, rx.netstoich, rx.only_use_rate)
138138
end
139+
# If applied to a Equation, returns it with it applied to lhs and rhs
140+
function expand_registered_functions(eq::Equation)
141+
return expand_registered_functions(eq.lhs) ~ expand_registered_functions(eq.rhs)
142+
end
143+
# If applied to a ReactionSystem, applied function to all Reactions and other Equations, and return updated system.
144+
function expand_registered_functions(rs::ReactionSystem)
145+
@set rs.eqs = [Catalyst.expand_registered_functions(eq) for eq in rs.eqs]
146+
end

0 commit comments

Comments
 (0)