Hello,
I have been experimenting with ITensor’s DMRG so I can have easy quantum number conservation. Previously, I was using QUIMB to do DMRG, and the DMRG algorithm used there could find the ground state significantly faster (around 2 seconds for my system). Using ITensor, the DMRG process now takes around 90 seconds with around 70 seconds being used to do just the first sweep. Is there any reason for this? Anything I am doing wrong? I am solving for an ab initio quantum chemistry Hamiltonian.
Code:
let
N = 8
δ = 1.0
g = 0.5
t, Γ = pairing_hamiltonian(δ, g, N)
# Convert the DataFrame to a standard Julia array
sites = siteinds("Fermion",N; conserve_qns=true)
os = OpSum()
ops = Any[]
push!(ops,E)
for i in 1:N
push!(ops, "Id")
push!(ops, i)
os .+= Tuple(ops)
end
for i in 1:N, j in 1:N
#one body terms
if t[i,j] == 0
continue
end
ops = Any[]
push!(ops,t[i,j])
push!(ops, "Cdag")
push!(ops, i)
push!(ops, "C")
push!(ops, j)
println(ops)
os .+= Tuple(ops)
end
for i in 1:N, j in 1:N, k in 1:N, l in 1:N
#two body terms
if Γ[i,j,k,l] < 1.0e-5
continue
end
ops = Any[]
print(i)
push!(ops,Γ[i,j,k,l]*(1/4))
push!(ops, "Cdag")
push!(ops, i)
push!(ops, "Cdag")
push!(ops, j)
push!(ops, "C")
push!(ops, l)
push!(ops, "C")
push!(ops, k)
println(ops)
os .+= Tuple(ops)
end
println("done")
H = cuMPO(os,sites)
println("MPO made, starting DMRG")
println(totalqn(H))
nsweeps = 5 # number of sweeps is 5
maxdim = [10,10,20,30,40] # gradually increase states kept
mindim = [1,2,2,2,2]
cutoff = [1E-6,1E-8,1E-10,1E-12,1E-14] # desired truncation error
noise = [1E-7, 1E-8, 1E-10,1E-12,0]
state = ["1","1","1","1","0","0","0","0"]
psi0 = cuMPS(sites,state)
energy,psi = dmrg(H,psi0;nsweeps,maxdim,mindim,noise)
return
end
Output:
After sweep 1 energy=1.4167742892881572 maxlinkdim=8 maxerr=1.39E-16 time=74.167
After sweep 2 energy=1.4167742843511046 maxlinkdim=8 maxerr=7.74E-18 time=0.159
After sweep 3 energy=1.4167742843511038 maxlinkdim=8 maxerr=7.68E-19 time=0.089
After sweep 4 energy=1.416774284351104 maxlinkdim=8 maxerr=2.46E-18 time=0.022
After sweep 5 energy=1.416774284351103 maxlinkdim=4 maxerr=0.00E+00 time=19.825