|
215 | 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.
|
216 | 216 | """
|
217 | 217 | function fluxmat(rn::ReactionSystem, pmap::Dict = Dict(); sparse=false)
|
| 218 | + deps = Set() |
| 219 | + for (i, rx) in enumerate(reactions(rn)) |
| 220 | + empty!(deps) |
| 221 | + get_variables!(deps, rx.rate, species(rn)) |
| 222 | + (!isempty(deps)) && (error("Reaction $rx's rate constant depends on species $(join(deps, ", ")). `adjacencymat` cannot support rate constants of this form.")) |
| 223 | + end |
| 224 | + |
218 | 225 | rates = if isempty(pmap)
|
219 | 226 | reactionrates(rn)
|
220 | 227 | else
|
@@ -290,6 +297,10 @@ function massactionvector(rn::ReactionSystem, scmap::Dict = Dict(); combinatoric
|
290 | 297 | rxs = reactions(rn)
|
291 | 298 | sm = speciesmap(rn)
|
292 | 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 | + |
293 | 304 | specs = if isempty(scmap)
|
294 | 305 | species(rn)
|
295 | 306 | else
|
@@ -1001,7 +1012,6 @@ function iscomplexbalanced(rs::ReactionSystem, parametermap::Dict; sparse = fals
|
1001 | 1012 | error("The supplied ReactionSystem has reactions that are not ismassaction. Testing for being complex balanced is currently only supported for pure mass action networks.")
|
1002 | 1013 | end
|
1003 | 1014 |
|
1004 |
| - L = laplacianmat(rs, parametermap; sparse) |
1005 | 1015 | D = incidencemat(rs; sparse)
|
1006 | 1016 | S = netstoichmat(rs; sparse)
|
1007 | 1017 |
|
@@ -1053,6 +1063,13 @@ end
|
1053 | 1063 | - In `adjacencymat`, the rows and columns both represent complexes, and an entry (c1, c2) is non-zero if there is a reaction c1 --> c2.
|
1054 | 1064 | """
|
1055 | 1065 | function adjacencymat(rn::ReactionSystem, pmap::Dict = Dict(); sparse = false)
|
| 1066 | + deps = Set() |
| 1067 | + for (i, rx) in enumerate(reactions(rn)) |
| 1068 | + empty!(deps) |
| 1069 | + get_variables!(deps, rx.rate, species(rn)) |
| 1070 | + (!isempty(deps)) && (error("Reaction $rx's rate constant depends on species $(join(deps, ", ")). `adjacencymat` cannot support rate constants of this form.")) |
| 1071 | + end |
| 1072 | + |
1056 | 1073 | rates = if isempty(pmap)
|
1057 | 1074 | reactionrates(rn)
|
1058 | 1075 | else
|
|
0 commit comments