Adiabatic Quantum Computing Simulation

338 views
Skip to first unread message

Steven Heidel

unread,
Mar 9, 2014, 6:12:07 PM3/9/14
to qu...@googlegroups.com
Hi there,

I'm trying to run some numerical simulations in Qutip to determine how the minimum energy gap scales as the number of qubits increases for a particular set of problems.

I found the example here: http://nbviewer.ipython.org/github/jrjohansson/qutip-lectures/blob/master/Lecture-8-Adiabatic-quantum-computing.ipynb and have modified it to suit my needs. However, I do have a couple questions about it:

- What is point of using mesolve() at all if the callback function just calculates the hamiltonian in full at each step? Couldn't I just multiply t and (tau_max - t) by the hamiltonians 100 times myself and calculate the eigenvalues at each step?
- What exactly is the following line in process_rho doing and how does it relate to the occupation probabilities?
# find the overlap between the eigenstates and psi 
    for n, eket in enumerate(ekets):
        P_mat[idx[0],n] = abs((eket.dag().data * psi.data)[0,0])**2

- Finally, is there a way to easily adapt this to use the monte carlo solver? Right now I'm capped at about 12 spins.

Thanks a lot in advance

Paul Nation

unread,
Mar 10, 2014, 12:09:36 AM3/10/14
to qu...@googlegroups.com
The point of using mesolve is that it solves for the dynamics using a 12th-order variable stepsize solver with error checking.  Therefore, the solution you get for the time evolution is going to be pretty accurate.  Your method would most likely introduce a lot of error since your stepsize is fixed, and does not dependent on the underlying dynamics.  You can try your method and compare.

The lines you highlighted are calculating the abs-square of the inner-product between each eigenket and the state at each requested time.  This is the probability that the state is in the eigenstate eket at the given time.

The monte-carlo solver can be implemented with a call-back function in the same manner as mesolve, but we have not added it has of yet.  We are busy trying to get stuff together for QuTiP version 3, and we will add a callback feature by then.

Paul


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

Steven Heidel

unread,
Mar 11, 2014, 1:05:44 AM3/11/14
to qu...@googlegroups.com
Hi Paul,

Thank for getting back to me so quickly. You're certainly correct about the accuracy of mesolve, I tried comparing it to some evolutions where the exact formula for the eigenenergies is known, and it was quite close to the reference. Very impressive.

Regarding the "probability that the state is in the eigenstate eket at the given time", I tried it out on a few examples. Here, for instance, is an evolution where the problem Hamiltonian ground states correspond to a 2-bit disagree / XOR gate: (I replaced my graphing code with the original found in the notebook I referenced earlier):


