Skip to content

Commit 0013818

Browse files
authored
Merge pull request #1205 from SciML/remove_catalyst_prob_symbol_handling
Use MTK's symbol handling
2 parents ba1e715 + fdabb28 commit 0013818

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

src/reactionsystem_conversions.jl

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,6 @@ function DiffEqBase.ODEProblem(rs::ReactionSystem, u0, tspan,
710710
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
711711
include_zero_odes = true, remove_conserved = false, remove_conserved_warn = true,
712712
checks = false, structural_simplify = false, kwargs...)
713-
u0map = symmap_to_varmap(rs, u0)
714-
pmap = symmap_to_varmap(rs, p)
715713
osys = convert(ODESystem, rs; name, combinatoric_ratelaws, include_zero_odes, checks,
716714
remove_conserved, remove_conserved_warn)
717715

@@ -724,7 +722,7 @@ function DiffEqBase.ODEProblem(rs::ReactionSystem, u0, tspan,
724722
osys = complete(osys)
725723
end
726724

727-
return ODEProblem(osys, u0map, tspan, pmap, args...; check_length, kwargs...)
725+
return ODEProblem(osys, u0, tspan, p, args...; check_length, kwargs...)
728726
end
729727

730728
# NonlinearProblem from AbstractReactionNetwork
@@ -734,12 +732,10 @@ function DiffEqBase.NonlinearProblem(rs::ReactionSystem, u0,
734732
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
735733
remove_conserved = false, remove_conserved_warn = true, checks = false,
736734
check_length = false, all_differentials_permitted = false, kwargs...)
737-
u0map = symmap_to_varmap(rs, u0)
738-
pmap = symmap_to_varmap(rs, p)
739735
nlsys = convert(NonlinearSystem, rs; name, combinatoric_ratelaws, include_zero_odes,
740736
checks, all_differentials_permitted, remove_conserved, remove_conserved_warn)
741737
nlsys = complete(nlsys)
742-
return NonlinearProblem(nlsys, u0map, pmap, args...; check_length,
738+
return NonlinearProblem(nlsys, u0, p, args...; check_length,
743739
kwargs...)
744740
end
745741

@@ -749,8 +745,6 @@ function DiffEqBase.SDEProblem(rs::ReactionSystem, u0, tspan,
749745
name = nameof(rs), combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
750746
include_zero_odes = true, checks = false, check_length = false, remove_conserved = false,
751747
remove_conserved_warn = true, structural_simplify = false, kwargs...)
752-
u0map = symmap_to_varmap(rs, u0)
753-
pmap = symmap_to_varmap(rs, p)
754748
sde_sys = convert(SDESystem, rs; name, combinatoric_ratelaws,
755749
include_zero_odes, checks, remove_conserved, remove_conserved_warn)
756750

@@ -764,7 +758,7 @@ function DiffEqBase.SDEProblem(rs::ReactionSystem, u0, tspan,
764758
end
765759

766760
p_matrix = zeros(length(get_unknowns(sde_sys)), numreactions(rs))
767-
return SDEProblem(sde_sys, u0map, tspan, pmap, args...; check_length,
761+
return SDEProblem(sde_sys, u0, tspan, p, args...; check_length,
768762
noise_rate_prototype = p_matrix, kwargs...)
769763
end
770764

@@ -784,8 +778,8 @@ struct JumpInputs{S <: MT.JumpSystem, T <: SciMLBase.AbstractODEProblem}
784778
end
785779

786780
"""
787-
jumpinput = JumpInputs(rs::ReactionSystem, u0map, tspan,
788-
pmap = DiffEqBase.NullParameters;
781+
jumpinput = JumpInputs(rs::ReactionSystem, u0, tspan,
782+
p = DiffEqBase.NullParameters;
789783
name = nameof(rs),
790784
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
791785
checks = false, kwargs...)
@@ -817,13 +811,11 @@ plot(sol, idxs = :A)
817811
function JumpInputs(rs::ReactionSystem, u0, tspan, p = DiffEqBase.NullParameters();
818812
name = nameof(rs), combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
819813
checks = false, kwargs...)
820-
u0map = symmap_to_varmap(rs, u0)
821-
pmap = symmap_to_varmap(rs, p)
822814
jsys = complete(convert(JumpSystem, rs; name, combinatoric_ratelaws, checks))
823815
if MT.has_variableratejumps(jsys)
824-
prob = ODEProblem(jsys, u0map, tspan, pmap; kwargs...)
816+
prob = ODEProblem(jsys, u0, tspan, p; kwargs...)
825817
else
826-
prob = DiscreteProblem(jsys, u0map, tspan, pmap; kwargs...)
818+
prob = DiscreteProblem(jsys, u0, tspan, p; kwargs...)
827819
end
828820
JumpInputs(jsys, prob)
829821
end
@@ -847,11 +839,9 @@ function DiffEqBase.DiscreteProblem(rs::ReactionSystem, u0, tspan::Tuple,
847839
name = nameof(rs),
848840
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
849841
checks = false, kwargs...)
850-
u0map = symmap_to_varmap(rs, u0)
851-
pmap = symmap_to_varmap(rs, p)
852842
jsys = convert(JumpSystem, rs; name, combinatoric_ratelaws, checks)
853843
jsys = complete(jsys)
854-
return DiscreteProblem(jsys, u0map, tspan, pmap, args...; kwargs...)
844+
return DiscreteProblem(jsys, u0, tspan, p, args...; kwargs...)
855845
end
856846

857847
# JumpProblem from AbstractReactionNetwork
@@ -878,8 +868,6 @@ function DiffEqBase.SteadyStateProblem(rs::ReactionSystem, u0,
878868
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
879869
remove_conserved = false, remove_conserved_warn = true, include_zero_odes = true,
880870
checks = false, structural_simplify = false, kwargs...)
881-
u0map = symmap_to_varmap(rs, u0)
882-
pmap = symmap_to_varmap(rs, p)
883871
osys = convert(ODESystem, rs; name, combinatoric_ratelaws, include_zero_odes, checks,
884872
remove_conserved, remove_conserved_warn)
885873

@@ -892,7 +880,7 @@ function DiffEqBase.SteadyStateProblem(rs::ReactionSystem, u0,
892880
osys = complete(osys)
893881
end
894882

895-
return SteadyStateProblem(osys, u0map, pmap, args...; check_length, kwargs...)
883+
return SteadyStateProblem(osys, u0, p, args...; check_length, kwargs...)
896884
end
897885

898886
### Symbolic Variable/Symbol Conversions ###

0 commit comments

Comments
 (0)