Skip to content

Commit

Permalink
use vector conservation law constant in ps only
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsas committed Feb 18, 2025
1 parent 82ecb25 commit 7005533
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/network_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ function cache_conservationlaw_eqs!(rn::ReactionSystem, N::AbstractMatrix, col_o
nps.depspecs = Set(depspecs)
nps.conservedeqs = conservedeqs
nps.constantdefs = constantdefs
nps.conservedconst = constants

nothing
end
Expand Down
2 changes: 2 additions & 0 deletions src/reactionsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Base.@kwdef mutable struct NetworkProperties{I <: Integer, V <: BasicSymbolic{Re
depspecs::Set{V} = Set{V}()
conservedeqs::Vector{Equation} = Equation[]
constantdefs::Vector{Equation} = Equation[]
conservedconst::BasicSymbolic{Real} = only(@parameters __UNINITIALIZED)
speciesmap::Dict{V, Int} = Dict{V, Int}()
complextorxsmap::OrderedDict{ReactionComplex{Int}, Vector{Pair{Int, Int}}} = OrderedDict{ReactionComplex{Int},Vector{Pair{Int,Int}}}()
complexes::Vector{ReactionComplex{Int}} = Vector{ReactionComplex{Int}}(undef, 0)
Expand Down Expand Up @@ -126,6 +127,7 @@ function reset!(nps::NetworkProperties{I, V}) where {I, V}
empty!(nps.col_order)
nps.rank = 0
nps.nullity = 0
nps.conservedconst = only(@parameters __UNINITIALIZED)
empty!(nps.indepspecs)
empty!(nps.depspecs)
empty!(nps.conservedeqs)
Expand Down
5 changes: 1 addition & 4 deletions src/reactionsystem_conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,8 @@ function addconstraints!(eqs, rs::ReactionSystem, ists, ispcs; remove_conserved
nps = get_networkproperties(rs)

# add the conservation constants as parameters and set their values
ps = vcat(ps, collect(eq.lhs for eq in nps.constantdefs))
ps = push!(ps, nps.conservedconst)
defs = copy(MT.defaults(rs))
# for eq in nps.constantdefs
# defs[eq.lhs] = eq.rhs
# end

# add the dependent species as observed
obs = copy(MT.observed(rs))
Expand Down

0 comments on commit 7005533

Please sign in to comment.