error with mesolve

84 views
Skip to first unread message

A. Barış Özgüler

unread,
Jun 10, 2017, 3:58:43 AM6/10/17
to QuTiP: Quantum Toolbox in Python
Hello,

I get the following error while running my program containing "mesolve". The program was running without any errors, but suddenly I get the error. What might be the reason? I don't think I miss a package...

Thanks!

Baris

unable to execute '/usr/bin/clang': Argument list too long

Traceback (most recent call last):

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/unixccompiler.py", line 116, in _compile

    extra_postargs)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/ccompiler.py", line 909, in spawn

    spawn(cmd, dry_run=self.dry_run)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/spawn.py", line 36, in spawn

    _spawn_posix(cmd, search_path, dry_run=dry_run)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix

    % (cmd, exit_status))

distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit status 1


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 216, in load_module

    inplace=build_inplace, language_level=language_level)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 192, in build_module

    reload_support=pyxargs.reload_support)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll

    dist.run_commands()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands

    self.run_command(cmd)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run

    _build_ext.build_ext.run(self)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build_ext.py", line 339, in run

    self.build_extensions()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Cython/Distutils/old_build_ext.py", line 193, in build_extensions

    self.build_extension(ext)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extension

    depends=ext.depends)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/ccompiler.py", line 574, in compile

    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/unixccompiler.py", line 118, in _compile

    raise CompileError(msg)

distutils.errors.CompileError: command '/usr/bin/clang' failed with exit status 1


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "schrodinger.py", line 185, in <module>

    # ###  Schrodinger equation solution

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/mesolve.py", line 337, in mesolve

    e_ops, args, options, progress_bar)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/sesolve.py", line 422, in _sesolve_list_str_td

    exec(code, globals())

  File "<string>", line 1, in <module>

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 445, in load_module

    language_level=self.language_level)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 232, in load_module

    raise exc.with_traceback(tb)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 216, in load_module

    inplace=build_inplace, language_level=language_level)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyximport.py", line 192, in build_module

    reload_support=pyxargs.reload_support)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll

    dist.run_commands()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands

    self.run_command(cmd)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run

    _build_ext.build_ext.run(self)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build_ext.py", line 339, in run

    self.build_extensions()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Cython/Distutils/old_build_ext.py", line 193, in build_extensions

    self.build_extension(ext)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extension

    depends=ext.depends)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/ccompiler.py", line 574, in compile

    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/unixccompiler.py", line 118, in _compile

    raise CompileError(msg)

ImportError: Building module rhs410522924 failed: ["distutils.errors.CompileError: command '/usr/bin/clang' failed with exit status 1\n"]

Paul Nation

unread,
Jun 10, 2017, 9:30:25 AM6/10/17
to QuTiP Group
Can you send the code.  One other person has seen this.  Somehow too many arguments are being passed.  This likely means that there are copies for some reason.

-P

--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

A. Barış Özgüler

unread,
Jun 10, 2017, 1:28:21 PM6/10/17
to QuTiP: Quantum Toolbox in Python
Here is the code:

import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

import numpy as np

import scipy as scipy

import statistics

from numpy import *

from qutip import *

from scipy import *

import time

import pylab


start_time = time.time()


N = 8

si = qeye(2)
sx = sigmax()
sy = sigmay()
sz = sigmaz()

sx_list = []
sz_list = []

for n in range(N):
    op_list = []
    for m in range(N):
        op_list.append(si)

    op_list[n] = sx
    sx_list.append(tensor(op_list))

    op_list[n] = sz
    sz_list.append(tensor(op_list))


H0 = 0

for n in range(N):
    H0 += sx_list[n]



def H1(tD, hlist, Jlist):

    H1 = 0

    for n in range(N):
        H1 += (-1/tD)*sx_list[n]

    for n in range(N):
        H1 += (1/tD)*hlist[n]*sz_list[n]


    k = 0
    for n in range(N):
        if n != 0:
            for i in range(n):
                H1 += (1/tD)*Jlist[k]*sz_list[i]*sz_list[n]
                k += 1
        else:
            pass

    return H1



