@@ -97,9 +97,9 @@ Base.@kwdef mutable struct NetworkProperties{I <: Integer, V <: BasicSymbolic{Re
97
97
stronglinkageclasses:: Vector{Vector{Int}} = Vector {Vector{Int}} (undef, 0 )
98
98
terminallinkageclasses:: Vector{Vector{Int}} = Vector {Vector{Int}} (undef, 0 )
99
99
100
- checkedrobust:: Bool = false
100
+ checkedrobust:: Bool = false
101
101
robustspecies:: Vector{Int} = Vector {Int} (undef, 0 )
102
- deficiency:: Int = - 1
102
+ deficiency:: Int = - 1
103
103
end
104
104
# ! format: on
105
105
@@ -215,11 +215,11 @@ end
215
215
216
216
# ## ReactionSystem Structure ###
217
217
218
- """
218
+ """
219
219
WARNING!!!
220
220
221
- The following variable is used to check that code that should be updated when the `ReactionSystem`
222
- fields are updated has in fact been updated. Do not just blindly update this without first checking
221
+ The following variable is used to check that code that should be updated when the `ReactionSystem`
222
+ fields are updated has in fact been updated. Do not just blindly update this without first checking
223
223
all such code and updating it appropriately (e.g. serialization). Please use a search for
224
224
`reactionsystem_fields` throughout the package to ensure all places which should be updated, are updated.
225
225
"""
@@ -318,7 +318,7 @@ struct ReactionSystem{V <: NetworkProperties} <:
318
318
"""
319
319
discrete_events:: Vector{MT.SymbolicDiscreteCallback}
320
320
"""
321
- Metadata for the system, to be used by downstream packages.
321
+ Metadata for the system, to be used by downstream packages.
322
322
"""
323
323
metadata:: Any
324
324
"""
@@ -480,10 +480,10 @@ function ReactionSystem(iv; kwargs...)
480
480
ReactionSystem (Reaction[], iv, [], []; kwargs... )
481
481
end
482
482
483
- # Called internally (whether DSL-based or programmatic model creation is used).
483
+ # Called internally (whether DSL-based or programmatic model creation is used).
484
484
# Creates a sorted reactions + equations vector, also ensuring reaction is first in this vector.
485
- # Extracts potential species, variables, and parameters from the input (if not provided as part of
486
- # the model creation) and creates the corresponding vectors.
485
+ # Extracts potential species, variables, and parameters from the input (if not provided as part of
486
+ # the model creation) and creates the corresponding vectors.
487
487
# While species are ordered before variables in the unknowns vector, this ordering is not imposed here,
488
488
# but carried out at a later stage.
489
489
function make_ReactionSystem_internal (rxs_and_eqs:: Vector , iv, us_in, ps_in;
@@ -495,7 +495,7 @@ function make_ReactionSystem_internal(rxs_and_eqs::Vector, iv, us_in, ps_in;
495
495
any (in (obs_vars), us_in) &&
496
496
error (" Found an observable in the list of unknowns. This is not allowed." )
497
497
498
- # Creates a combined iv vector (iv and sivs). This is used later in the function (so that
498
+ # Creates a combined iv vector (iv and sivs). This is used later in the function (so that
499
499
# independent variables can be excluded when encountered quantities are added to `us` and `ps`).
500
500
t = value (iv)
501
501
ivs = Set ([t])
@@ -524,6 +524,8 @@ function make_ReactionSystem_internal(rxs_and_eqs::Vector, iv, us_in, ps_in;
524
524
# Extracts any species, variables, and parameters that occur in (non-reaction) equations.
525
525
# Creates the new reactions + equations vector, `fulleqs` (sorted reactions first, equations next).
526
526
if ! isempty (eqs)
527
+ println (eqs)
528
+ println (iv)
527
529
osys = ODESystem (eqs, iv; name = gensym ())
528
530
fulleqs = CatalystEqType[rxs; equations (osys)]
529
531
union! (us, unknowns (osys))
@@ -560,7 +562,7 @@ function make_ReactionSystem_internal(rxs_and_eqs::Vector, iv, us_in, ps_in;
560
562
end
561
563
psv = collect (new_ps)
562
564
563
- # Passes the processed input into the next `ReactionSystem` call.
565
+ # Passes the processed input into the next `ReactionSystem` call.
564
566
ReactionSystem (fulleqs, t, usv, psv; spatial_ivs, continuous_events,
565
567
discrete_events, observed, kwargs... )
566
568
end
@@ -1062,8 +1064,8 @@ end
1062
1064
1063
1065
# ## General `ReactionSystem`-specific Functions ###
1064
1066
1065
- # Checks if the `ReactionSystem` structure have been updated without also updating the
1066
- # `reactionsystem_fields` constant. If this is the case, returns `false`. This is used in
1067
+ # Checks if the `ReactionSystem` structure have been updated without also updating the
1068
+ # `reactionsystem_fields` constant. If this is the case, returns `false`. This is used in
1067
1069
# certain functionalities which would break if the `ReactionSystem` structure is updated without
1068
1070
# also updating these functionalities.
1069
1071
function reactionsystem_uptodate_check ()
@@ -1241,7 +1243,7 @@ end
1241
1243
# ## `ReactionSystem` Remaking ###
1242
1244
1243
1245
"""
1244
- remake_ReactionSystem_internal(rs::ReactionSystem;
1246
+ remake_ReactionSystem_internal(rs::ReactionSystem;
1245
1247
default_reaction_metadata::Vector{Pair{Symbol, T}} = Vector{Pair{Symbol, Any}}()) where {T}
1246
1248
1247
1249
Takes a `ReactionSystem` and remakes it, returning a modified `ReactionSystem`. Modifications depend
@@ -1274,7 +1276,7 @@ function set_default_metadata(rs::ReactionSystem; default_reaction_metadata = []
1274
1276
# Currently, `noise_scaling` is the only relevant metadata supported this way.
1275
1277
drm_dict = Dict (default_reaction_metadata)
1276
1278
if haskey (drm_dict, :noise_scaling )
1277
- # Finds parameters, species, and variables in the noise scaling term.
1279
+ # Finds parameters, species, and variables in the noise scaling term.
1278
1280
ns_expr = drm_dict[:noise_scaling ]
1279
1281
ns_syms = [Symbolics. unwrap (sym) for sym in get_variables (ns_expr)]
1280
1282
ns_ps = Iterators. filter (ModelingToolkit. isparameter, ns_syms)
@@ -1414,7 +1416,7 @@ function ModelingToolkit.compose(sys::ReactionSystem, systems::AbstractArray; na
1414
1416
MT. collect_scoped_vars! (newunknowns, newparams, ssys, iv)
1415
1417
end
1416
1418
1417
- if ! isempty (newunknowns)
1419
+ if ! isempty (newunknowns)
1418
1420
@set! sys. unknowns = union (get_unknowns (sys), newunknowns)
1419
1421
sort! (get_unknowns (sys), by = ! isspecies)
1420
1422
@set! sys. species = filter (isspecies, get_unknowns (sys))
0 commit comments