In the following code, after obtaining the ground state psi of the Hamiltonian H using DMRG, I verify the normalization by checking inner(psi, psi) and trace(rho), where rho = outer(dag(psi), psi). I find that inner(psi, psi) equals 1 up to an error on the order of 10⁻¹⁴, while trace(rho) deviates from 1 by about 10⁻⁶. I would like to understand the source of this discrepancy. Specifically, does the outer function automatically introduce truncation or compression that could explain the larger error in trace(rho)? Or might there be a mistake in how I’m computing the trace of rho? Thanks!
Nuc=60
sites = siteinds("S=1/2",Nuc)
J=1.0
os = OpSum()
for j=1:Nuc-1
if j==Nuc
jp=1
else
jp=j+1
end
os += -4J,"Sz",j,"Sz",jp
os += -2,"Sx",j
end
os += -2,"Sx",Nuc
H = MPO(os,sites)
psi0 = productMPS(sites, n -> isodd(n) ? "Up" : "Dn")
nsweeps = 15
maxdim = [10,20,100,100,200,200,300,300,400,500]
noise=[1E-3,1E-5,1E-7,1E-7,1E-9,1E-9,1E-11,1E-11,1E-13,1E-13,1E-14,1E-15]
cutoff = [1E-12]
energy0, psi = dmrg(H,psi0; nsweeps, maxdim, noise, cutoff)
orthogonalize!(psi, 1)
rho0=outer(psi',psi)
println(inner(psi,psi))
aaa=ITensor(1.0)
for i=1:Nuc
rho0[i]=rho0[i]*delta(sites[i],sites[i]')
aaa*=rho0[i]
end
println(aaa)

