# Inconsistency between DMRG ground state energy and <psi|H|psi>

+1 vote

Using the packages developed for fermions, I wrote a very simple code to calculate the GS energy of free fermions.

## the code:

using ITensors
let
N = 4
numbsweeps = 5
sweeps = Sweeps(numb
sweeps)
maxdim!(sweeps,10,20,100,300,500)
cutoff!(sweeps,1e-10)

sites = siteinds("Fermion",N; conserve_qns = true)

# initialize a state at half-filling
states = vcat(["Occ" for n = 1:N/2],["Emp" for n = 1:N/2])
psi0 = productMPS(sites,states)

ampo = AutoMPO()
for j = 1:N-1
ampo += "C",j,"Cdag",j+1
ampo += "Cdag",j,"C",j+1
end
H = MPO(ampo,sites)

energy,psi = dmrg(H,psi0,sweeps)

println(inner(psi,*(H,psi)))

return


end

However, the GS energy calculated from inner(psi,*(H,psi)) is quite different from the result from DMRG. I also tried this for Ising spin chain, and it checks out there. For the fermion case, I don't know where went wrong. Any help is greatly appreciated.

Hi,

Thanks for the question. It looks like a problem with how the AutoMPO is defined. It should work if you change the definition to:

  ampo += "Cdag",j+1,"C",j
ampo += "Cdag",j,"C",j+1


This is pretty tricky, and easy to mess up, but for the sake of getting the correct Fermion signs in your Hamiltonian the order of the operators matters. Please look over the nice tutorial on Fermions by Miles here: https://itensor.org/docs.cgi?page=tutorials/fermions to understand this better.

Cheers,
Matt

commented by (700 points)
Thanks a lot!