import tellurium as te
import roadrunner
r = te.loada("""
S1 -> S2; k1*S1
S1 = 1; S2 = 0; k1 = 0.1
""")
currentTime = 0
for i in range (1,10):
currentTime = r.oneStep(currentTime, 0.5)
print currentTime
currentTime = 0
r.S1 = 1
r.S2 = 0
for i in range (1,10):
currentTime = r.oneStep(currentTime, 0.5)
print currentTime
RuntimeError: CVODE Error: CV_ILL_INPUT: One of the inputs to CVode is illegal. This includes the situation when a component of the error weight vectors becomes < 0 during internal time-stepping. It also includes the situation where a root of one of the root functions was found both at t0 and very near t0. The ILL_INPUT flag will also be returned if the linear solver routine CV--- (called by the user after calling CVodeCreate) failed to set one of the linear solver-related fields in cvode_mem or if the linear solver's init routine failed. In any case, the user should see the printed error message for more details.; In ?integrate@CVODEIntegrator@rr@@UAENNN@Z
However, putting r.reset() between two for loops solve the issue.
Looking at the call to simulate, Integrator::restart is always called before every CVODE integration. Adding it to RoadRunner::oneStep fixes the issue.
Following code raises error:
RuntimeError: CVODE Error: CV_ILL_INPUT: One of the inputs to CVode is illegal. This includes the situation when a component of the error weight vectors becomes < 0 during internal time-stepping. It also includes the situation where a root of one of the root functions was found both at t0 and very near t0. The ILL_INPUT flag will also be returned if the linear solver routine CV--- (called by the user after calling CVodeCreate) failed to set one of the linear solver-related fields in cvode_mem or if the linear solver's init routine failed. In any case, the user should see the printed error message for more details.; In ?integrate@CVODEIntegrator@rr@@UAENNN@Z
However, putting r.reset() between two for loops solve the issue.