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
ifany(!ModelingToolkit.isparameter(var) for var in ModelingToolkit.get_variables(rate))
33
+
error("TransportReaction rate contain variables: $(filter(var ->!ModelingToolkit.isparameter(var), ModelingToolkit.get_variables(rate))). The rate must consist of parameters only.")
# Checks that the species exist in the reaction system (ODE simulation code becomes difficult if this is not required, as non-spatial jacobian and f function generated from rs is of wrong size).
80
-
any(isequal(tr.species), species(rs)) ||error("Currently, species used in TransportReactions must have previously been declared within the non-spatial ReactionSystem. This is not the case for $(tr.species).")
82
+
# Checks that the species exist in the reaction system.
83
+
# (ODE simulation code becomes difficult if this is not required, as non-spatial jacobian and f function generated from rs is of wrong size).
84
+
if!any(isequal(tr.species), species(rs))
85
+
error("Currently, species used in TransportReactions must have previously been declared within the non-spatial ReactionSystem. This is not the case for $(tr.species).")
86
+
end
87
+
81
88
# Checks that the rate does not depend on species.
82
-
isempty(intersect(ModelingToolkit.getname.(species(rs)), ModelingToolkit.getname.(Symbolics.get_variables(tr.rate)))) ||error("The following species were used in rates of a transport reactions: $(setdiff(ModelingToolkit.getname.(species(rs)), ModelingToolkit.getname.(Symbolics.get_variables(tr.rate)))).")
error("The following species were used in rates of a transport reactions: $(setdiff(ModelingToolkit.getname.(species(rs)), ModelingToolkit.getname.(Symbolics.get_variables(tr.rate)))).")
91
+
end
92
+
83
93
# Checks that the species does not exist in the system with different metadata.
84
-
any([isequal(tr.species, s) &&!isequivalent(tr.species, s) for s inspecies(rs)]) &&error("A transport reaction used a species, $(tr.species), with metadata not matching its lattice reaction system. Please fetch this species from the reaction system and used in transport reaction creation.")
85
-
any([isequal(rs_p, tr_p) &&!equivalent_metadata(rs_p, tr_p) for rs_p inparameters(rs), tr_p in Symbolics.get_variables(tr.rate)]) &&error("A transport reaction used a parameter with metadata not matching its lattice reaction system. Please fetch this parameter from the reaction system and used in transport reaction creation.")
94
+
ifany([isequal(tr.species, s) &&!isequivalent(tr.species, s) for s inspecies(rs)])
95
+
error("A transport reaction used a species, $(tr.species), with metadata not matching its lattice reaction system. Please fetch this species from the reaction system and used in transport reaction creation.")
96
+
end
97
+
ifany([isequal(rs_p, tr_p) &&!equivalent_metadata(rs_p, tr_p) for rs_p inparameters(rs), tr_p in Symbolics.get_variables(tr.rate)])
98
+
error("A transport reaction used a parameter with metadata not matching its lattice reaction system. Please fetch this parameter from the reaction system and used in transport reaction creation.")
99
+
end
100
+
86
101
# Checks that no edge parameter occur among rates of non-spatial reactions.
87
-
any([!isempty(intersect(Symbolics.get_variables(r.rate), edge_parameters)) for r inreactions(rs)]) &&error("Edge paramter(s) were found as a rate of a non-spatial reaction.")
102
+
ifany([!isempty(intersect(Symbolics.get_variables(r.rate), edge_parameters)) for r inreactions(rs)])
103
+
error("Edge paramter(s) were found as a rate of a non-spatial reaction.")
0 commit comments