Topological invariants¶
Many-body Berry phase¶
Let the Hamiltonian depend on a parameter \(\phi\) that goes around a closed loop, for example a flux \(\phi\) through a ring, entering as a twist \(e^{i\phi}\) on one bond. The discrete Berry phase of the ground state is
with the last state connected to the first one. With inversion symmetry
\(\gamma\) is quantized to \(0\) or \(\pi\), and the two values are two
different phases, for example the two dimerizations of a spin chain. We
compute it by solving the ground state at each \(\phi_k\) and multiplying
the overlaps. Here h_of(phi) returns the twisted Hamiltonian of sc:
import numpy as np
phis = np.linspace(0, 2*np.pi, 20, endpoint=False)
wfs = []
for phi in phis:
sc.set_hamiltonian(h_of(phi))
wfs.append(sc.get_gs())
prod = np.prod([wfs[i].dot(wfs[(i+1) % len(wfs)]) for i in range(len(wfs))])
gamma = np.angle(prod) # 0 or pi
See examples/topological/zak_phase for the dimerized Heisenberg chain.

On the left, the figure shows the Berry phase of a ring of 12 spins 1/2 with exchange \(J_i=1+\delta(-1)^i\) and the twist on the bond with \(J=1-\delta\), from 16 values of \(\phi\). It is \(\pi\) when the twisted bond is a strong bond (\(\delta<0\)) and 0 when it is a weak bond (\(\delta>0\)), and it jumps at \(\delta=0\). The dashed line is the Zak phase of the SSH chain with the same dimerization (see Single-particle Berry phase), and it jumps at the same point. The middle and right panels belong to Fermion parity.
Code of this figure (docs/figures/topology_berry_phase/)
# (a) Many-body Berry phase of a dimerized spin-1/2 Heisenberg ring with a
# twist exp(i phi) on the closing bond, against the Zak phase of the SSH chain.
# (b) Fermion parity and total S^z of a superconducting chain with a magnetic
# impurity (a Zeeman field B on the first site). ED is the reference for both.
import numpy as np
from dmrgpy import spinchain, fermionchain, topology
n, nphi = 12, 16
deltas = np.linspace(-0.6, 0.6, 12).round(8) # J_i = 1 + delta (-1)^i
def ring_phase(sc, delta, mode):
"""Berry phase/pi, the phase of prod_phi <gs(phi)|gs(phi+dphi)>."""
J = 1 + delta*(-1.0)**np.arange(n)
hbulk = sum(J[i]*(sc.Sx[i]*sc.Sx[i+1] + sc.Sy[i]*sc.Sy[i+1]
+ sc.Sz[i]*sc.Sz[i+1]) for i in range(n-1))
Spn, Sp0 = sc.Sx[n-1] + 1j*sc.Sy[n-1], sc.Sx[0] + 1j*sc.Sy[0]
wfs = []
for phi in np.linspace(0, 2*np.pi, nphi, endpoint=False):
z = np.exp(1j*phi)
sc.set_hamiltonian(hbulk + J[n-1]*(z*Spn*Sp0.get_dagger()/2
+ np.conj(z)*Sp0*Spn.get_dagger()/2
+ sc.Sz[0]*sc.Sz[n-1]))
wfs.append(sc.get_gs(mode=mode))
prod = np.prod([wfs[i].dot(wfs[(i+1) % nphi]) for i in range(nphi)])
return (np.angle(prod)/np.pi) % 2
gamma, gamma_ed = [], []
for delta in deltas:
sc = spinchain.Spin_Chain(["S=1/2"]*n)
sc.maxm, sc.nsweeps = 64, 12
gamma.append(ring_phase(sc, delta, "DMRG"))
gamma_ed.append(ring_phase(sc, delta, "ED"))
def ssh(delta): # Bloch Hamiltonian, k in units of 2 pi
def hk(k):
dx = (1+delta) + (1-delta)*np.cos(2*np.pi*k)
dy = (1-delta)*np.sin(2*np.pi*k)
return np.array([[0, dx-1j*dy], [dx+1j*dy, 0]])
return hk
delta_ssh = np.linspace(-0.6, 0.6, 121).round(8)
zak = [(topology.berry_phase_matrix(ssh(d), nk=60)/np.pi) % 2
for d in delta_ssh]
def impurity(B, L=6, mu=-0.5, D=0.5, U=0.5):
fc = fermionchain.Spinful_Fermionic_Chain(L)
h = 0
for i in range(L-1): # hopping t=1
h = h - (fc.Cdagup[i]*fc.Cup[i+1] + fc.Cdagup[i+1]*fc.Cup[i])
h = h - (fc.Cdagdn[i]*fc.Cdn[i+1] + fc.Cdagdn[i+1]*fc.Cdn[i])
for i in range(L):
h = h - mu*(fc.Nup[i] + fc.Ndn[i])
h = h + D*(fc.Cup[i]*fc.Cdn[i] + fc.Cdagdn[i]*fc.Cdagup[i]) # pairing
h = h + U*(fc.Nup[i]-.5)*(fc.Ndn[i]-.5)
fc.set_hamiltonian(h + B*fc.Sz[0])
fc.maxm, fc.nsweeps = 60, 30
return fc
bz = np.linspace(0, 4, 41).round(8)
parity, parity_ed, sz, sz_ed = [], [], [], []
for B in bz:
fc = impurity(B)
parity.append(fc.get_gs().get_fermionic_parity().real)
sz.append(fc.vev(sum(fc.Sz)).real)
parity_ed.append(fc.get_gs(mode="ED").get_fermionic_parity().real)
sz_ed.append(fc.vev(sum(fc.Sz), mode="ED").real)
# field where the ED parity flips, by bisection
lo, hi = 0.0, 4.0
while hi - lo > 1e-5:
mid = (lo + hi)/2
if impurity(mid).get_gs(mode="ED").get_fermionic_parity().real > 0:
lo = mid
else:
hi = mid
np.savez("data.npz", delta=deltas, gamma=gamma, gamma_ed=gamma_ed,
delta_ssh=delta_ssh, zak=zak, bz=bz, parity=parity,
parity_ed=parity_ed, sz=sz, sz_ed=sz_ed, b_c=(lo + hi)/2)
import numpy as np
import style
d = np.load("data.npz")
def wrap(g):
"""A phase in units of pi, mapped to [-1/2, 3/2) so that 0 and 2 meet."""
return (np.asarray(g) + 0.5) % 2 - 0.5
def draw(theme):
c = style.colors(theme)
fig, (a, b, e) = style.figure(3)
# at delta=0 the gap closes at k=pi, which is on the k grid, and the
# phase there is undefined: leave that point out
ok = np.abs(d["delta_ssh"]) > 1e-9
a.plot(d["delta_ssh"][ok], wrap(d["zak"][ok]), **style.reference(theme),
label="SSH Zak phase")
a.plot(d["delta"], wrap(d["gamma"]), "o", color=c["series"][0],
label="spin ring, DMRG")
a.set_xlabel(r"dimerization $\delta$")
a.set_ylabel(r"Berry phase $\gamma/\pi$")
a.set_yticks([0, 0.5, 1])
a.set_ylim(-0.15, 1.25)
a.legend(loc="upper right")
bc = float(d["b_c"])
b.plot(d["bz"], d["sz_ed"], **style.reference(theme), label="ED")
b.plot(d["bz"], d["sz"], "o", ms=3.5, color=c["series"][1], label="DMRG")
b.set_xlabel(r"impurity field $B$ [$t$]")
b.set_ylabel(r"total $\langle S^z\rangle$")
b.legend(loc="lower left")
e.plot(d["bz"], d["parity_ed"], **style.reference(theme), label="ED")
e.plot(d["bz"], d["parity"], "o", ms=3.5, color=c["series"][2],
label="DMRG")
e.set_xlabel(r"impurity field $B$ [$t$]")
e.set_ylabel(r"fermion parity $P$")
e.set_yticks([-1, 0, 1])
e.legend(loc="lower left")
for ax in (b, e):
ax.axvline(bc, color=c["ink2"], lw=0.8, ls=":")
return fig
style.main(draw, "topology_berry_phase")
Single-particle Berry phase¶
For a Bloch Hamiltonian \(H(k)\), the Zak phase of the occupied bands is the phase of the Wilson loop,
with \(m,n\) running over the occupied bands. It gives the polarization of
the band. Here hk(k) returns the Bloch matrix, with \(k\) from 0 to 1:
from dmrgpy import topology
gamma = topology.berry_phase_matrix(hk, nk=40) # the lower half of the bands is occupied
Fermion parity¶
For a fermionic chain the total parity is
It is \(+1\) or \(-1\) for a state with an even or odd number of fermions. In
a chain with superconducting pairing the particle number is not
conserved, but the parity is. A change of the ground-state parity as a
function of a parameter is a level crossing between the two sectors, as
in a Kitaev chain or a magnetic impurity in a superconductor. Here fc is
a Fermionic_Chain:
wf = fc.get_gs()
p = wf.get_fermionic_parity() # +1 or -1
p = wf.get_fermionic_parity(fpmode="iterative") # same number, other route
See examples/topological/parity for \(P\) as a function of the chemical
potential.
The middle and right panels of the figure in Many-body Berry phase show a chain of 6 sites with hopping \(t=1\), chemical potential \(\mu=-0.5\), onsite pairing \(0.5\,(c_{i\uparrow}c_{i\downarrow}+\mathrm{h.c.})\), a weak Hubbard interaction \(U=0.5\), and a Zeeman field \(B\,S^z_0\) on the first site, a magnetic impurity. At \(B\approx1.97\) the impurity binds one quasiparticle. The parity jumps from \(+1\) to \(-1\), and the total \(\langle S^z\rangle\) jumps from 0 to \(-1/2\) at the same field. DMRG (points) agrees with ED (dashed lines).