diff --git a/Exercise 6 - Atom in a Cavity/atom in cavity.ipynb b/Exercise 6 - Atom in a Cavity/atom in cavity.ipynb new file mode 100644 index 0000000..2ce3ede --- /dev/null +++ b/Exercise 6 - Atom in a Cavity/atom in cavity.ipynb @@ -0,0 +1,178 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import qutip as qt\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Section 2 : Spectrum of atom-cavity system" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def low_sat_I_c(I_d,C,Δ,κ,Γ) :\n", + " n_0 = ##### FILL IN\n", + " δ_at = ##### FILL IN\n", + " δ_c = ##### FILL IN\n", + " return ##### FILL IN" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Δ = np.linspace(-10,10,1000) #detuning of the incident field on the cavity, Δ=Δ_c=Δ_at\n", + "κ = 1.\n", + "Γ= 1. #For 1st figure, then modify κ and Γ as you wish\n", + "\n", + "plt.close('spectrum')\n", + "plt.figure('spectrum')\n", + "for C in np.arange(0.1,2.01,0.1) :\n", + " plt.plot(Δ,low_sat_I_c(1,C,Δ,κ,Γ))\n", + " plt.xlim(-10,10)\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Section 3 : vacuum Rabi oscillations\n", + "\n", + "Let's do this one in SI units !" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Define the experimental parameters\n", + "\"\"\"\n", + "π=np.pi\n", + "\n", + "Δc = 2*π *0. # detuning pump-cavity\n", + "Δat = 2*π *0. # detuning pump-atom\n", + "\n", + "g = 2*π * 2.56e6 # coupling constant\n", + "κ = 2*π*125e3 # cavity dissipation rate\n", + "Γ = 2*π* 6e6 # atom dissipation rate\n", + "\n", + "N = 15 # number of cavity fock states\n", + "\n", + "\"\"\"\n", + "Define some useful operators\n", + "\"\"\"\n", + "a = qt.tensor(qt.destroy(N), qt.qeye(2)) #cavity annihilation\n", + "sm = qt.tensor(qt.qeye(N), qt.destroy(2)) #atom σ-\n", + "\n", + "\"\"\"\n", + "Define the different components of the Hamiltonian and the Linblad operators\n", + "\"\"\"\n", + "# Hamiltonian\n", + "H_cav = Δc * a.dag() * a\n", + "H_at = ##### FILL IN\n", + "H_int = g * ( ) ##### FILL IN\n", + "H_tot = H_cav + H_at + H_int\n", + "\n", + "#Linblad operators\n", + "L_1 = np.sqrt(κ)*a\n", + "L_2 = ##### FILL IN\n", + "\n", + "L_ops = [L_1,L_2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Choose the initial state of the system and define the times at which you want the result of evolution\n", + "\"\"\"\n", + "psi0 = qt.tensor(qt.basis(N,0), qt.basis(2,1)) # start with an excited atom and no photons\n", + "\n", + "tlist = np.linspace(0,0.5e-6,1001)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Use the mesolve function (master equation solver) which takes as arguments\n", + "the Hamiltonian, the initial state, the time list, the Linblad operators, optionally the operators you want the expectation values of.\n", + "\"\"\"\n", + "output = qt.mesolve(H_tot, psi0, tlist, L_ops, [a.dag() * a, sm.dag() * sm])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Extract and plot the results\n", + "\"\"\"\n", + "n_c = output.expect[0] # number of photons in the cavity\n", + "n_a = output.expect[1] # occupation of the atomic excited state\n", + "\n", + "plt.close('Vacuum oscill')\n", + "fig, axes = plt.subplots(1, 1, figsize=(10,6),num='Vacuum oscill')\n", + "\n", + "axes.plot(tlist*1e6, n_c, label=\"Cavity\")\n", + "axes.plot(tlist*1e6, n_a, label=\"Atomic excited state\")\n", + "# axes.plot(tlist*1e6,np.exp(-(Γ+κ)*tlist/2.), label=r'envelope $e^{-(\\Gamma+\\kappa)t/2}$')\n", + "axes.legend(loc='upper right')\n", + "axes.set_xlabel('Time (μs)')\n", + "axes.set_ylabel('Occupation probability')\n", + "axes.set_title('Vacuum Rabi oscillations')\n", + "plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}