Dear friend,
I’m testing the sample code given in the documentation. Simply run a DMRG sweep for a spin one antiferromagnetic Heisenberg chain. Strangely, this takes me a huge number of sweeps to get converged.
Here is the code, I run DMRG to get the ground state and output entanglement entropy every 30 sweeps. While typically 30 sweeps is sufficient for a normal DMRG calculation to get converged. For such a simple system it takes 150 sweeps.
using ITensors, ITensorMPS
using CairoMakie
function entropy_von_neumann(psi::MPS,N)
s = siteinds(psi)
SvNlist = []
for b in 2:N
orthogonalize!(psi, b)
_,S = svd(psi[b], (linkind(psi, b-1), s[b]))
SvN = 0.0
for n in 1:dim(S, 1)
p = S[n,n]^2
SvN -= p * log(p)
end
push!(SvNlist, SvN)
end
return SvNlist
end
let
N = 48
sites = siteinds("S=1",N;conserve_qns=true)
# sites = siteinds("S=1",N)
os = OpSum()
for j=1:N-1
os += 1, "Sz",j,"Sz",j+1
os += 0.5,"S+",j,"S-",j+1
os += 0.5,"S-",j,"S+",j+1
end
H = MPO(os,sites)
state = [isodd(n) ? "Up" : "Dn" for n=1:N]
psi = randomMPS(sites,state,120)
@show flux(psi)
fig = Figure(size = (800, 600))
ax = Axis(fig[1, 1]; xlabel = "x", ylabel = "Von Neumann Entropy", title = "Entanglement Entropy vs x")
for iter in 1:10
nsweeps = 30
maxdim = [120]
cutoff = [1E-10]
energy, psi = dmrg(H,psi; nsweeps, maxdim, cutoff)
ee = entropy_von_neumann(psi,N)
ee_all = vcat([0],ee)
scatterlines!(ax, 1:N-1, ee; marker = :circle, label = "Iteration $iter")
end
axislegend(ax, position = :rt, fontsize = 10)
display(fig)
end
The output is
I’m wondering if there are physical reasons for such slow convergence?
Thank you
