Domain: Physics — Quantum Mechanics

Problem:
Prompt:

Consider a 1D spin-1/2 XXZ chain of length \(L=16\) with periodic boundary conditions. The Hamiltonian is

\[
H = J_{xy} \sum_{j=1}^L \left( S_j^x S_{j+1}^x + S_j^y S_{j+1}^y \right) + J_{zz} \sum_{j=1}^L S_j^z S_{j+1}^z + h \sum_{j=1}^L S_j^z,
\]

where \(S_j^\alpha\) are Pauli matrices for spin at site \(j\) (\(S^x, S^y, S^z\)), \(J_{xy}=1.0\), \(J_{zz}=1.2\), and \(h=0.7\). Using all many-body states explicitly, compute the ground state energy \(E_0\) of this Hamiltonian.
 Provide the final answer/ground state energy rounded to three decimal places.

Answer: -8.009

Solution code:
import numpy as np
from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.linalg import eigsh

L = 16
J_xy = 1.0
J_zz = 1.2
h = 0.7
dim = 2**L

H = lil_matrix((dim, dim), dtype=np.float64)

def bit(state, i):
    return (state >> i) & 1

for state in range(dim):
    Sz_list = [1 if bit(state, site) else -1 for site in range(L)]
    diag = 0
    # Diagonal: J_zz and h terms, with correct spin-1/2 prefactors
    for j in range(L):
        # S^z S^z: (sigma^z/2)*(sigma^z/2) = (1/4)*sigma^z sigma^z
        diag += (J_zz * 0.25) * Sz_list[j] * Sz_list[(j+1)%L]
        # Field: (h/2) * sigma^z
        diag += (h * 0.5) * Sz_list[j]
    H[state, state] = diag

    # Off-diagonal XY terms: J_xy/2 * (S^+ S^- + S^- S^+), corresponds to (J_xy/2)*flip
    for j in range(L):
        if Sz_list[j] != Sz_list[(j+1)%L]:
            flip = state ^ (1 << j) ^ (1 << ((j+1)%L))
            H[state, flip] += J_xy * 0.5

H_csr = csr_matrix(H)
E0 = eigsh(H_csr, k=1, which='SA', maxiter=100000, return_eigenvectors=False)[0]
print(round(E0, 3))