Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Commit 48ee272

Browse files
authored
Add more tutorials for HierarchicalEOM.jl (qutip#15)
1 parent c09ed7a commit 48ee272

File tree

6 files changed

+477
-3
lines changed

6 files changed

+477
-3
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Thank you for contributing to Tutorials for Quantum Toolbox in `Julia`! Please m
33

44
- [ ] Please read [Contributing to QuantumToolbox.jl](https://qutip.org/QuantumToolbox.jl/stable/resources/contributing).
55
- [ ] The (last update) `date` were modified for new or updated tutorials.
6+
- [ ] For new tutorials, a `Version Information` section was added at the end and displays the output of `versioninfo()`.
67
- [ ] All tutorials were able to render locally by running: `make render`.
78

89
Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a [Draft Pull Request](https://github.blog/2019-02-14-introducing-draft-pull-requests/) to let the others know this on-going work.

HierarchicalEOM.jl/SIAM.qmd

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "Single-impurity Anderson model"
3+
author: Yi-Te Huang
4+
date: 2025-01-14 # last update (keep this comment as a reminder)
5+
6+
engine: julia
7+
---
8+
9+
## Introduction
10+
11+
The investigation of the Kondo effect in single-impurity Anderson model is crucial as it serves both as a valuable testing ground for the theories of the Kondo effect and has the potential to lead to a better understanding of this intrinsic many-body phenomena. For further detailed discussions of this model (under different parameters) using [`HierarchicalEOM.jl`](https://github.com/qutip/HierarchicalEOM.jl), we recommend to read the article [@HierarchicalEOM-jl2023].
12+
13+
## Hamiltonian
14+
15+
We consider a single-level electronic system [which can be populated by a spin-up ($\uparrow$) or spin-down ($\downarrow$) electron] coupled to a fermionic reservoir ($\textrm{f}$). The total Hamiltonian is given by $H_{\textrm{T}}=H_\textrm{s}+H_\textrm{f}+H_\textrm{sf}$, where each terms takes the form
16+
17+
$$
18+
\begin{aligned}
19+
H_{\textrm{s}} &= \epsilon \left(d^\dagger_\uparrow d_\uparrow + d^\dagger_\downarrow d_\downarrow \right) + U\left(d^\dagger_\uparrow d_\uparrow d^\dagger_\downarrow d_\downarrow\right),\\
20+
H_{\textrm{f}} &=\sum_{\sigma=\uparrow,\downarrow}\sum_{k}\epsilon_{\sigma,k}c_{\sigma,k}^{\dagger}c_{\sigma,k},\\
21+
H_{\textrm{sf}} &=\sum_{\sigma=\uparrow,\downarrow}\sum_{k}g_{k}c_{\sigma,k}^{\dagger}d_{\sigma} + g_{k}^*d_{\sigma}^{\dagger}c_{\sigma,k}.
22+
\end{aligned}
23+
$$
24+
25+
Here, $d_\uparrow$ $(d_\downarrow)$ annihilates a spin-up (spin-down) electron in the system, $\epsilon$ is the energy of the electron, and $U$ is the Coulomb repulsion energy for double occupation. Furthermore, $c_{\sigma,k}$ $(c_{\sigma,k}^{\dagger})$ annihilates (creates) an electron in the state $k$ (with energy $\epsilon_{\sigma,k}$) of the reservoir.
26+
27+
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.
28+
29+
```{julia}
30+
using HierarchicalEOM # this automatically loads `QuantumToolbox`
31+
using CairoMakie # for plotting results
32+
```
33+
34+
```{julia}
35+
ϵ = -5
36+
U = 10
37+
σm = sigmam() # σ-
38+
σz = sigmaz() # σz
39+
II = qeye(2) # identity matrix
40+
41+
# construct the annihilation operator for both spin-up and spin-down
42+
# (utilize Jordan–Wigner transformation)
43+
d_up = tensor(σm, II)
44+
d_dn = tensor(-1 * σz, σm)
45+
Hsys = ϵ * (d_up' * d_up + d_dn' * d_dn) + U * (d_up' * d_up * d_dn' * d_dn)
46+
```
47+
48+
## Construct bath objects
49+
50+
We assume the fermionic reservoir to have a [Lorentzian-shaped spectral density](https://qutip.org/HierarchicalEOM.jl/stable/bath_fermion/Fermion_Lorentz/#doc-Fermion-Lorentz), and we utilize the Padé decomposition. Furthermore, the spectral densities depend on the following physical parameters:
51+
52+
- the coupling strength $\Gamma$ between system and reservoirs
53+
- the band-width $W$
54+
- the product of the Boltzmann constant $k$ and the absolute temperature $T$ : $kT$
55+
- the chemical potential $\mu$
56+
- the total number of exponentials for the reservoir $2(N + 1)$
57+
58+
```{julia}
59+
Γ = 2
60+
μ = 0
61+
W = 10
62+
kT = 0.5
63+
N = 5
64+
bath_up = Fermion_Lorentz_Pade(d_up, Γ, μ, W, kT, N)
65+
bath_dn = Fermion_Lorentz_Pade(d_dn, Γ, μ, W, kT, N)
66+
bath_list = [bath_up, bath_dn]
67+
```
68+
69+
## Construct HEOMLS matrix
70+
71+
```{julia}
72+
tier = 3
73+
M_even = M_Fermion(Hsys, tier, bath_list)
74+
M_odd = M_Fermion(Hsys, tier, bath_list, ODD)
75+
```
76+
77+
## Solve stationary state of ADOs
78+
79+
```{julia}
80+
ados_s = steadystate(M_even)
81+
```
82+
83+
## Calculate density of states (DOS)
84+
85+
```{julia}
86+
ωlist = -10:1:10
87+
dos = DensityOfStates(M_odd, ados_s, d_up, ωlist)
88+
```
89+
90+
plot the results
91+
92+
```{julia}
93+
fig = Figure(size = (500, 350))
94+
ax = Axis(fig[1, 1], xlabel = L"\omega")
95+
lines!(ax, ωlist, dos)
96+
97+
fig
98+
```
99+
100+
## Version Information
101+
```{julia}
102+
HierarchicalEOM.versioninfo()
103+
```

HierarchicalEOM.jl/cavityQED.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ Here, $H_{\textrm{b}}$ describes a bosonic reservoir where $b_{k}$ $(b_{k}^{\dag
4141
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.
4242

4343
```{julia}
44-
using HierarchicalEOM
45-
using CairoMakie
44+
using HierarchicalEOM # this automatically loads `QuantumToolbox`
45+
using CairoMakie # for plotting results
4646
```
4747

4848
```{julia}
49-
N = 3 ## system cavity Hilbert space cutoff
49+
N = 3 # system cavity Hilbert space cutoff
5050
ωA = 2
5151
ωc = 2
5252
g = 0.1
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
title: "Driven systems and dynamical decoupling"
3+
author: Yi-Te Huang
4+
date: 2025-01-14 # last update (keep this comment as a reminder)
5+
6+
engine: julia
7+
---
8+
9+
Inspirations taken from an example in QuTiP-BoFiN article [@QuTiP-BoFiN2023].
10+
11+
## Introduction
12+
13+
In this example, we show how to solve the time evolution with time-dependent Hamiltonian problems in hierarchical equations of motion approach.
14+
15+
Here, we study dynamical decoupling which is a common tool used to undo the dephasing effect from the environment even for finite pulse duration.
16+
17+
## Hamiltonian
18+
19+
We consider a two-level system coupled to a bosonic reservoir ($\textrm{b}$). The total Hamiltonian is given by $H_{\textrm{T}}=H_\textrm{s}+H_\textrm{b}+H_\textrm{sb}$, where each terms takes the form
20+
21+
$$
22+
\begin{aligned}
23+
H_{\textrm{s}}(t) &= H_0 + H_{\textrm{D}}(t),\\
24+
H_0 &= \frac{\omega_0}{2} \sigma_z,\\
25+
H_{\textrm{b}} &=\sum_{k}\omega_{k}b_{k}^{\dagger}b_{k},\\
26+
H_{\textrm{sb}} &=\sigma_z\sum_{k}g_{\alpha,k}(b_k + b_k^{\dagger}).
27+
\end{aligned}
28+
$$
29+
30+
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}$).
31+
32+
Furthermore, to observe the time evolution of the coherence, we consider the initial state to be
33+
$$
34+
ψ(t=0)=\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)
35+
$$
36+
37+
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.
38+
39+
```{julia}
40+
using HierarchicalEOM # this automatically loads `QuantumToolbox`
41+
using CairoMakie # for plotting results
42+
```
43+
44+
```{julia}
45+
ω0 = 0.0
46+
σz = sigmaz()
47+
σx = sigmax()
48+
H0 = 0.5 * ω0 * σz
49+
50+
# Define the operator that measures the 0, 1 element of density matrix
51+
ρ01 = Qobj([0 1; 0 0])
52+
53+
ψ0 = (basis(2, 0) + basis(2, 1)) / √2
54+
```
55+
56+
The time-dependent driving term $H_{\textrm{D}}(t)$ has the form
57+
58+
$$
59+
H_{\textrm{D}}(t) = \sum_{n=1}^N f_n(t) \sigma_x
60+
$$
61+
62+
where the pulse is chosen to have duration $\tau$ together with a delay $\Delta$ between each pulses, namely
63+
64+
$$
65+
f_n(t)
66+
= \begin{cases}
67+
V & \textrm{if}~~(n-1)\tau + n\Delta \leq t \leq n (\tau + \Delta),\\
68+
0 & \textrm{otherwise}.
69+
\end{cases}
70+
$$
71+
72+
Here, we set the period of the pulses to be $\tau V = \pi/2$. Therefore, we consider two scenarios with fast and slow pulses:
73+
74+
```{julia}
75+
# a function which returns the amplitude of the pulse at time t
76+
function pulse(p, t)
77+
τ = 0.5 * π / p.V
78+
period = τ + p.Δ
79+
80+
if (t % period) < τ
81+
return p.V
82+
else
83+
return 0
84+
end
85+
end
86+
87+
tlist = 0:0.4:400
88+
amp_fast = 0.50
89+
amp_slow = 0.01
90+
delay = 20
91+
92+
fastTuple = (V = amp_fast, Δ = delay)
93+
slowTuple = (V = amp_slow, Δ = delay)
94+
95+
# plot
96+
fig = Figure(size = (600, 350))
97+
ax = Axis(fig[1, 1], xlabel = L"t")
98+
lines!(ax, tlist, [pulse(fastTuple, t) for t in tlist], label = "Fast Pulse", linestyle = :solid)
99+
lines!(ax, tlist, [pulse(slowTuple, t) for t in tlist], label = "Slow Pulse", linestyle = :dash)
100+
101+
axislegend(ax, position = :rt)
102+
103+
fig
104+
```
105+
106+
## Construct bath objects
107+
108+
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:
109+
110+
- the coupling strength $\Gamma$ between system and reservoir
111+
- the band-width $W$
112+
- the product of the Boltzmann constant $k$ and the absolute temperature $T$ : $kT$
113+
- the total number of exponentials for the reservoir $(N + 1)$
114+
115+
```{julia}
116+
Γ = 0.0005
117+
W = 0.005
118+
kT = 0.05
119+
N = 3
120+
bath = Boson_DrudeLorentz_Pade(σz, Γ, W, kT, N)
121+
```
122+
123+
## Construct HEOMLS matrix
124+
125+
::: {.callout-warning}
126+
Only provide the **time-independent** part of system Hamiltonian when constructing HEOMLS matrices (the time-dependent part `H_t` should be given when solving the time evolution).
127+
:::
128+
129+
```{julia}
130+
tier = 6
131+
M = M_Boson(H0, tier, bath)
132+
```
133+
134+
## time evolution with time-independent Hamiltonian
135+
```{julia}
136+
noPulseSol = HEOMsolve(M, ψ0, tlist; e_ops = [ρ01]);
137+
```
138+
139+
## Solve time evolution with time-dependent Hamiltonian
140+
141+
We need to provide a `QuantumToolbox.QuantumObjectEvolution` (named as `H_D` in this case)
142+
143+
```{julia}
144+
H_D = QobjEvo(σx, pulse)
145+
```
146+
147+
The keyword argument `params` in `HEOMsolve` will be passed to the argument `p` in user-defined function (`pulse` in this case) directly:
148+
149+
```{julia}
150+
fastPulseSol = HEOMsolve(M, ψ0, tlist; e_ops = [ρ01], H_t = H_D, params = fastTuple)
151+
slowPulseSol = HEOMsolve(M, ψ0, tlist; e_ops = [ρ01], H_t = H_D, params = slowTuple)
152+
```
153+
154+
## Plot the coherence
155+
156+
```{julia}
157+
fig = Figure(size = (600, 350))
158+
ax = Axis(fig[1, 1], xlabel = L"t", ylabel = L"\rho_{01}")
159+
lines!(ax, tlist, real(fastPulseSol.expect[1, :]), label = "Fast Pulse", linestyle = :solid)
160+
lines!(ax, tlist, real(slowPulseSol.expect[1, :]), label = "Slow Pulse", linestyle = :dot)
161+
lines!(ax, tlist, real(noPulseSol.expect[1, :]), label = "no Pulse", linestyle = :dash)
162+
163+
axislegend(ax, position = :lb)
164+
165+
fig
166+
```
167+
168+
## Version Information
169+
```{julia}
170+
HierarchicalEOM.versioninfo()
171+
```
172+

0 commit comments

Comments
 (0)