Hi, mtfishman
As discussed above, I expect to repeat the two dimensional models on infinite cylinders, such as the 2d heisenberg model, from this VUMPS paper. But there are some difficulties. As Vladimir said, these problems have been plaguing us for a long time. Next I will show my error code, it may have some naive mistakes.But I truly hope to get your help.
using MKL
using ITensorInfiniteMPS
using ITensors
include(
joinpath(
pkgdir(ITensorInfiniteMPS), "examples", "vumps", "src", "vumps_subspace_expansion.jl"
),
)
##############################################################################
# VUMPS parameters
#
maxdim = 256 # Maximum bond dimension
cutoff = 1e-6 # Singular value cutoff when increasing the bond dimension
max_vumps_iters = 100 # Maximum number of iterations of the VUMPS algorithm at each bond dimension
vumps_tol = 1e-6
conserve_qns = false
outer_iters = 10 # Number of times to increase the bond dimension
eager = true # Introduced in this PR
##############################################################################
# CODE BELOW HERE DOES NOT NEED TO BE MODIFIED
#
N = 6 # Number of sites in the unit cell
initstate(n) = isodd(n) ? "↑" : "↓"
s = infsiteinds("S=1/2", N; conserve_qns, initstate)
ψ = InfMPS(s, initstate)
function ITensorInfiniteMPS.unit_cell_terms(::Model"heisenberg2D", W = 6)
opsum = OpSum()
for i in 1:W
# up
opsum += -0.5, "S+", i, "S-", mod(i+1, W)
opsum += -0.5, "S-", i, "S+", mod(i+1, W)
opsum += "Sz", i, "Sz", mod(i+1, W)
# right
opsum += -0.5, "S+", i, "S-", i+W
opsum += -0.5, "S-", i, "S+", i+W
opsum += "Sz", i, "Sz", i+W
end
return opsum
end
model = Model("heisenberg2D")
# Form the Hamiltonian
H = InfiniteSum{MPO}(model, s)
# Check translational invariance
# println("\nCheck translation invariance of the initial VUMPS state")
# @show norm(contract(ψ.AL[1:N]..., ψ.C[N]) - contract(ψ.C[0], ψ.AR[1:N]...))
vumps_kwargs = (tol=vumps_tol, maxiter=max_vumps_iters, eager)
subspace_expansion_kwargs = (cutoff=cutoff, maxdim=maxdim)
ψ = vumps_subspace_expansion(H, ψ; outer_iters, subspace_expansion_kwargs, vumps_kwargs)
# Check translational invariance
# println()
# println("==============================================================")
# println()
# println("\nCheck translation invariance of the final VUMPS state")
# @show norm(contract(ψ.AL[1:N]..., ψ.C[N]) - contract(ψ.C[0], ψ.AR[1:N]...))
# Sz = [expect(ψ, "Sz", n) for n in 1:N]
energy_infinite = expect(ψ, H)
@show energy_infinite
The output before the error is
And the error is
ERROR: LoadError: OutOfMemoryError()
Stacktrace:
[1] Array
@ ./boot.jl:459 [inlined]
[2] similar
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/similar.jl:45 [inlined]
[3] similar
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/similar.jl:48 [inlined]
[4] similar
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/dense/dense.jl:91 [inlined]
[5] _similar_from_dims
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/tensor.jl:213 [inlined]
[6] _similar_from_dims
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/tensor.jl:207 [inlined]
[7] similar
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/tensor.jl:180 [inlined]
[8] contraction_output
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/dense/dense.jl:564 [inlined]
[9] contraction_output
@ /public2/kevinH/packages/packages/NDTensors/y9JPS/src/generic_tensor_operations.jl:28 [inlined]
[10] contract(T1::NDTensors.DenseTensor{Float64, 7, NTuple{7, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, labelsT1::NTuple{7, Int64}, T2::NDTensors.DenseTensor{Floa t64, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, labelsT2::Tuple{Int64, Int64, Int64}, labelsR::NTuple{8, Int64})
@ NDTensors /public2/kevinH/packages/packages/NDTensors/y9JPS/src/generic_tensor_operations.jl:66
[11] contract(::Type{NDTensors.CanContract{NDTensors.DenseTensor{Float64, 7, NTuple{7, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, NDTensors.DenseTensor{Float64, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}}}, t1::NDTensors.DenseTensor{Float64, 7, NTuple{7, Index{Int64}}, NDTensors.Dense{Float 64, Vector{Float64}}}, labels_t1::NTuple{7, Int64}, t2::NDTensors.DenseTensor{Float64, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}} }, labels_t2::Tuple{Int64, Int64, Int64})
@ NDTensors /public2/kevinH/packages/packages/NDTensors/y9JPS/src/generic_tensor_operations.jl:51
[12] contract
@ /public2/kevinH/packages/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:331 [inlined]
[13] _contract(A::NDTensors.DenseTensor{Float64, 7, NTuple{7, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, B::NDTensors.DenseTensor{Float64, 3, Tuple{Index{Int64}, I ndex{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}})
@ ITensors /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:1870
[14] _contract(A::ITensor, B::ITensor)
@ ITensors /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:1876
[15] contract(A::ITensor, B::ITensor)
@ ITensors /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:1980
[16] #233
@ /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2066 [inlined]
[17] BottomRF
@ ./reduce.jl:81 [inlined]
[18] afoldl
@ ./operators.jl:549 [inlined]
[19] _foldl_impl
@ ./tuple.jl:277 [inlined]
[20] foldl_impl
@ ./reduce.jl:48 [inlined]
[21] mapfoldl_impl
@ ./reduce.jl:44 [inlined]
[22] #mapfoldl#258
@ ./reduce.jl:162 [inlined]
[23] mapfoldl
@ ./reduce.jl:162 [inlined]
[24] #foldl#259
@ ./reduce.jl:185 [inlined]
[25] foldl
@ ./reduce.jl:185 [inlined]
[26] contract(As::NTuple{4, ITensor}; sequence::String, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensors /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2066
[27] contract
@ /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2062 [inlined]
[28] #contract#237
@ /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2076 [inlined]
[29] contract
@ /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2076 [inlined]
[30] #*#239
@ /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2086 [inlined]
[31] *(::ITensor, ::ITensor, ::ITensor, ::ITensor)
@ ITensors /public2/kevinH/packages/packages/ITensors/PisGD/src/itensor.jl:2086
[32] generate_twobody_nullspace(ψ::InfiniteCanonicalMPS, H::InfiniteSum{MPO}, b::Tuple{Int64, Int64}; atol::Float64)
@ ITensorInfiniteMPS /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/src/subspace_expansion.jl:84
[33] subspace_expansion(ψ::InfiniteCanonicalMPS, H::InfiniteSum{MPO}, b::Tuple{Int64, Int64}; maxdim::Int64, cutoff::Float64, atol::Float64, kwargs::Base.Pairs{Symbol, Union{}, Tu ple{}, NamedTuple{(), Tuple{}}})
@ ITensorInfiniteMPS /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/src/subspace_expansion.jl:195
[34] subspace_expansion(ψ::InfiniteCanonicalMPS, H::InfiniteSum{MPO}; kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:cutoff, :maxdim), Tuple{Float64, Int64}} })
@ ITensorInfiniteMPS /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/src/subspace_expansion.jl:321
[35] macro expansion
@ /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/examples/vumps/src/vumps_subspace_expansion.jl:14 [inlined]
[36] macro expansion
@ ./timing.jl:263 [inlined]
[37] tdvp_subspace_expansion(H::InfiniteSum{MPO}, ψ::InfiniteCanonicalMPS; time_step::Float64, outer_iters::Int64, subspace_expansion_kwargs::NamedTuple{(:cutoff, :maxdim), Tuple{ Float64, Int64}}, vumps_kwargs::NamedTuple{(:tol, :maxiter, :eager), Tuple{Float64, Int64, Bool}})
@ Main /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/examples/vumps/src/vumps_subspace_expansion.jl:9
[38] #vumps_subspace_expansion#9
@ /public2/kevinH/packages/packages/ITensorInfiniteMPS/Ogcvb/examples/vumps/src/vumps_subspace_expansion.jl:25 [inlined]
[39] top-level scope
@ /public2/kevinH/entanglement/2dheisenberg.jl:94
[40] include(fname::String)
@ Base.MainInclude ./client.jl:476
[41] top-level scope
@ REPL[3]:1
in expression starting at /public2/kevinH/entanglement/2dheisenberg.jl:94
It seems like I can’t get the right result because
- OutOfMemoryError(), program running stopped
- The energy in the unit cell does not converge, which is different from the previous result of one-dimensional heisenberg dmrg
So , in order to get the correct 2d heisenberg model on infinite cylinders. What should I do? Any answers and suggestions from you will be of great help to me!!!