def Hfinal(hlist, Jlist):
    Hfinal = 0

    for n in range(N):
        Hfinal += hlist[n]*sz_list[n]

    k = 0
    for n in range(N):
        if n != 0:
            for i in range(n):
                Hfinal += Jlist[k]*sz_list[i]*sz_list[n]
                k += 1
        else:
            pass

    return Hfinal



evals, ekets = H0.eigenstates()


delta = 50


L = 100


w = 1

while w<=5:


    J = 1

    while J<=5:

        tD = 1.0

        y = []

        drivingtime = []

        ave = 0

        while ave<.99 and tD<300:

            prob = 0

            for realization in range(L):

                print(tD)
                print(w)
                print(J)
                print(realization)

                hlist = np.random.uniform(-w,w,N)
                Jlist = np.random.uniform(-J,J,int((N-1)*(N/2)))

                steps = 1000
                timelist = np.linspace(0, tD, steps)


                evalsfinal, eketsfinal = Hfinal(hlist,Jlist).eigenstates()

                c_op_list = []

                H = [H0, [H1(tD,hlist,Jlist), 't']]

                result = mesolve(H, ekets[0], timelist, c_op_list, [eketsfinal[0]*eketsfinal[0].dag()])

                prob += result.expect[0][steps - 1]

            ave = prob/L
            y.extend([ave])

            drivingtime.extend([tD])

            tD += delta

        fig, ax = plt.subplots()

        ax.plot(drivingtime,y)
        ax.set_title('w = %s, J = %s'%(w,J))
        plt.ylabel('average probability (%s realizations)'%(L))
        plt.xlabel('driving time (with %s increments)'%(delta))

        pylab.savefig(str(N)+"spins_w"+str(w)+"_J"+str(J)+"_delta"+str(delta)+"_realizations"+str(L))

        J += 2

    w += 2


elapsed_time = time.time() - start_time
print('time = %s'%(elapsed_time))

plt.show()
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.

A. Barış Özgüler

unread,
Jun 11, 2017, 3:30:23 PM6/11/17
to qu...@googlegroups.com
I got the error when w=3 & J=3, then I increased the "steps" to 10000 and there was no problem with w=3 & J=3 anymore, but the error came out again at w=5 & J=3. I again increased the steps, this time to 50000, and the running was completed without error this time. I had N=8 spins (the vector space is 2^8 dimensional), I'm worrying about the frequency of the errors if I increase the number of spins...

--
You received this message because you are subscribed to a topic in the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qutip/9YPUQFAilaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qutip+unsubscribe@googlegroups.com.

A. Barış Özgüler

unread,
Jul 8, 2017, 8:39:09 PM7/8/17
to QuTiP: Quantum Toolbox in Python
Is there any improvements about this problem? I still get the "Argument list too long" error for systems with even a few number of spins...


On Saturday, June 10, 2017 at 8:30:25 AM UTC-5, Paul Nation wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.

Paul Nation

unread,
Jul 8, 2017, 9:33:08 PM7/8/17
to QuTiP Group
I haven't had time to look at it yet.  It is not a problem with the system, or system size.  Rather it is an issue with compiling to c code with cython.

-P

To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.

A. Barış Özgüler

unread,
Oct 11, 2017, 5:02:53 PM10/11/17
to QuTiP: Quantum Toolbox in Python

Hi,


I still have issues with mesolve and other differential equation solvers. I have the similar error (File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/mesolve.py", line 337, in mesolve  e_ops, args, options, progress_bar)) that I got previously, and also two additional errors below. Could you help me understand what is going wrong? 


/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scipy/integrate/_ode.py:869: UserWarning: zvode: Excess work done on this call. (Perhaps wrong MF.)

  'Unexpected istate=%s' % istate))

Traceback (most recent call last):

  File "file.py", line 20000, in <module>

    result = mesolve(H, psi0, times, c_op_list, [], options = Options(store_final_state = True, rhs_reuse = True, method ='bdf',order=5), args = args)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/mesolve.py", line 337, in mesolve

    e_ops, args, options, progress_bar)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/sesolve.py", line 449, in _sesolve_list_str_td

    dims=psi0.dims)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip/sesolve.py", line 679, in _generic_ode_solve

    raise Exception("ODE integration error: Try to increase "

Exception: ODE integration error: Try to increase the allowed number of substeps by increasing the nsteps parameter in the Options class.

Reply all
Reply to author
Forward
0 new messages