Skip to content

Commit 19346f8

Browse files
committed
Closing in
1 parent 5e7dbb9 commit 19346f8

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

qutip/solver/integrator/scipy_integrator.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,10 @@ def set_state(self, t, state0):
298298
self._size = state0.shape[0]
299299
if self._mat_state:
300300
state0 = _data.column_stack(state0)
301-
print(' --- HERE --- ')
302-
print(state0)
303-
print(state0.to_array().ravel().view(np.float64))
304301
self._ode_solver.set_initial_value(
305302
state0.to_array().ravel().view(np.float64),
306303
t
307304
)
308-
print(self._ode_solver._y)
309-
print(' --- --- ')
310305

311306
def _check_failed_integration(self):
312307
if self._ode_solver.successful():
@@ -413,6 +408,7 @@ def mcstep(self, t, copy=True):
413408
# a range in which the state at any time can be computed with
414409
# minimal work. We keep track of the range with _back[0] and _front.
415410
self._check_handle()
411+
print("mcstep: t=", t)
416412
if self._ode_solver.t == t:
417413
# Exact same `t` as the last call, nothing to do.
418414
pass
@@ -444,20 +440,29 @@ def _one_step(self, t):
444440
# `rhs` can cause exceptions to this, but _backstep catch those cases.
445441
safe_delta = self._ode_solver._integrator.rwork[11]/100 + 1e-15
446442
t_ode = self._ode_solver.t
443+
if t_ode > 0.16:
444+
print('one_step: t=', t ,', t_ode=', t_ode)
447445

448446
if t > self._front and t_ode >= self._front:
449447
# The state is at self._front, do a step
450448
self._back = self.get_state()
451-
print(' --- THERE --- ', t_ode, ' , ', t)
452-
print(self._ode_solver._y)
449+
if t_ode > 0.16:
450+
print(' - case 1: ', np.isnan(self._ode_solver._y).any())
453451
self._ode_solver.integrate(min(self._front + safe_delta, t))
454-
print(' --- --- ')
452+
if t_ode > 0.16:
453+
print(' - after integrate (', self._ode_solver.get_return_code(), '): ', np.isnan(self._ode_solver._y).any())
455454
self._front = self._ode_solver._integrator.rwork[12]
456455
# We asked for a fraction of a step, now complete it.
457456
self._ode_solver.integrate(min(self._front, t))
457+
if t_ode > 0.16:
458+
print(' - after integrate 2 (', self._ode_solver.get_return_code(), '): ', np.isnan(self._ode_solver._y).any())
458459
elif t > self._front:
459460
# The state is at a time before t_front, advance to t_front
461+
if t_ode > 0.16:
462+
print(' - case 2: ', np.isnan(self._ode_solver._y).any())
460463
self._ode_solver.integrate(self._front)
464+
if t_ode > 0.16:
465+
print(' - after integrate (', self._ode_solver.get_return_code(), '): ', np.isnan(self._ode_solver._y).any())
461466

462467
def _backstep(self, t):
463468
"""

qutip/solver/multitraj.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ def step(
138138
"""
139139
if not self._integrator._is_set:
140140
raise RuntimeError("The `start` method must called first.")
141-
print('before args change: ', self._integrator._integrator._ode_solver._y)
142141
self._argument(args)
143-
print('after args change: ', self._integrator._integrator._ode_solver._y)
144142
_, state = self._integrator.integrate(t, copy=False)
145143
return self._restore_state(state, copy=copy)
146144

qutip/tests/solver/test_mcsolve.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,11 @@ def test_MCSolver_stepping():
516516
H = qutip.num(size)
517517
solver = MCSolver(H, a)
518518
solver.start(qutip.basis(size, size-1), 0, seed=0)
519-
print('a', solver._integrator._integrator._ode_solver._y)
520519
solver.options = {'method': 'lsoda'}
521-
print('b', solver._integrator._integrator._ode_solver._y)
522520
state = solver.step(1)
523521
assert qutip.expect(qutip.qeye(size), state) == pytest.approx(1)
524522
assert qutip.expect(qutip.num(size), state) == pytest.approx(size - 1)
525523
assert state.isket
526-
print('c', solver._integrator._integrator._ode_solver._y)
527524
state = solver.step(5, args={'coupling': 5})
528525
assert qutip.expect(qutip.qeye(size), state) == pytest.approx(1)
529526
assert qutip.expect(qutip.num(size), state) <= size - 1

0 commit comments

Comments
 (0)