226
226
function var2op (var)
227
227
Sym {symtype(var)} (nameof (var. op))
228
228
end
229
+ function var2op (var:: Sym )
230
+ var
231
+ end
229
232
230
233
# Calculate the Jump rate law (like ODE, but uses X instead of X(t).
231
234
# The former generates a "MethodError: objects of type Int64 are not callable" when trying to solve the problem.
@@ -300,9 +303,10 @@ function ismassaction(rx, rs; rxvars = get_variables(rx.rate),
300
303
stateset = Set (states (rs)))
301
304
# if no dependencies must be zero order
302
305
(length (rxvars)== 0 ) && return true
303
- (haveivdep || rx. only_use_rate) && return false
306
+ haveivdep && return false
307
+ rx. only_use_rate && return false
304
308
@inbounds for i = 1 : length (rxvars)
305
- (rxvars[i]. op in stateset) && return false
309
+ (rxvars[i] in stateset) && return false
306
310
end
307
311
return true
308
312
end
@@ -327,20 +331,24 @@ function assemble_jumps(rs; combinatoric_ratelaws=true)
327
331
meqs = MassActionJump[]; ceqs = ConstantRateJump[]; veqs = VariableRateJump[]
328
332
stateset = Set (states (rs))
329
333
# rates = []; rstoich = []; nstoich = []
330
- rxvars = Operation []
334
+ rxvars = []
331
335
ivname = rs. iv. name
332
336
333
337
isempty (equations (rs)) && error (" Must give at least one reaction before constructing a JumpSystem." )
334
338
for rx in equations (rs)
335
339
empty! (rxvars)
336
- (rx. rate isa Operation) && get_variables! (rxvars, rx. rate)
340
+ @show rx. rate
341
+ @show typeof (rx. rate)
342
+ (rx. rate isa Term) && get_variables! (rxvars, rx. rate)
337
343
haveivdep = false
338
344
@inbounds for i = 1 : length (rxvars)
339
- if rxvars[i]. op . name == ivname
345
+ if isequal ( rxvars[i], rs . iv)
340
346
haveivdep = true
341
347
break
342
348
end
343
349
end
350
+ @show rx. rate
351
+ @show haveivdep
344
352
if ismassaction (rx, rs; rxvars= rxvars, haveivdep= haveivdep, stateset= stateset)
345
353
push! (meqs, makemajump (rx, combinatoric_ratelaw= combinatoric_ratelaws))
346
354
else
@@ -520,11 +528,11 @@ end
520
528
521
529
# determine which species a reaction depends on
522
530
function get_variables! (deps:: Set , rx:: Reaction , variables)
523
- (rx. rate isa Operation ) && get_variables! (deps, rx. rate, variables)
531
+ (rx. rate isa Term ) && get_variables! (deps, rx. rate, variables)
524
532
for s in rx. substrates
525
533
push! (deps, s)
526
534
end
527
- deps
535
+ @show deps
528
536
end
529
537
530
538
# determine which species a reaction modifies
0 commit comments