Skip to content

Commit 03567d1

Browse files
authored
Add Kerr nonlinearity tutorial (#26)
1 parent 79d3f56 commit 03567d1

File tree

2 files changed

+202
-0
lines changed

2 files changed

+202
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ pyenv/
2929
/_output/
3030
*.html
3131
*.svg
32+
*.gif
3233
*.json
3334
/site_libs/
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
title: "Kerr nonlinearities"
3+
author: Li-Xun Cai
4+
date: 2025-02-08 # last update (keep this comment as a reminder)
5+
6+
engine: julia
7+
---
8+
9+
Inspirations taken from [this QuTiP tutorial](https://nbviewer.org/urls/qutip.org/qutip-tutorials/tutorials-v5/lectures/Lecture-14-Kerr-nonlinearities.ipynb) by J. R. Johansson.
10+
11+
This tutorial demonstrates the use of
12+
13+
- [`plot_wigner`](https://qutip.org/QuantumToolbox.jl/stable/resources/api#QuantumToolbox.plot_wigner)
14+
- [`wigner`](https://qutip.org/QuantumToolbox.jl/stable/resources/api#QuantumToolbox.wigner)
15+
16+
by exploring Kerr nonlinearities.
17+
18+
## Introduction
19+
20+
Kerr nonlinearities arise from the interaction between the electromagnetic field and a nonlinear medium with a significant third-order susceptibility, $\chi^{(3)}$. Since experiments typically use monochromatic light sources such as lasers, we restrict our discussion to a single electromagnetic mode.
21+
22+
To derive the Hamiltonian, we start by reviewing the classical theory:
23+
24+
1. **Nonlinear polarization density:**
25+
In a nonlinear medium, the $i$-th component of the polarization density $\vec{\mathcal{P}}$ is given by
26+
$$
27+
\mathcal{P}_i =
28+
\sum_j \chi^{(1)}_{ij} E_j +
29+
\sum_{jk} \chi^{(2)}_{ijk} E_j E_k +
30+
\sum_{jkl} \chi^{(3)}_{ijkl} E_j E_k E_l + \dots
31+
$$
32+
for $i,j,k,l \in \{x,y,z\}$, where ${\chi}^{(m)}$ is the $m$-th order nonlinear susceptibility and $E$ is the electric field. By the assumption that only the first and third order terms are non-vanishing for our Kerr medium in the single light mode, we can approximate the polarization density as
33+
$$
34+
\mathcal{P} \simeq
35+
\chi^{(1)} E +
36+
\chi^{(3)} E^3
37+
$$
38+
with the subscripts for spatial components dropped.
39+
2. **Interaction of the Electric Field with the Polarization Density:**
40+
The interaction energy is proportional to $\mathcal{P} \cdot E$. The nonlinear term in the Hamiltonian is therefore
41+
$$
42+
H_{\text{NL}} = \chi E^4
43+
$$
44+
where $\chi$ is the effective coefficient primarily determined by the nonlinear susceptibility.
45+
3. **Quantization of the Electromagnetic Mode:**
46+
In quantum optics, the electric field operator for a single mode is proportional to the quardrature operator $\hat{x} = \frac{(\hat{a} + \hat{a}^\dagger)}{2}$ where $\hat{a}$ is the annihilation operator.
47+
48+
We then combine the above properties, expand $(\hat{a}^\dagger + \hat{a})^4$, drop the terms that do not conserve the photon number or irrelevant to this tutorial with [rotating wave approximation (RWA)](https://en.wikipedia.org/wiki/Rotating-wave-approximation), and put the remaining terms in normal order. Finally, we arrive at the effective Hamiltonian
49+
$$
50+
H = \frac{\chi}{2} (\hat{a}^\dagger)^2 \hat{a}^2,
51+
$$
52+
where $\chi$ again absorbed the coefficients.
53+
54+
## Code demonstration
55+
56+
```{julia}
57+
using QuantumToolbox
58+
using CairoMakie
59+
```
60+
61+
We begin by defining functions for visualization:
62+
63+
1. `plot_variance` plots the expectation value of an operator `op` and shades the variance.
64+
2. `plot_Fock_dist` plots the dynamics of the Fock distribution.
65+
```{julia}
66+
function plot_variance(op, tlist, states)
67+
e = real.(expect(op, states))
68+
v = real.(variance(op, states))
69+
70+
fig = Figure()
71+
ax = Axis(fig[1,1])
72+
lines!(ax, tlist, e)
73+
band!(ax, tlist, e .- v, e .+ v, alpha = 0.3)
74+
return fig, ax
75+
end
76+
77+
function plot_Fock_dist(tlist, states)
78+
fig = Figure()
79+
ax = Axis(
80+
fig[1,1],
81+
xlabel = L"N",
82+
ylabel = L"t"
83+
)
84+
85+
n_col = prod(states[1].dims)
86+
n_row = length(tlist)
87+
88+
data = zeros(Float64, n_row, n_col)
89+
90+
for (idx, state) in enumerate(states)
91+
data[idx, :] = real.(diag(state))
92+
end
93+
94+
hm = heatmap!(
95+
ax,
96+
0:(n_col-1),
97+
tlist,
98+
data',
99+
colormap = cgrad([:white, :magenta]),
100+
colorrange = (0,1)
101+
)
102+
Colorbar(fig[1,2], hm, label = "Probability")
103+
104+
105+
return fig, ax
106+
end
107+
```
108+
109+
Next, we define the system parameters and operators.
110+
```{julia}
111+
N = 15 # Dimension of the Hilbert space
112+
χ = 1 # effective susceptibility
113+
114+
a = destroy(N) # annihilation operator
115+
n = num(N) # number operator
116+
117+
# quadrature operators
118+
x = a + a'
119+
p = -1 * im * (a - a')
120+
121+
# Hamiltonian
122+
H = 0.5 * χ * a' * a' * a * a
123+
```
124+
125+
Since we are considering unitary dynamics, i.e., no dissipation, the dynamics are fully captured for $\chi t \in \left[0, 2 \pi \right]$, and the coherent initial state is representative for a laser light source.
126+
127+
Note that if the keyword argument `e_ops` is not supplied to [`mesolve`](https://qutip.org/QuantumToolbox.jl/stable/resources/api#QuantumToolbox.sesolve), the returned `result` contains the state at each time point at field `states`. Consult the [user guide to `TimeEvolutionSol`](https://qutip.org/QuantumToolbox.jl/stable/users_guide/time_evolution/solution) for more details.
128+
```{julia}
129+
ψ0 = coherent(N, 2.0)
130+
tlist = 0:0.01:(2*π / χ)
131+
132+
result = mesolve(H, ψ0, tlist)
133+
```
134+
135+
We first check the expectation value dynamics of the number operator `n` with the two visualization functions we defined previously.
136+
```{julia}
137+
fig1, ax1 = plot_variance(n, tlist, result.states)
138+
ax1.title = L"N"
139+
display(fig1)
140+
141+
fig2, ax2 = plot_Fock_dist(tlist, result.states)
142+
display(fig2)
143+
```
144+
As expected, the photon number is conserved throughout. Either the expectation value or the Fock distribution are conserved in the nonlinear interaction.
145+
146+
We now turn to the quadrature operators. The expectation value dynamics of `x` and `p` are plotted below.
147+
```{julia}
148+
titles = [L"x", L"p"]
149+
for (idx, op) in enumerate([x, p])
150+
_fig, _ax = plot_variance(op, tlist, result.states)
151+
_ax.title = titles[idx]
152+
display(_fig)
153+
end
154+
```
155+
There are two clear observations from these plots that indicate how the nonlinear interaction has modified the initial coherent state:
156+
157+
1. **Non-oscillatory Behavior of Expectation Values:**
158+
In a quantum harmonic oscillator, the expectation values of the quadrature operators typically exhibit simple sinusoidal oscillations. However, under the Kerr nonlinearity, the expectation values deviate from this periodic behavior. This deviation reflects the phase distortions introduced by the nonlinear term in the Hamiltonian.
159+
160+
2. **Departure from Minimum Uncertainty:**
161+
Coherent states in a harmonic oscillator are known to saturate the uncertainty relation, meaning they maintain a constant uncertainty product, ideally at
162+
$$
163+
\Delta x \Delta p = (\frac{\hbar}{2})^2.
164+
$$
165+
In contrast, the evolving state in the presence of the Kerr interaction shows a time-varying variance product. This variation is indicative of squeezing effects and confirms that the state is no longer a minimum uncertainty state.
166+
167+
We can extend the investigation to the Wigner function with the built-in function [`plot_wigner`](https://qutip.org/QuantumToolbox.jl/stable/resources/api#QuantumToolbox.plot_wigner).
168+
```{julia}
169+
idx = searchsortedfirst(tlist, π/χ) - 1
170+
fig3, ax3, hm3 = plot_wigner(result.states[idx])
171+
ax3.title = "χt = $(tlist[idx])"
172+
Colorbar(fig3[1,2], hm3)
173+
display(fig3)
174+
```
175+
As the plot revealed, the state at $\chi t = \pi$ is in fact the [**cat state**](https://en.wikipedia.org/wiki/Cat_state#Cat_states_in_single_modes) for a single mode. One of the main characteristics of the cat state is the superposition of two coherent states with opposite phase.
176+
177+
The dynamics of the Wigner function offer a powerful phase-space perspective on the quantum state evolution under the Kerr nonlinearity. We again use `plot_wigner` to setup the initial plot and update frames with the function [`wigner`](https://qutip.org/QuantumToolbox.jl/stable/resources/api#QuantumToolbox.wigner) to record the dynamics as an animated GIF.
178+
```{julia}
179+
fig4, ax4, hm4 = plot_wigner(result.states[1])
180+
181+
Colorbar(fig4[1,2], hm4)
182+
183+
record(fig4, "kerr_wigner_dyn.gif", 1:length(tlist); framerate=24) do t
184+
wig = wigner(
185+
result.states[t],
186+
range(-7.5, 7.5, 200),
187+
range(-7.5, 7.5, 200)
188+
)
189+
ax4.title = "χt = " * string(round(tlist[t]; digits = 2))
190+
hm4[3] = transpose(wig)
191+
end
192+
```
193+
![](kerr_wigner_dyn.gif)
194+
195+
196+
As the animation progresses, you can observe how the initial Gaussian distribution, typical of a coherent state, is gradually deformed by the nonlinear interaction.
197+
198+
## Version Information
199+
```{julia}
200+
QuantumToolbox.versioninfo()
201+
```

0 commit comments

Comments
 (0)