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
Constructively compute whether a kinetic system (a reaction network with a set of rate constants) will admit detailed-balanced equilibrium
744
+
solutions, using the Wegscheider conditions, [Feinberg, 1989](https://www.sciencedirect.com/science/article/pii/0009250989851243). A detailed-balanced solution is one for which the rate of every forward reaction exactly equals its reverse reaction. Accepts a dictionary, vector, or tuple of variable-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.")
753
+
end
754
+
755
+
isforestlike(rs) &&deficiency(rs) ==0&&returntrue
756
+
757
+
pmap =symmap_to_varmap(rs, parametermap)
758
+
pmap =Dict(ModelingToolkit.value(k) => v for (k, v) in pmap)
# Independent Cycle Conditions: for any cycle we create by adding in an out-of-forest reaction, the product of forward reaction rates over the cycle must equal the product of reverse reaction rates over the cycle.
770
+
for edge in outofforest_edges
771
+
g =SimpleGraph([spanning_forest..., edge])
772
+
ic = Graphs.cycle_basis(g)[1]
773
+
fwd =prod([K[ic[r], ic[r +1]] for r in1:(length(ic) -1)]) * K[ic[end], ic[1]]
774
+
rev =prod([K[ic[r +1], ic[r]] for r in1:(length(ic) -1)]) * K[ic[1], ic[end]]
# Spanning Forest Conditions: for non-deficiency 0 networks, we get an additional δ equations. Choose an orientation for each reaction pair in the spanning forest (we will take the one given by default from kruskal_mst).
779
+
780
+
ifdeficiency(rs) >0
781
+
rxn_idxs = [edgeindex(D, Graphs.src(e), Graphs.dst(e)) for e in spanning_forest]
Returns the matrix of a basis of cycles (or flux vectors), or a basis for reaction fluxes for which the system is at steady state.
904
995
These correspond to right eigenvectors of the stoichiometric matrix. Equivalent to [`fluxmodebasis`](@ref).
905
996
"""
906
-
907
997
functioncycles(rs::ReactionSystem)
908
998
nps =get_networkproperties(rs)
909
999
nsm =netstoichmat(rs)
@@ -938,7 +1028,6 @@ end
938
1028
939
1029
See documentation for [`cycles`](@ref).
940
1030
"""
941
-
942
1031
functionfluxvectors(rs::ReactionSystem)
943
1032
cycles(rs)
944
1033
end
@@ -950,7 +1039,6 @@ end
950
1039
951
1040
Check if a reaction network obeys the conditions of the deficiency one theorem, which ensures that there is only one equilibrium for every positive stoichiometric compatibility class.
error("The deficiency one theorem is only valid for reaction networks that are mass action.")
@@ -973,7 +1061,6 @@ end
973
1061
974
1062
Check if a reaction network obeys the conditions of the deficiency zero theorem, which ensures that there is only one equilibrium for every positive stoichiometric compatibility class, this equilibrium is asymptotically stable, and this equilibrium is complex balanced.
error("The deficiency zero theorem is only valid for reaction networks that are mass action.")
@@ -988,7 +1075,6 @@ end
988
1075
989
1076
Note: This function currently only works for networks of deficiency one, and is not currently guaranteed to return *all* the concentration-robust species in the network. Any species returned by the function will be robust, but this may not include all of them. Use with caution. Support for higher deficiency networks and necessary conditions for robustness will be coming in the future.
0 commit comments