From 97b684281ec1c77854dc5998d31bfa1d27106265 Mon Sep 17 00:00:00 2001 From: Torkel Date: Tue, 21 May 2024 20:18:17 -0400 Subject: [PATCH] up --- src/reaction.jl | 13 +++++-------- test/reactionsystem_core/reactionsystem.jl | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/reaction.jl b/src/reaction.jl index bf0ee38326..7df046a9b8 100644 --- a/src/reaction.jl +++ b/src/reaction.jl @@ -194,14 +194,11 @@ function Reaction(rate, subs::Vector, prods::Vector, substoich::Vector{S}, prods end # Computes the net stoichiometries. - netstoich = if isnothing(netstoich) - get_netstoich(subs, prods, substoich, prodstoich) - else - if typeof(netstoich) != Vector{Pair{BasicSymbolic{Real}, stoich_type}} - netstoich = Pair{BasicSymbolic{Real}, stoich_type}[ - value(ns[1]) => convert(stoich_type, ns[2]) for ns in netstoich] - end - netstoich + if isempty(netstoich) + netstoich = get_netstoich(subs, prods, substoich, prodstoich) + elseif typeof(netstoich) != Vector{Pair{BasicSymbolic{Real}, stoich_type}} + netstoich = Pair{BasicSymbolic{Real}, stoich_type}[ + value(ns[1]) => convert(stoich_type, ns[2]) for ns in netstoich] end # Handles metadata (check that all entries are unique, remove potential `only_use_rate` diff --git a/test/reactionsystem_core/reactionsystem.jl b/test/reactionsystem_core/reactionsystem.jl index 2bdb3df42e..8de10f393b 100644 --- a/test/reactionsystem_core/reactionsystem.jl +++ b/test/reactionsystem_core/reactionsystem.jl @@ -142,7 +142,6 @@ end ### Check ODE, SDE, and Jump Functions ### # Test by evaluating drift and diffusion terms. - let u = rnd_u0(rs, rng) p = rnd_ps(rs, rng)