Author: J. R. Johansson (robert@riken.jp), https://jrjohansson.github.io/
This lecture series was developed by J.R. Johannson. The original lecture notebooks are available here.
This is a slightly modified version of the lectures, to work with the current release of QuTiP. You can find these lectures as a part of the qutip-tutorials repository. This lecture and other tutorial notebooks are indexed at the QuTiP Tutorial webpage.
import matplotlib.pyplot as plt
import numpy as np
from qutip import (about, basis, correlation_2op_1t, mesolve, n_thermal, num,
sigmam, sigmap, sigmax, sigmay, sigmaz,
spectrum_correlation_fft)
%matplotlib inline
$\displaystyle H_L = -\frac{\Omega}{2}(\sigma_+ + \sigma_-)$
$\displaystyle \frac{d}{dt}\rho = -i[H_L, \rho] + \gamma_0(N+1)\left(\sigma_-\rho(t)\sigma_+ - \frac{1}{2}\sigma_+\sigma_-\rho(t) - \frac{1}{2}\rho(t)\sigma_+\sigma_-\right) + \gamma_0 N \left(\sigma_+\rho(t)\sigma_- - \frac{1}{2}\sigma_-\sigma_+\rho(t) - \frac{1}{2}\rho(t)\sigma_-\sigma_+\right)$
Omega = 1.0 * 2 * np.pi
gamma0 = 0.05
w_th = 0.0
N = n_thermal(Omega, w_th)
def system_spec(Omega, gamma0, N):
HL = -0.5 * Omega * (sigmap() + sigmam())
c_ops = [np.sqrt(gamma0 * (N + 1)) * sigmam(),
np.sqrt(gamma0 * N) * sigmap()]
return HL, c_ops
HL, c_ops = system_spec(Omega, gamma0, N)
e_ops = [sigmax(), sigmay(), sigmaz(), sigmam(), sigmap(), num(2)]
psi0 = basis(2, 0)
tlist = np.linspace(0, 20 / (2 * np.pi), 200)
result = mesolve(HL, psi0, tlist, c_ops, e_ops)
fig, axes = plt.subplots(2, 1, figsize=(12, 6), sharex=True)
axes[0].plot(result.times, result.expect[0], "r",
label=r"$\langle\sigma_x\rangle$")
axes[0].plot(result.times, result.expect[1], "g",
label=r"$\langle\sigma_y\rangle$")
axes[0].plot(result.times, result.expect[2], "b",
label=r"$\langle\sigma_z\rangle$")
axes[0].legend()
axes[0].set_ylim(-1, 1)
axes[1].plot(result.times, result.expect[5], "b", label=r"$P_e$")
# axes[1].set_ylabel(r'$\langle\sigma_z\rangle$', fontsize=16)
axes[1].set_xlabel("time", fontsize=16)
axes[1].legend()
axes[1].set_ylim(0, 1);
fig, ax = plt.subplots(1, 1, figsize=(12, 6), sharex=True)
for idx, gamma0 in enumerate([0.1 * Omega, 0.5 * Omega, 1.0 * Omega]):
HL, c_ops = system_spec(Omega, gamma0, N)
result = mesolve(HL, psi0, tlist, c_ops, e_ops)
ax.plot(result.times, result.expect[5], "b",
label=r"$\langle\sigma_z\rangle$")
ax.set_ylim(0, 1);
fig, ax = plt.subplots(1, 1, figsize=(12, 6), sharex=True)
for idx, gamma0 in enumerate([0.1 * Omega, 0.5 * Omega, 1.0 * Omega]):
HL, c_ops = system_spec(Omega, gamma0, N)
result = mesolve(HL, psi0, tlist, c_ops, e_ops)
ax.plot(
result.times, np.imag(result.expect[4]),
label=r"im $\langle\sigma_+\rangle$"
)
ax.set_ylim(-0.5, 0.5);
fig, axes = plt.subplots(1, 2, figsize=(12, 6))
taulist = np.linspace(0, 100, 10000)
for idx, gamma0 in enumerate([2 * Omega, 0.5 * Omega, 0.25 * Omega]):
HL, c_ops = system_spec(Omega, gamma0, N)
corr_vec = correlation_2op_1t(HL, None, taulist, c_ops, sigmap(), sigmam())
w, S = spectrum_correlation_fft(taulist, corr_vec)
axes[0].plot(taulist, corr_vec, label=r"$<\sigma_+(\tau)\sigma_-(0)>$")
axes[1].plot(-w / (gamma0), S, "b", label=r"$S(\omega)$")
axes[1].plot(w / (gamma0), S, "b", label=r"$S(\omega)$")
axes[0].set_xlim(0, 10)
axes[1].set_xlim(-5, 5);
/usr/share/miniconda3/envs/test-environment/lib/python3.10/site-packages/matplotlib/cbook/__init__.py:1298: ComplexWarning: Casting complex values to real discards the imaginary part return np.asarray(x, float)
about()
QuTiP: Quantum Toolbox in Python ================================ Copyright (c) QuTiP team 2011 and later. Current admin team: Alexander Pitchford, Nathan Shammah, Shahnawaz Ahmed, Neill Lambert, Eric Giguère, Boxi Li, Jake Lishman, Simon Cross and Asier Galicia. Board members: Daniel Burgarth, Robert Johansson, Anton F. Kockum, Franco Nori and Will Zeng. Original developers: R. J. Johansson & P. D. Nation. Previous lead developers: Chris Granade & A. Grimsmo. Currently developed through wide collaboration. See https://github.com/qutip for details. QuTiP Version: 4.7.1 Numpy Version: 1.22.4 Scipy Version: 1.8.1 Cython Version: 0.29.33 Matplotlib Version: 3.5.2 Python Version: 3.10.4 Number of CPUs: 2 BLAS Info: Generic OPENMP Installed: False INTEL MKL Ext: False Platform Info: Linux (x86_64) Installation path: /home/runner/work/qutip-tutorials/qutip-tutorials/qutip/qutip ================================================================================ Please cite QuTiP in your publication. ================================================================================ For your convenience a bibtex reference can be easily generated using `qutip.cite()`