Skip to content

Commit 4239be9

Browse files
committed
- convert(JumpSystem,rn:ReactionSystem) should now work.
- Binomials should be used occrectly in Constant and Varriable RateJumps.
1 parent 61aa190 commit 4239be9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/systems/reaction/reactionsystem.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,13 @@ end
148148
function jumpratelaw(rx)
149149
@unpack rate, substrates, substoich, only_use_rate = rx
150150
rl = deepcopy(rate)
151-
foreach(op -> substitute_expr!(rl,op=>var2op(op.op)), get_variables(rx.rate))
151+
for op in get_variables(rx.rate)
152+
rl = substitute_expr!(rl,op=>var2op(op.op))
153+
end
152154
if !only_use_rate
153-
coef = one(eltype(substoich))
154155
for (i,stoich) in enumerate(substoich)
155-
coef *= factorial(stoich)
156-
rl *= isone(stoich) ? var2op(substrates[i].op) : var2op(substrates[i].op)^stoich
156+
rl *= isone(stoich) ? var2op(substrates[i].op) : Operation(binomial,[var2op(substrates[i].op),stoich])
157157
end
158-
(!isone(coef)) && (rl /= coef)
159158
end
160159
rl
161160
end

0 commit comments

Comments
 (0)