You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -218,15 +215,20 @@ Base.one(::Type{Union{R, Symbolics.BasicSymbolic{Real}}}) where R <: Real = one(
218
215
**Warning**: Unlike other Catalyst functions, the `fluxmat` function will return a `Matrix{Num}` in the symbolic case. This is to allow easier computation of the matrix decomposition of the ODEs, and to ensure that multiplying the sparse form of the matrix will work.
(!isempty(deps)) && (error("Reaction $rx's rate constant depends on species $(join(deps, ", ")). `fluxmat` cannot support rate constants of this form."))
@@ -295,6 +297,10 @@ function massactionvector(rn::ReactionSystem, scmap::Dict = Dict(); combinatoric
295
297
rxs =reactions(rn)
296
298
sm =speciesmap(rn)
297
299
300
+
for rx in rxs
301
+
!ismassaction(rx, rn) &&error("The supplied ReactionSystem has non-mass action reaction $rx. The `massactionvector` can only be constructed for mass action networks.")
302
+
end
303
+
298
304
specs =ifisempty(scmap)
299
305
species(rn)
300
306
else
@@ -936,7 +942,7 @@ function isdetailedbalanced(rs::ReactionSystem, parametermap::Dict; abstol=0, re
error("Incorrect number of parameters specified.")
1005
-
end
1006
-
1007
-
pmap =symmap_to_varmap(rs, parametermap)
1008
-
pmap =Dict(ModelingToolkit.value(k) => v for (k, v) in pmap)
1009
1006
1010
-
sm =speciesmap(rs)
1011
-
cm =reactioncomplexmap(rs)
1012
-
complexes, D =reactioncomplexes(rs)
1007
+
Requires the specification of values for the parameters/rate constants. Accepts a dictionary, vector, or tuple of parameter-to-value mappings, e.g. [k1 => 1.0, k2 => 2.0,...].
error("The supplied ReactionSystem has reactions that are not ismassaction. Testing for being complex balanced is currently only supported for pure mass action networks.")
1020
1013
end
1021
1014
1022
-
rates = [substitute(rate, pmap) for rate inreactionrates(rs)]
1023
-
1024
-
# Construct kinetic matrix, K
1025
-
K =zeros(nr, nc)
1026
-
for c in1:nc
1027
-
complex = complexes[c]
1028
-
for (r, dir) in cm[complex]
1029
-
rxn = rxns[r]
1030
-
if dir ==-1
1031
-
K[r, c] = rates[r]
1032
-
end
1033
-
end
1034
-
end
1035
-
1036
-
L =-D * K
1037
-
S =netstoichmat(rs)
1015
+
D =incidencemat(rs; sparse)
1016
+
S =netstoichmat(rs; sparse)
1038
1017
1039
1018
# Compute ρ using the matrix-tree theorem
1040
1019
g =incidencematgraph(rs)
1041
-
R =ratematrix(rs, rates)
1020
+
R =adjacencymat(rs, parametermap; sparse)
1042
1021
ρ =matrixtree(g, R)
1043
1022
1044
1023
# Determine if 1) ρ is positive and 2) D^T Ln ρ lies in the image of S^T
@@ -1069,50 +1048,81 @@ function iscomplexbalanced(rs::ReactionSystem, parametermap)
(!isempty(deps)) && (error("Reaction $rx's rate constant depends on species $(join(deps, ", ")). `adjacencymat` cannot support rate constants of this form."))
0 commit comments