odesolver

1,222 views
Skip to first unread message

Myung-Joong Hwang

unread,
Dec 14, 2011, 4:38:07 AM12/14/11
to qutip
hi,
i attached a simple code to solve an master equation in ultrastrong
coupling regime of Rabi Hamiltonian.
attached code does not work if I set the evolution time tmax in tlist
= linspace(0,tmax,10) larger than 90. (it works fine for small tmax)
that is, for tmax=90, i am getting following error msg

ZVODE-- At current T (=R1), MXSTEP (=I1) steps
taken on this call before reaching TOUT
In above message, I1 = 500
In above message, R1 = 0.9081075324918D+01
/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-
packages/scipy/integrate/ode.py:689: UserWarning: zvode: Excess work
done on this call. (Perhaps wrong MF.)
self.messages.get(istate, 'Unexpected istate=%s'%istate))
[array([ 0.02175746, 0. , 0. , 0. ,
0. ,
0. , 0. , 0. , 0. ,
0. ])]


i read 'which solver should i use' part of the manual,
and it seems like setting tmax large shouldn't be a problem if I wait
long enough.
could you have a look at this?

thanks,

myung-joong

-------------------------------------------------------------------------------
from qutip import *
from pylab import *

wc = 1 # cavity frequency
wa = 10 # atom frequency
g=1 # coupling strength
kappa=0.01 # cavity decay rate

N = 40 # number of cavity fock states
tmax=80
tlist = linspace(0,tmax,10)

a = tensor(destroy(N), qeye(2))
sm = tensor(qeye(N), destroy(2))
c_op_list = [] # collapse operators
c_op_list.append(sqrt(kappa) * a)

H = wc * a.dag() * a + wa * sm.dag() * sm + g * (a.dag() + a) * (sm +
sm.dag())
ekets, evals = H.eigenstates()
groundstate = ekets[0]
wf_list=odesolve(H, groundstate, tlist, c_op_list,[a.dag()*a])
print wf_list

Paul Nation

unread,
Dec 14, 2011, 4:50:46 AM12/14/11
to qu...@googlegroups.com
Myung-Joong,

It looks like you are taking too big of a step in the ODE solver, dt=9 in your case. You can either change the tlist to

tlist = linspace(0,tmax,100)

or you can use the Odeoptions class to set the number of internal steps:

opts=Odeoptions()
opts.nsteps=1000
wf_list=odesolve(H, groundstate, tlist, c_op_list,[a.dag()*a],options=opts)


I guess the first option is easiest.


Paul

Myung-Joong Hwang

unread,
Dec 14, 2011, 5:38:20 AM12/14/11
to qutip
oh, i see. thanks, paul!
myung-joong
Reply all
Reply to author
Forward
0 new messages