Re: How to use qutip efficiently for time dependant problems?

1,322 views
Skip to first unread message

jrjoh...@gmail.com

unread,
Nov 6, 2012, 10:04:02 AM11/6/12
to qu...@googlegroups.com
Hi

The ZVODE error you see means that the ODE solver had to take too many
steps. It can happen if you use too large time steps in the list of
times for the third argument to the mesolve function, or if your ODE
problem is stiff. To avoid this error you can allow the ODE solver to
take more steps by changing the nsteps parameters, something like
this:

options = Odeoptions(nsteps=5000)
output = mesolve(H, psi0, tlist, ...., options=options)

You can also experiment with changing other options in the Odeoptions
class, for example method or max_step. See the documentation for
Odeoptions for more info.

If this doesn't help it would be great if you could send a minimal
example that reproduces this problem that we could use for debugging.

Best regards
Rob

On Tue, Nov 6, 2012 at 11:28 PM, Ganesh Kailas Rahane
<ganeshr...@gmail.com> wrote:
> I am using the qutip for finding the effect of the TPPM pulse sequences to
> the two level system (and afterwards for four level system). In my program,
> I am defining the time dependant Hamiltonian using function based method
> along with args. On running the program, in first iteration, it gives
> following error,
>
> ZVODE-- At current T (=R1), MXSTEP (=I1) steps
> taken on this call before reaching TOUT
> In above message, I1 = 2500
> In above message, R1 = 0.1571479787912D-06
> /usr/lib/python2.7/dist-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))
>
> In the next all ierations, it is giving error as,
> ZVODE-- At current T (=R1), MXSTEP (=I1) steps
> taken on this call before reaching TOUT
> In above message, I1 = 2500
> In above message, R1 = 0.7191479555784D-06
>
> This makes the program to run very slowly. Can anyone tell me how to
> increase the efficiency of my program and how to avoid these messages?
> Also suggest me any other better options to work with time dependant
> problems. Thanks in advance.
>

Ganesh Kailas Rahane

unread,
Nov 6, 2012, 10:22:29 AM11/6/12
to qu...@googlegroups.com
Thanks you very much..

Ganesh Kailas Rahane

unread,
Nov 6, 2012, 10:58:17 AM11/6/12
to qu...@googlegroups.com
Hi, Thanks you for your initial help, but its not working. I have attached python file and for the parameters from file output is given below.

ZVODE--  At current T (=R1), MXSTEP (=I1) steps  
       taken on this call before reaching TOUT    
      In above message,  I1 =      2500
      In above message,  R1 =  0.1571479888638D-06

/usr/lib/python2.7/dist-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))
len(output.states) from mesolve:  1
len(tlist): 4

 ZVODE--  At current T (=R1), MXSTEP (=I1) steps  
       taken on this call before reaching TOUT    
      In above message,  I1 =      2500
      In above message,  R1 =  0.1571479888638D-06
len(output.states) from mesolve:  1
len(tlist): 4

 ZVODE--  At current T (=R1), MXSTEP (=I1) steps  
       taken on this call before reaching TOUT    
      In above message,  I1 =      2500
      In above message,  R1 =  0.1571479888638D-06
len(output.states) from mesolve:  1
len(tlist): 4

 ZVODE--  At current T (=R1), MXSTEP (=I1) steps  
       taken on this call before reaching TOUT    
      In above message,  I1 =      2500
      In above message,  R1 =  0.1571479888638D-06
len(output.states) from mesolve:  1
len(tlist): 4

 ZVODE--  At current T (=R1), MXSTEP (=I1) steps  
       taken on this call before reaching TOUT    
      In above message,  I1 =      2500
      In above message,  R1 =  0.1571479888638D-06
len(output.states) from mesolve:  1
len(tlist): 4

Here, length of the tlist given to mesolve (and mcsolve) function is four but the number of density matrices i.e len(output.states) given by mesolve function be one along with unwanted messages. Thanks, in advance.

Regards,
Ganesh Rahane



On Tuesday, November 6, 2012 4:04:24 PM UTC+1, Robert Johansson wrote:
mcandmesolve_test.py

jrjoh...@gmail.com

unread,
Nov 6, 2012, 7:56:08 PM11/6/12
to qu...@googlegroups.com
Hi Ganesh

Thanks for sending the test program. On line 133, you are missing the
options=opt argument to the mesolve call. It should be something like

output = qu.mesolve(H,Dm_0,tlist,c_op_list,[],args=args,options=opts)

so that mesolve knows about the Odeoptions class instance 'opts' that
you created on the lines above.

With that change, your program produces the output:

$ python mcandmesolve_test.py
len(output.states) from mesolve: 4
len(tlist): 4
len(output.states) from mesolve: 4
len(tlist): 4
len(output.states) from mesolve: 4
len(tlist): 4
len(output.states) from mesolve: 4
len(tlist): 4
len(output.states) from mesolve: 4
len(tlist): 4

Rob
Reply all
Reply to author
Forward
0 new messages