@@ -131,11 +131,16 @@ function assemble_jumps(rs)
131
131
push! (affect,var2op (spec) ~ var2op (spec) + stoich)
132
132
end
133
133
if any (isequal .(var2op (rs. iv),get_variables (rx. rate)))
134
+ println (" Var Jump" )
134
135
push! (eqs,VariableRateJump (rl,affect))
135
136
elseif any ([isequal (state,r_op) for state in rs. states, r_op in getfield .(get_variables (rx. rate),:op )])
137
+ println (" Const" )
136
138
push! (eqs,ConstantRateJump (rl,affect))
137
139
else
138
- push! (eqs,ConstantRateJump (rl,affect))
140
+ reactant_stoch = Pair .(var2op .(getfield .(rx. substrates,:op )),rx. substoich)
141
+ println (" MA Jump" )
142
+ net_stoch = isempty (rx. substoich) ? [0 => 1 ] : map (p -> Pair (var2op (p[1 ]),p[2 ]),rx. netstoich)
143
+ push! (eqs,MassActionJump (rx. rate, reactant_stoch, net_stoch))
139
144
end
140
145
end
141
146
eqs
145
150
# The former geenrates a "MethodError: objects of type Int64 are not callable" when trying to solve the problem.
146
151
function jumpratelaw (rx)
147
152
@unpack rate, substrates, substoich, only_use_rate = rx
148
- rl = rate
153
+ rl = deepcopy (rate)
154
+ foreach (op -> substitute_expr! (rl,op=> var2op (op. op)), get_variables (rx. rate))
149
155
if ! only_use_rate
150
156
coef = one (eltype (substoich))
151
157
for (i,stoich) in enumerate (substoich)
0 commit comments