Solve and plot the time evolution of the elements of the density matrix

537 views
Skip to first unread message

Lorena Lima

unread,
Feb 10, 2021, 9:49:21 AM2/10/21
to QuTiP: Quantum Toolbox in Python
Dear all,
I have derived a set 9 equations that are first order time derivatives of the nine elements which compose the density matrix of the 3-level system I am working with. I am new at qutip and I've facing lots of troubles to solve the system and obtain the graphs of each element of the density matrix properly. I've tried solving it with 4th order runge kutta, odeintw, but none of those methods worked. My co-advisor told me to use qutip, but I have read the library documentation and I still facing troubles to implement qutip. Could you help me? 

Saumya biswas

unread,
Feb 10, 2021, 10:23:01 PM2/10/21
to qu...@googlegroups.com
Hi. Lorena.
The tutorial section has many helpful examples. For example you can store the density matrix elements' evolution in the example https://nbviewer.jupyter.org/github/qutip/qutip-notebooks/blob/master/examples/rabi-oscillations.ipynb by changing the options argument in mesolve().

Change In [8]: to,
opts = Options(store_states = True)
output = mesolve(H, psi0, tlist, c_op_list, [], options = opts)
#The evolving density matrix is
rho_t = output.states

You can print the density matrix at any time with rho_t[15] for example. See the .py file, for examples.

Saumya





On Wed, Feb 10, 2021 at 6:49 AM Lorena Lima <lima...@gmail.com> wrote:
Dear all,
I have derived a set 9 equations that are first order time derivatives of the nine elements which compose the density matrix of the 3-level system I am working with. I am new at qutip and I've facing lots of troubles to solve the system and obtain the graphs of each element of the density matrix properly. I've tried solving it with 4th order runge kutta, odeintw, but none of those methods worked. My co-advisor told me to use qutip, but I have read the library documentation and I still facing troubles to implement qutip. Could you help me? 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/qutip/7f40dbf7-e382-4f4a-b466-7b713bec3b7cn%40googlegroups.com.
save_states.py

Lorena Lima

unread,
Feb 11, 2021, 2:57:28 PM2/11/21
to QuTiP: Quantum Toolbox in Python
Thank you for the help, Saumya. I actually have another question. Seems that almost every hamiltonian I see on qutip examples are based on creation and anihilation operators. However, the Hamiltonian I am working with has the following form:
hamiltonian.png

How am I supposed to write it properly using qutip?

Again, I'd like to thank you for your help and I am sorry for bothering you with one more question.


Best regards,

Lorena.

Andrew M. C. Dawes

unread,
Feb 11, 2021, 4:46:30 PM2/11/21
to qu...@googlegroups.com
Sorry if this is too simple, but better to start low-level and build up from there. For a three-level system like this, there are a couple approaches. First, each of those states will be represented by a three-dimensional vector. There are a few ways you could define these, starting from the most direct:

from qutip import *
state0 = Qobj([[1],[0],[0]])

gives you a ket with elements 1,0,0. the bra (or adjoint) of that ket is:

state0.dag()

so the outer product |0><0| is written as:

state0 * state0.dag()

Then you can write state1 and state2 with elements 0,1,0 and 0,0,1 in a similar fashion and find the adjoint with the .dag() operator.

There are some shortcuts for three-level systems, such as those described here:

writing s0, s1, and s2 instead of "state0" etc, we can do all this in one line with:

s0, s1, s2 = three_level_basis()

Shorter version sure is easier, but it's important to see what is going on underneath. It's all matrices and vectors :-)

Best,
Andy

Saumya biswas

unread,
Feb 12, 2021, 12:34:57 AM2/12/21
to qu...@googlegroups.com
Also, you have a time-dependent Hamiltonian. Qutip has functionalities to implement them, although they are harder to interpret the results of. For your Hamiltonian, most people would make the Rotating Wave Approximation(RWA) and get a 'time-independent' Hamiltonian, which makes life a lot easier. You might be familiar with the trick, if not, I can send some references on that. 

Lorena Lima

unread,
Feb 12, 2021, 7:54:43 AM2/12/21
to QuTiP: Quantum Toolbox in Python
Thank you Saumya and Andrew.
I've tried to combine the example in the Jupyter notebook that Samuya has sent to me with the tips Andrew gave above, but it still not working :P
The reference I am using says that the hamiltonian is already under the RWA...
I will send it so you can take a look.
Saumya, it would be nice if you could send me those references you mentioned.

Best regards,

Lorena
(Springer Series on Atomic, Optical, and Plasma Physics 64) Karl Blum (auth.) - Density Matrix Theory and Applications-Springer-Verlag Berlin Heidelberg (2012).pdf

Hamid Sakhouf

unread,
Feb 12, 2021, 9:06:28 AM2/12/21
to qu...@googlegroups.com
Hi Lorena,

You have a time-dependent Hamiltonian. So,   you can be inspired by this example:  https://gist.github.com/AhmedSalaha/04eef0060068cd484fff2da06d2995de.

Sakhouf

Fabricio Souza

unread,
Feb 15, 2021, 7:07:00 AM2/15/21
to qu...@googlegroups.com
Dear Lorena,
in this reference (https://journals.aps.org/prb/abstract/10.1103/PhysRevB.98.075423) we studied a three-level system in the context of quantum transport,
hope you find it useful. Note that we perform unitary transformation to remove the time-dependent exponential from
the Hamiltonian. After that you can put your model in the mesolve of QuTip. As Saumya pointed out
above, you can keep the density matrix for the entire evolution, QuTip will basically create a list
of density matrices for each time of your tlist, [ rho(t0), rho(t1), ...]. Alternatively, you can calculate
some averages you are looking for, such as populations, directly inside mesolve, and then plot
the results using matplotlib.
Best regards,
Fabrício.

Reply all
Reply to author
Forward
0 new messages