Skip to content

Commit 0929823

Browse files
committed
scale reaction rates in reaction system conversion
1 parent c979972 commit 0929823

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/systems/reaction/reactionsystem.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,10 @@ function assemble_jumps(rs)
244244
haveivdep = any(var -> isequal(rs.iv,convert(Variable,var)), rxvars)
245245
if ismassaction(rx, rs; rxvars=rxvars, haveivdep=haveivdep)
246246
reactant_stoch = isempty(rx.substoich) ? [0 => 1] : [var2op(sub.op) => stoich for (sub,stoich) in zip(rx.substrates,rx.substoich)]
247+
coef = isempty(rx.substoich) ? one(eltype(rx.substoich)) : prod(stoich -> factorial(stoich), rx.substoich)
248+
rate = isone(coef) ? rx.rate : rx.rate/coef
247249
net_stoch = [Pair(var2op(p[1]),p[2]) for p in rx.netstoich]
248-
push!(eqs, MassActionJump(rx.rate, reactant_stoch, net_stoch))
250+
push!(eqs, MassActionJump(rate, reactant_stoch, net_stoch, scale_rates=false))
249251
else
250252
rl = jumpratelaw(rx, rxvars=rxvars)
251253
affect = Vector{Equation}()

0 commit comments

Comments
 (0)