@@ -91,12 +91,12 @@ function assemble_crj(js, crj, statetoid)
9191end
9292
9393function assemble_maj (js, maj:: MassActionJump{U,Vector{Pair{V,W}},Vector{Pair{V2,W2}}} ,
94- statetoid, parammap ) where {U,V,W,V2,W2}
94+ statetoid, subber ) where {U,V,W,V2,W2}
9595 sr = maj. scaled_rates
9696 if sr isa Operation
97- pval = simplify ( substitute (sr,parammap) ). value
97+ pval = subber (sr ). value
9898 elseif sr isa Variable
99- pval = Dict (parammap)[ sr ()]
99+ pval = subber ( sr ()) . value
100100 else
101101 pval = maj. scaled_rates
102102 end
@@ -167,7 +167,8 @@ function DiffEqJump.JumpProblem(js::JumpSystem, prob, aggregator; kwargs...)
167167 parammap = map ((x,y)-> Pair (x (),y), parameters (js), prob. p)
168168 eqs = equations (js)
169169
170- majs = MassActionJump[assemble_maj (js, j, statetoid, parammap) for j in eqs. x[1 ]]
170+ subber = substituter (first .(parammap), last .(parammap))
171+ majs = MassActionJump[assemble_maj (js, j, statetoid, subber) for j in eqs. x[1 ]]
171172 crjs = ConstantRateJump[assemble_crj (js, j, statetoid) for j in eqs. x[2 ]]
172173 vrjs = VariableRateJump[assemble_vrj (js, j, statetoid) for j in eqs. x[3 ]]
173174 ((prob isa DiscreteProblem) && ! isempty (vrjs)) && error (" Use continuous problems such as an ODEProblem or a SDEProblem with VariableRateJumps" )
@@ -210,4 +211,4 @@ function modified_states!(mstates, jump::MassActionJump, sts)
210211 for (state,stoich) in jump. net_stoch
211212 (state. op in sts) && push! (mstates, state)
212213 end
213- end
214+ end
0 commit comments