Download this notebook (.ipynb + data files)
7. Hubbard Model with \(t'\)#
Author: Kyle Eskridge
In this tutorial, we will perform AFQMC calculations for the Hubbard model with \(t'\) on a 4×8 lattice. The Hamiltonian is given by,
See Table I of reference [1]. The AFQMC energy using a free-electron trial wavefunction is, for \(U=4\) on a 4×8 square lattice with \(N_\uparrow = N_\downarrow = 16\), \(-27.271(1)\) versus \(-27.6924\) from DMRG. (Better AFQMC results exist there when using a self-consistent procedure).
References:
https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.3.013065
7.1. Setup - Make a Lattice#
# create scratch directory in notebook path
%mkdir -p {_dh[0]}/data
%cd -q {_dh[0]}/data
from safiretools import Lattice
from safiretools import vis
lattice = Lattice.from_type("square", (4, 8), boundaries=("periodic", "open"), twists=(0.0, 0.0))
vis.plot_lattice(lattice)
7.2. Setup - Make the Hamiltonian#
from safiretools import LatticeHamiltonian, PinningField
# AFM pinning field of ±0.25 on the open edges y=1 and y=Ly, with opposite
# signs on the two edges.
hamiltonian = LatticeHamiltonian.from_lattice(
lattice,
t=[1.0, 0.3],
U=4,
pinning=(None, PinningField.afm(0.5, staggered=True)),
)
7.3. Setup - Trial Wavefunction#
# First, let's compute the free-electron trial wavefunction
from safiretools import Wavefunction
nelec = (16,16)
wfn = Wavefunction.from_free_electron(
source=hamiltonian,
nelec=nelec
)
# get lattice dimensions from the Lattice instance
L = lattice.L
import numpy as np
# one-rdm of the free-electron determinant
alpha, beta = wfn.determinant(0)
rdm = np.array([alpha.conj() @ alpha.T, beta.conj() @ beta.T])
# collinear
rho_up = rdm[0].diagonal().reshape(*L)
rho_down = rdm[1].diagonal().reshape(*L)
rho_charge = rho_up + rho_down
vis.plot_lattice(
lattice,
density=rho_charge.real,
density_label="charge density",
vmin=0.0,
vmax=2.0
)
rho_spin = 0.5*(rho_up - rho_down)
vis.plot_lattice(
lattice,
density=rho_spin.real,
density_label="spin density",
vmin=-0.5,
vmax=0.5
)
7.4. Setup - Write a SAFIRE Input File#
# make a JSON job file
from safiretools import write_jobfile
bp_lengths = [200, 400, 600]
write_jobfile("afqmc.json", {
"seed": 42, # for reproducibility
"execute": {
"wavefunction": wfn,
"hamiltonian": hamiltonian,
"timestep": 0.01,
"steps": 12000,
"num_walkers": 480,
"population_control_interval": 5,
"walker_ortho_interval": 5,
"measure_interval": 10,
"equilibration_steps": 2400,
"propagator": {
"use_cp_constraint": True,
"project_force_bias": True
},
"estimators": {
"backprop": {
"walker_ortho_interval": 5,
"propagation_steps": bp_lengths,
"onerdm": {}
}
}
}
})
7.4.1. Running AFQMC#
!mpirun -n 16 $AFQMC_EXEC afqmc.json
7.5. Analysis - Compute the AFQMC Energy#
We compare the AFQMC energy to the value \(-27.271(1)\) from reference [1].
import matplotlib.pyplot as plt
from safiretools import Results
E_ref = -27.271 # reference [1]
results = Results("afqmc.results.h5")
vis.plot_timeseries(results)
plt.axhline(E_ref, color="crimson")
7.6. Analysis - Compute the Average One-Body Reduced Density Matrix#
To check for convergence here, we will compute the spin density from the back-propagated one-body reduced density matrix for each back-propagation length \(m_\mathrm{BP}\) saved in the output HDF5 file, and plot it along a line cut of the lattice for each \(m_\mathrm{BP}\). We should see the density matrix converge for some value of \(m_\mathrm{BP}\).
ix = 3
def spin_cut(rdm):
"""S^z along the line cut at ix, from a collinear one-rdm."""
rho_spin = 0.5*(rdm[0].diagonal() - rdm[1].diagonal()).real
return rho_spin.reshape(lattice.L)[ix]
rho_spin, rho_spin_err = {}, {}
for steps in bp_lengths:
rho_spin[steps], rho_spin_err[steps] = results.evaluate(spin_cut, [f"BackPropEstimator/Steps={steps}/OneRDM"])
iy = np.arange(lattice.L[1])
for steps in bp_lengths:
plt.errorbar(iy,rho_spin[steps],yerr=rho_spin_err[steps],fmt='o-',label=f"{steps} steps")
plt.xlabel("y")
plt.ylabel("Spin Density")
plt.legend()
plt.show()