Skip to content

Commit c9aa902

Browse files
make test a little simpler
the test was failing because the rate could go negative since u[2] could go negative, and this would make tstops go back in time giving an error. This is because the model is nonsensical, not the solver.
1 parent 1980fed commit c9aa902

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/variable_rate_reactions.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using DiffEqBiological, DiffEqJump, DiffEqBase, OrdinaryDiffEq, StochasticDiffEq
2+
using Base.Test
23

34
r1 = VariableRateReaction(1e-4,(1,2),((1,-1),(2,1)))
45
r2 = VariableRateReaction(0.01,[2],[(2,-1),(3,1)])
@@ -45,10 +46,10 @@ jump_prob = GillespieProblem(prob,Direct(),r1,r2,r3)
4546
sol = solve(jump_prob,Tsit5())
4647

4748
g = function (t,u,du)
48-
du[4] = 0.1u[4]
49+
du[4] = 0.05u[4]
4950
end
5051

51-
srand(330)
52+
srand(331)
5253
println("Turn Gillespie Problem into SDE")
5354
prob = SDEProblem(f,g,[999.0,3.0,0.0,1.0],(0.0,250.0))
5455
jump_prob = GillespieProblem(prob,Direct(),r1,r2,r3)
@@ -59,5 +60,6 @@ println("Now mix constant rate reactions")
5960
r1 = Reaction(1e-4,(1,2),((1,-1),(2,1)))
6061
r2 = Reaction(0.01,[2],[(2,-1),(3,1)])
6162
jump_prob = GillespieProblem(prob,Direct(),r1,r2,r3)
62-
sol = solve(jump_prob,SRIW1())
63+
integrator = init(jump_prob,SRIW1())
64+
solve!(integrator)
6365
@test 650 <= sol[end][3] <= 1500

0 commit comments

Comments
 (0)