Can QuTiP generate spectral line shapes?

43 views
Skip to first unread message

alexa...@gmail.com

unread,
Mar 21, 2018, 8:18:11 AM3/21/18
to QuTiP: Quantum Toolbox in Python
Can QuTiP generate spectral line shapes?

Andrew Dawes

unread,
Mar 21, 2018, 1:03:30 PM3/21/18
to qu...@googlegroups.com
You may be interested in the spectrum function: http://qutip.org/docs/latest/apidoc/functions.html?highlight=spectrum#qutip.correlation.spectrum

Here is some sample code that shows two ways to calculate a spectrum. It is based on an older example: http://qutip.org/docs/3.1.0/guide/guide-correlation.html

I’ve updated it to use the “correlation_2op_1t” function.


import numpy as np
from qutip import *
import pylab as plt
%matplotlib inline

N = 4                   # number of cavity fock states
wc = wa = 1.0 * 2 * np.pi  # cavity and atom frequency
g  = 0.1 * 2 * np.pi       # coupling strength
kappa = 0.75            # cavity dissipation rate
gamma = 0.25            # atom dissipation rate

# Jaynes-Cummings Hamiltonian
a  = tensor(destroy(N), qeye(2))
sm = tensor(qeye(N), destroy(2))
H = wc * a.dag() * a + wa * sm.dag() * sm + g * (a.dag() * sm + a * sm.dag())

# collapse operators
n_th = 0.25
c_ops = [np.sqrt(kappa * (1 + n_th)) * a, np.sqrt(kappa * n_th) * a.dag(), np.sqrt(gamma) * sm]

# calculate the correlation function using the mesolve solver, and then fft to
# obtain the spectrum. Here we need to make sure to evaluate the correlation
# function for a sufficient long time and sufficiently high sampling rate so
# that the discrete Fourier transform (FFT) captures all the features in the
# resulting spectrum.
tlist = np.linspace(0, 100, 5000)
corr = correlation_2op_1t(H, None, tlist, c_ops, a.dag(), a)
wlist1, spec1 = spectrum_correlation_fft(tlist, corr)


# calculate the power spectrum using spectrum, which internally uses essolve
# to solve for the dynamics (by default)
wlist2 = np.linspace(0.25, 1.75, 200) * 2 * np.pi
spec2 = spectrum(H, wlist2, c_ops, a.dag(), a)

# plot the spectra
fig, ax = plt.subplots(1, 1)
ax.plot(wlist1 / (2 * np.pi), spec1, 'b', lw=2, label='eseries method')
ax.plot(wlist2 / (2 * np.pi), spec2, 'r--', lw=2, label='me+fft method')
ax.legend()
ax.set_xlabel('Frequency')
ax.set_ylabel('Power spectrum')
ax.set_title('Vacuum Rabi splitting')
ax.set_xlim(wlist2[0]/(2*np.pi), wlist2[-1]/(2*np.pi))



On Mar 21, 2018, at 4:46 AM, alexa...@gmail.com wrote:

Can QuTiP generate spectral line shapes?

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages