Note
Go to the end to download the full example code.
Berry’s geometric phase: a spin carried around a cone#
Berry (1984) showed that a quantum state carried adiabatically around a
closed loop in parameter space returns with a phase that depends only on
the loop’s geometry, beyond the dynamical phase \(-\int E\,dt/\hbar\).
For a spin \(j\) aligned with a magnetic field whose direction sweeps a
cone of half-angle \(\theta\), the phase is \(\gamma = -j\,\Omega\),
with \(\Omega = 2\pi(1 - \cos\theta)\) the solid angle the field
encloses. berry_phase() computes
it from the overlaps of neighbouring states, a product in which each
state’s arbitrary phase cancels.
import matplotlib.pyplot as plt
import numpy as np
from physicskit.quantum.chapters.adiabatic import berry_phase, spin_coherent_state
def cone_loop(theta, j, n=400):
phis = np.linspace(0, 2 * np.pi, n, endpoint=False)
return np.array([spin_coherent_state(theta, phi, j) for phi in phis])
Berry phase against the enclosed solid angle#
thetas = np.linspace(0.02, np.pi - 0.02, 60)
Omega = 2 * np.pi * (1 - np.cos(thetas))
fig, ax = plt.subplots(figsize=(8, 4.5))
gammas = {}
for j, c in [(0.5, "C0"), (1.0, "C1"), (1.5, "C2")]:
gammas[j] = np.array([berry_phase(cone_loop(th, j)) for th in thetas])
ax.plot(Omega, gammas[j], "o", ms=3, color=c, label=f"j = {j:g}")
ax.plot(Omega, np.angle(np.exp(-1j * j * Omega)), "-", color=c, lw=1)
ax.set_xlabel(r"solid angle $\Omega$ (sr)")
ax.set_ylabel(r"$\gamma$ (mod $2\pi$)")
ax.set_title(r"Berry phase $\gamma = -j\,\Omega$ (lines) from the overlap product (dots)")
ax.legend()
fig.tight_layout()

Convergence with the number of steps#
The discrete product converges to Berry’s line integral as the loop is refined; the error falls as \(1/N^2\).
theta0 = 1.0
exact = -0.5 * 2 * np.pi * (1 - np.cos(theta0))
Ns = np.array([8, 16, 32, 64, 128, 256])
err = np.array([abs(berry_phase(cone_loop(theta0, 0.5, N)) - exact) for N in Ns])
fig2, ax2 = plt.subplots(figsize=(6, 4))
ax2.loglog(Ns, err, "o-")
ax2.loglog(Ns, err[0] * (Ns[0] / Ns) ** 2, "k:", label=r"$\propto N^{-2}$")
ax2.set_xlabel("number of states in the loop N")
ax2.set_ylabel("error in γ")
ax2.legend()
fig2.tight_layout()

Check#
gamma = -j Omega (mod 2 pi) for j = 1/2, 1, 3/2 on every cone; a spin 1/2 around the equator (Omega = 2 pi) picks up pi; the discretization error falls as 1/N^2.
Total running time of the script: (0 minutes 0.796 seconds)