Skip to content

Commit c2619a2

Browse files
authored
Merge pull request #6 from qutip/dev/structure
Setup structure for tutorials website
2 parents debeb6a + a666d79 commit c2619a2

File tree

12 files changed

+548
-52
lines changed

12 files changed

+548
-52
lines changed

HierarchicalEOM.jl/cavityQED.qmd

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
---
2+
title: "Cavity QED system"
3+
author: Shen-Liang Yang, Yi-Te Huang
4+
date: last-modified
5+
date-format: iso
6+
7+
engine: julia
8+
---
9+
10+
## Introduction
11+
12+
Cavity quantum electrodynamics (cavity QED) is an important topic for studying the interaction between atoms (or other particles) and light confined in a reflective cavity, under conditions where the quantum nature of photons is significant.
13+
14+
## Hamiltonian
15+
16+
The Jaynes-Cummings model is a standard model in the realm of cavity QED. It illustrates the interaction between a two-level atom ($\textrm{A}$) and a quantized single-mode within a cavity ($\textrm{c}$).
17+
18+
Now, we need to build the system Hamiltonian and initial state with the package [`QuantumToolbox.jl`](https://github.com/qutip/QuantumToolbox.jl) to construct the operators.
19+
20+
$$
21+
\begin{aligned}
22+
H_{\textrm{s}}&=H_{\textrm{A}}+H_{\textrm{c}}+H_{\textrm{int}},\\
23+
H_{\textrm{A}}&=\frac{\omega_A}{2}\sigma_z,\\
24+
H_{\textrm{c}}&=\omega_{\textrm{c}} a^\dagger a,\\
25+
H_{\textrm{int}}&=g (a^\dagger\sigma^-+a\sigma^+),
26+
\end{aligned}
27+
$$
28+
29+
where $\sigma^-$ ($\sigma^+$) is the annihilation (creation) operator of the atom, and $a$ ($a^\dagger$) is the annihilation (creation) operator of the cavity.
30+
31+
Furthermore, we consider the system is coupled to a bosonic reservoir ($\textrm{b}$). The total Hamiltonian is given by $H_{\textrm{Total}}=H_\textrm{s}+H_\textrm{b}+H_\textrm{sb}$, where $H_\textrm{b}$ and $H_\textrm{sb}$ takes the form
32+
33+
$$
34+
\begin{aligned}
35+
H_{\textrm{b}} &=\sum_{k}\omega_{k}b_{k}^{\dagger}b_{k},\\
36+
H_{\textrm{sb}} &=(a+a^\dagger)\sum_{k}g_{k}(b_k + b_k^{\dagger}).
37+
\end{aligned}
38+
$$
39+
40+
Here, $H_{\textrm{b}}$ describes a bosonic reservoir where $b_{k}$ $(b_{k}^{\dagger})$ is the bosonic annihilation (creation) operator associated to the $k$th mode (with frequency $\omega_{k}$). Also, $H_{\textrm{sb}}$ illustrates the interaction between the cavity and the bosonic reservoir.
41+
42+
Now, we need to build the system Hamiltonian and initial state with the package [`QuantumToolbox.jl`](https://github.com/qutip/QuantumToolbox.jl) to construct the operators.
43+
44+
```{julia}
45+
using HierarchicalEOM
46+
using CairoMakie
47+
```
48+
49+
```{julia}
50+
N = 3 ## system cavity Hilbert space cutoff
51+
ωA = 2
52+
ωc = 2
53+
g = 0.1
54+
55+
# operators
56+
a_c = destroy(N)
57+
I_c = qeye(N)
58+
σz_A = sigmaz()
59+
σm_A = sigmam()
60+
I_A = qeye(2)
61+
62+
# operators in tensor-space
63+
a = tensor(a_c, I_A)
64+
σz = tensor(I_c, σz_A)
65+
σm = tensor(I_c, σm_A)
66+
67+
# Hamiltonian
68+
H_A = 0.5 * ωA * σz
69+
H_c = ωc * a' * a
70+
H_int = g * (a' * σm + a * σm')
71+
H_s = H_A + H_c + H_int
72+
73+
# initial state
74+
ψ0 = tensor(basis(N, 0), basis(2, 0));
75+
```
76+
77+
## Construct bath objects
78+
We assume the bosonic reservoir to have a [Drude-Lorentz Spectral Density](https://qutip.org/HierarchicalEOM.jl/stable/bath_boson/Boson_Drude_Lorentz/#Boson-Drude-Lorentz), and we utilize the Padé decomposition. Furthermore, the spectral densities depend on the following physical parameters:
79+
80+
- the coupling strength $\Gamma$ between system and reservoir
81+
- the band-width $W$
82+
- the product of the Boltzmann constant $k$ and the absolute temperature $T$ : $kT$
83+
- the total number of exponentials for the reservoir $(N + 1)$
84+
85+
```{julia}
86+
Γ = 0.01
87+
W = 1
88+
kT = 0.025
89+
N = 20
90+
Bath = Boson_DrudeLorentz_Pade(a + a', Γ, W, kT, N)
91+
```
92+
93+
Before incorporating the correlation function into the HEOMLS matrix, it is essential to verify (by using `correlation_function`) if the total number of exponentials for the reservoir sufficiently describes the practical situation.
94+
95+
```{julia}
96+
tlist_test = 0:0.1:10;
97+
Bath_test = Boson_DrudeLorentz_Pade(a + a', Γ, W, kT, 1000);
98+
Ct = correlation_function(Bath, tlist_test);
99+
Ct2 = correlation_function(Bath_test, tlist_test)
100+
101+
# plot
102+
fig = Figure(size = (500, 350))
103+
ax = Axis(fig[1, 1], xlabel = L"t", ylabel = L"C(t)")
104+
lines!(ax, tlist_test, real(Ct2), label = L"$N=1000$ (real part)", linestyle = :solid)
105+
lines!(ax, tlist_test, real(Ct), label = L"$N=20$ (real part)", linestyle = :dash)
106+
lines!(ax, tlist_test, imag(Ct2), label = L"$N=1000$ (imag part)", linestyle = :solid)
107+
lines!(ax, tlist_test, imag(Ct), label = L"$N=20$ (imag part)", linestyle = :dash)
108+
109+
axislegend(ax, position = :rt)
110+
111+
fig
112+
```
113+
114+
## Construct HEOMLS matrix
115+
116+
Here, we consider an incoherent pumping to the atom, which can be described by an Lindblad dissipator (see [here](https://qutip.org/HierarchicalEOM.jl/stable/heom_matrix/master_eq/) for more details).
117+
118+
Furthermore, we set the [important threshold](https://qutip.org/HierarchicalEOM.jl/stable/heom_matrix/HEOMLS_intro/#doc-Importance-Value-and-Threshold) to be `1e-6`.
119+
120+
```{julia}
121+
pump = 0.01
122+
J_pump = sqrt(pump) * σm'
123+
tier = 2
124+
M_Heom = M_Boson(H_s, tier, threshold = 1e-6, Bath)
125+
M_Heom = addBosonDissipator(M_Heom, J_pump)
126+
```
127+
128+
## Solve time evolution of ADOs
129+
130+
```{julia}
131+
t_list = 0:1:500
132+
sol_H = HEOMsolve(M_Heom, ψ0, t_list; e_ops = [σz, a' * a])
133+
```
134+
135+
## Solve stationary state of ADOs
136+
137+
```{julia}
138+
steady_H = steadystate(M_Heom);
139+
```
140+
141+
## Expectation values
142+
143+
observable of atom: $\sigma_z$
144+
145+
```{julia}
146+
σz_evo_H = real(sol_H.expect[1, :])
147+
σz_steady_H = expect(σz, steady_H)
148+
```
149+
150+
observable of cavity: $a^\dagger a$ (average photon number)
151+
152+
```{julia}
153+
np_evo_H = real(sol_H.expect[2, :])
154+
np_steady_H = expect(a' * a, steady_H)
155+
```
156+
157+
plot results
158+
159+
```{julia}
160+
fig = Figure(size = (600, 350))
161+
162+
ax1 = Axis(fig[1, 1], xlabel = L"t")
163+
lines!(ax1, t_list, σz_evo_H, label = L"\langle \sigma_z \rangle", linestyle = :solid)
164+
lines!(ax1, t_list, ones(length(t_list)) .* σz_steady_H, label = L"\langle \sigma_z \rangle ~~(\textrm{steady})", linestyle = :dash)
165+
axislegend(ax1, position = :rt)
166+
167+
ax2 = Axis(fig[2, 1], xlabel = L"t")
168+
lines!(ax2, t_list, np_evo_H, label = L"\langle a^\dagger a \rangle", linestyle = :solid)
169+
lines!(ax2, t_list, ones(length(t_list)) .* np_steady_H, label = L"\langle a^\dagger a \rangle ~~(\textrm{steady})", linestyle = :dash)
170+
axislegend(ax2, position = :rt)
171+
172+
fig
173+
```
174+
175+
## Power spectrum
176+
177+
```{julia}
178+
ω_list = 1:0.01:3
179+
psd_H = PowerSpectrum(M_Heom, steady_H, a, ω_list)
180+
181+
# plot
182+
fig = Figure(size = (500, 350))
183+
ax = Axis(fig[1, 1], xlabel = L"\omega")
184+
lines!(ax, ω_list, psd_H)
185+
186+
fig
187+
```
188+
189+
## Compare with Master Eq. approach
190+
191+
The Lindblad master equations which describes the cavity couples to an extra bosonic reservoir with [Drude-Lorentzian spectral density](https://qutip.org/HierarchicalEOM.jl/stable/bath_boson/Boson_Drude_Lorentz/#Boson-Drude-Lorentz) is given by
192+
193+
```{julia}
194+
# Drude_Lorentzian spectral density
195+
Drude_Lorentz(ω, Γ, W) = 4 * Γ * W * ω / ((ω)^2 + (W)^2)
196+
197+
# Bose-Einstein distribution
198+
n_b(ω, kT) = 1 / (exp(ω / kT) - 1)
199+
200+
# build the jump operators
201+
jump_op = [
202+
sqrt(Drude_Lorentz(ωc, Γ, W) * (n_b(ωc, kT) + 1)) * a,
203+
sqrt(Drude_Lorentz(ωc, Γ, W) * (n_b(ωc, kT))) * a',
204+
J_pump
205+
];
206+
207+
# construct the HEOMLS matrix for master equation
208+
M_master = M_S(H_s)
209+
M_master = addBosonDissipator(M_master, jump_op)
210+
211+
# time evolution
212+
sol_M = HEOMsolve(M_master, ψ0, t_list; e_ops = [σz, a' * a]);
213+
214+
# steady state
215+
steady_M = steadystate(M_master);
216+
217+
# expectation value of σz
218+
σz_evo_M = real(sol_M.expect[1, :])
219+
σz_steady_M = expect(σz, steady_M)
220+
221+
# average photon number
222+
np_evo_M = real(sol_M.expect[2, :])
223+
np_steady_M = expect(a' * a, steady_M);
224+
```
225+
226+
plot results
227+
228+
```{julia}
229+
fig = Figure(size = (600, 350))
230+
231+
ax1 = Axis(fig[1, 1], xlabel = L"t")
232+
lines!(ax1, t_list, σz_evo_M, label = L"\langle \sigma_z \rangle", linestyle = :solid)
233+
lines!(ax1, t_list, ones(length(t_list)) .* σz_steady_M, label = L"\langle \sigma_z \rangle ~~(\textrm{steady})", linestyle = :dash)
234+
axislegend(ax1, position = :rt)
235+
236+
ax2 = Axis(fig[2, 1], xlabel = L"t")
237+
lines!(ax2, t_list, np_evo_M, label = L"\langle a^\dagger a \rangle", linestyle = :solid)
238+
lines!(ax2, t_list, ones(length(t_list)) .* np_steady_M, label = L"\langle a^\dagger a \rangle ~~(\textrm{steady})", linestyle = :dash)
239+
axislegend(ax2, position = :rt)
240+
241+
fig
242+
```
243+
244+
We can also calculate the power spectrum
245+
246+
```{julia}
247+
ω_list = 1:0.01:3
248+
psd_M = PowerSpectrum(M_master, steady_M, a, ω_list)
249+
250+
# plot
251+
fig = Figure(size = (500, 350))
252+
ax = Axis(fig[1, 1], xlabel = L"\omega")
253+
lines!(ax, ω_list, psd_M)
254+
255+
fig
256+
```
257+
258+
Due to the weak coupling between the system and an extra bosonic environment, the Master equation's outcome is expected to be similar to the results obtained from the HEOM method.
259+
260+
## Version Information
261+
```{julia}
262+
HierarchicalEOM.versioninfo()
263+
```

HierarchicalEOM.jl/toc.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: "Tutorials for `HierarchicalEOM.jl`"
3+
listing:
4+
id: HierarchicalEOM-listings
5+
type: table
6+
date-format: iso
7+
sort: false
8+
sort-ui: false
9+
fields: [date, title, author]
10+
contents:
11+
- "cavityQED.qmd"
12+
---
13+
14+
The following tutorials demonstrate and introduce specific functionality of `HierarchicalEOM.jl`.
15+
16+
::: {#HierarchicalEOM-listings}
17+
:::

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include _environment
66
default: help
77

88
render:
9-
${JULIA} --project=@. -e 'import Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile(); using QuantumToolbox, HierarchicalEOM;'
9+
${JULIA} --project=@. -e 'import Pkg; Pkg.resolve(); Pkg.instantiate(); Pkg.precompile(); using QuantumToolbox, HierarchicalEOM;'
1010
${JULIA} --project=@. -e 'using QuantumToolbox, HierarchicalEOM;'
1111
${QUARTO} render
1212

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
33
HierarchicalEOM = "a62dbcb7-80f5-4d31-9a88-8b19fd92b128"
44
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
5+
QuartoNotebookRunner = "4c0109c6-14e9-4c88-93f0-2b974d3468f4"

QuantumToolbox.jl/jaynes_cummings.qmd

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)