Now the first eigenergies graph is exactly what I expected (exactly the same as page 11 of this paper: http://arxiv.org/abs/quant-ph/0001106 ). The grey and red line below it are the ground states and end up as such with no level crossings. The occupation probability graph is very strange though, I was expecting to see a couple things that I didn't see:
1. That all probabilities should be 0.25 at the beginning, since my base Hamiltonian is in an equal superposition of all 4 states.
2. That the solution states would slowly increase in probability over time. 
3. As I increased taumax, this caused the green line to jump at the end and become the dominant probability. This shouldn't be since it's not a ground state, and increasing taumax should make the evolution more adiabatic and more likely to end up in the ground state.

Am I misunderstanding the code for this result? Or, just as likely, misunderstanding the underlying mechanics? Thanks for any help you can provide. 

n.mohse...@gmail.com

unread,
Jun 20, 2017, 5:36:25 AM6/20/17
to QuTiP: Quantum Toolbox in Python
Hi Steven
Could I have your code related to how the minimum energy gap scales as the number of qubits increases? I am trying to use ensembles for implementation of Shor's algorithm by using adiabatic evolution. I am going to determine how the minimum energy gap scales as the number of particles in the ensembles increases. I would be pleased if you could help me.

Steven Heidel

unread,
Jun 24, 2017, 12:10:40 AM6/24/17
to QuTiP: Quantum Toolbox in Python
Hi, it's been a while since I've worked on this so not sure how helpful I can be. All the code I wrote is in one of two repos:

--
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/kSZ6het3uIo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qutip+un...@googlegroups.com.

ali.abou...@gmail.com

unread,
Jul 10, 2017, 8:07:27 AM7/10/17
to QuTiP: Quantum Toolbox in Python

Many thanks

On Monday, March 10, 2014 at 1:42:07 AM UTC+3:30, Steven Heidel wrote:

Kenmoe Maseim Bassis

unread,
Aug 4, 2017, 1:16:51 PM8/4/17
to QuTiP: Quantum Toolbox in Python
Dear all,

I am beginner with qutip. I have been trying to install qutip on windows 8 via anaconda. Below is the  command prompt I am running. 
I will be very grateful if someone assists me overcoming this challenge.

Thanks immensely in advance.

(C:\Anaconda2) C:\Users\Kenmoe\Desktop\New folder\qutip-master>pip install qutip

Collecting qutip
  Using cached qutip-4.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Compiling qutip/cy/spmatfuncs.pyx because it depends on c:\anaconda2\lib\sit
e-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/stochastic.pyx because it depends on c:\anaconda2\lib\sit
e-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/sparse_utils.pyx because it depends on c:\anaconda2\lib\s
ite-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/graph_utils.pyx because it depends on c:\anaconda2\lib\si
te-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/interpolate.pyx because it depends on c:\anaconda2\lib\si
te-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/spmath.pyx because it depends on c:\anaconda2\lib\site-pa
ckages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/heom.pyx because it depends on c:\anaconda2\lib\site-pack
ages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/math.pyx because it depends on c:\anaconda2\lib\site-pack
ages\Cython\Includes\libc\math.pxd.
    Compiling qutip/cy/spconvert.pyx because it depends on c:\anaconda2\lib\site
-packages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/ptrace.pyx because it depends on c:\anaconda2\lib\site-pa
ckages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/cy/testing.pyx because it depends on c:\anaconda2\lib\site-p
ackages\Cython\Includes\numpy\__init__.pxd.
    Compiling qutip/control/cy_grape.pyx because it depends on c:\anaconda2\lib\
site-packages\Cython\Includes\numpy\__init__.pxd.
    [ 1/12] Cythonizing qutip/control/cy_grape.pyx
    [ 2/12] Cythonizing qutip/cy/graph_utils.pyx
    [ 3/12] Cythonizing qutip/cy/heom.pyx
    [ 4/12] Cythonizing qutip/cy/interpolate.pyx
    [ 5/12] Cythonizing qutip/cy/math.pyx
    [ 6/12] Cythonizing qutip/cy/ptrace.pyx
    [ 7/12] Cythonizing qutip/cy/sparse_utils.pyx

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef double * col_sum = <double *>PyDataMem_NEW_ZEROED(ncols, sizeof(dou
ble))
        cdef double max_col = 0
        for ii in range(nrows):
            for jj in range(ptr[ii], ptr[ii+1]):
                k = ind[jj]
                col_sum[k] += abs(data[jj])
                                ^
    ------------------------------------------------------------

    qutip\cy\sparse_utils.pyx:316:29: ambiguous overloaded method

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef size_t ii, jj
        cdef double * row_sum = <double *>PyDataMem_NEW_ZEROED(nrows, sizeof(dou
ble))
        cdef double max_row = 0
        for ii in range(nrows):
            for jj in range(ptr[ii], ptr[ii+1]):
                row_sum[ii] += abs(data[jj])
                                 ^
    ------------------------------------------------------------

    qutip\cy\sparse_utils.pyx:335:30: ambiguous overloaded method
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\kenmoe\appdata\local\temp\pip-build-fkpvqa\qutip\setup.py",
 line 216, in <module>
        ext_modules = cythonize(EXT_MODULES),
      File "c:\anaconda2\lib\site-packages\Cython\Build\Dependencies.py", line 1
016, in cythonize
        cythonize_one(*args)
      File "c:\anaconda2\lib\site-packages\Cython\Build\Dependencies.py", line 1
138, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: qutip/cy/sparse_utils.pyx

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\kenmoe\a
ppdata\local\temp\pip-build-fkpvqa\qutip\

(C:\Anaconda2) C:\Users\Kenmoe\Desktop\New folder\qutip-master>^A

Paul Nation

unread,
Aug 4, 2017, 4:31:21 PM8/4/17
to QuTiP Group
You are using Python 2.7, that is not supported on Windows.  You need to switch to Python 3, and use Visual Studio 2015.

-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.

Kenmoe Maseim Bassis

unread,
Aug 5, 2017, 5:13:58 AM8/5/17
to qu...@googlegroups.com
Very useful suggestions. I have managed to install qutip which now seems to work. As a beginner, I have tried the two codes in B6 and B7 of your paper " QuTiP: An open-source Python framework for the dynamics of open quantum
systems
 ". I can't get them to reproduce the results in the main text. I wonder if they are complete. Is there anything missing?

Please advice,

Thanks 

--
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/kSZ6het3uIo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qutip+unsubscribe@googlegroups.com.

Paul Nation

unread,
Aug 5, 2017, 4:13:13 PM8/5/17
to QuTiP Group
The papers are very old.  See the tutorials on the website.

-P

Kenmoe Maseim Bassis

unread,
Aug 12, 2017, 5:08:08 PM8/12/17
to QuTiP: Quantum Toolbox in Python
Qutip seems to work well now. However, I can't get qutip 4.1 to plot a Bloch sphere with colorbar. 
Doesn't anyone know how to go about this?

Thanks.

Paul Nation

unread,
Aug 30, 2017, 5:22:05 PM8/30/17
to QuTiP: Quantum Toolbox in Python
It is not straightforward to do the colorbar with the Bloch sphere.  Perhaps I will make an example of how to do this.

-P

Kenmoe Maseim Bassis

unread,
Oct 9, 2017, 10:23:09 AM10/9/17
to QuTiP: Quantum Toolbox in Python
Hello Paul,

Have you been able to make an example of Bloch sphere with colorbar?
Best,
-M

Paul Nation

unread,
Oct 9, 2017, 2:03:34 PM10/9/17
to QuTiP Group
There is an example on the website.

-P

Kenmoe Maseim Bassis

unread,
Oct 11, 2017, 1:01:29 AM10/11/17
to QuTiP: Quantum Toolbox in Python
I couldn't find the example of Bloch sphere with colorbar on the website. Could you please show me the weblink (url)?
-M


On Monday, 9 October 2017 20:03:34 UTC+2, Paul Nation wrote:
There is an example on the website.

-P
On Oct 9, 2017 08:23, "Kenmoe Maseim Bassis" <ken...@aims.edu.gh> wrote:
Hello Paul,

Have you been able to make an example of Bloch sphere with colorbar?
Best,
-M

On Wednesday, 30 August 2017 22:22:05 UTC+1, Paul Nation wrote:
It is not straightforward to do the colorbar with the Bloch sphere.  Perhaps I will make an example of how to do this.

-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+un...@googlegroups.com.

Paul Nation

unread,
Oct 11, 2017, 1:03:42 AM10/11/17
to QuTiP Group

Kenmoe Maseim Bassis

unread,
Oct 11, 2017, 2:14:36 AM10/11/17
to QuTiP: Quantum Toolbox in Python
Thank you very much
very useful

Kenmoe Maseim Bassis

unread,
Oct 31, 2017, 5:02:06 AM10/31/17
to QuTiP: Quantum Toolbox in Python
Hello all,

Can someone please send me a link to get a documentation about the concurrence function in qutip?

Thanks
M.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages