@@ -260,9 +260,7 @@ Notes:
260
260
function jumpratelaw (rx; rxvars= get_variables (rx. rate), combinatoric_ratelaw= true )
261
261
@unpack rate, substrates, substoich, only_use_rate = rx
262
262
rl = rate
263
- for op in rxvars
264
- rl = substitute (rl, op => var2op (op))
265
- end
263
+ rl = substitute (rl, Dict (rxvars .=> var2op .(rxvars)))
266
264
if ! only_use_rate
267
265
coef = one (eltype (substoich))
268
266
for (i,stoich) in enumerate (substoich)
@@ -299,7 +297,7 @@ explicitly on the independent variable (usually time).
299
297
- Optional: `stateset`, set of states which if the rxvars are within mean rx is non-mass action.
300
298
"""
301
299
function ismassaction (rx, rs; rxvars = get_variables (rx. rate),
302
- haveivdep = any (var -> isequal (rs . iv, convert (Variable,var)), rxvars) ,
300
+ haveivdep,
303
301
stateset = Set (states (rs)))
304
302
# if no dependencies must be zero order
305
303
(length (rxvars)== 0 ) && return true
@@ -316,13 +314,13 @@ end
316
314
zeroorder = (length (substoich) == 0 )
317
315
reactant_stoch = Vector {Pair{Any,eltype(substoich)}} (undef, length (substoich))
318
316
@inbounds for i = 1 : length (reactant_stoch)
319
- reactant_stoch[i] = var2op ( substrates[i]) => substoich[i]
317
+ reactant_stoch[i] = substrates[i] => substoich[i]
320
318
end
321
319
# push!(rstoich, reactant_stoch)
322
320
coef = (zeroorder || (! combinatoric_ratelaw)) ? one (eltype (substoich)) : prod (stoich -> factorial (stoich), substoich)
323
321
(! isone (coef)) && (rate /= coef)
324
322
# push!(rates, rate)
325
- net_stoch = [Pair (var2op ( p[1 ]) ,p[2 ]) for p in netstoich]
323
+ net_stoch = [Pair (p[1 ],p[2 ]) for p in netstoich]
326
324
# push!(nstoich, net_stoch)
327
325
MassActionJump (Num (rate), reactant_stoch, net_stoch, scale_rates= false , useiszero= false )
328
326
end
@@ -337,18 +335,14 @@ function assemble_jumps(rs; combinatoric_ratelaws=true)
337
335
isempty (equations (rs)) && error (" Must give at least one reaction before constructing a JumpSystem." )
338
336
for rx in equations (rs)
339
337
empty! (rxvars)
340
- @show rx. rate
341
- @show typeof (rx. rate)
342
- (rx. rate isa Term) && get_variables! (rxvars, rx. rate)
338
+ (rx. rate isa Symbolic) && get_variables! (rxvars, rx. rate)
343
339
haveivdep = false
344
340
@inbounds for i = 1 : length (rxvars)
345
341
if isequal (rxvars[i], rs. iv)
346
342
haveivdep = true
347
343
break
348
344
end
349
345
end
350
- @show rx. rate
351
- @show haveivdep
352
346
if ismassaction (rx, rs; rxvars= rxvars, haveivdep= haveivdep, stateset= stateset)
353
347
push! (meqs, makemajump (rx, combinatoric_ratelaw= combinatoric_ratelaws))
354
348
else
0 commit comments