When I select a local Hilbert space with dimensions exceeding 10000, it will appear ERROR: LoadError: OutOfMemoryError()

I hope to use the fock state to expand a coherent state with a high average number of photons, so the dimension of the local Hilbert space of the photons I need is approximately 10000 or more. For this dimension, using the AutoMPO function to construct a Hamiltonian seems to exceed the upper limit of this function’s memory. When I reduce the dimension to 5000, it will work normally. So I want to know if there is a way to adjust the upper limit of the AutoMPO function?

ERROR: LoadError: OutOfMemoryError()
Stacktrace:
[1] Array
@ ./boot.jl:460 [inlined]
[2] similar
@ ~/.julia/packages/NDTensors/tAAFJ/src/abstractarray/similar.jl:56 [inlined]
[3] similar
@ ~/.julia/packages/NDTensors/tAAFJ/src/tensorstorage/similar.jl:40 [inlined]
[4] similar
@ ~/.julia/packages/NDTensors/tAAFJ/src/tensor/similar.jl:22 [inlined]
[5] contraction_output
@ ~/.julia/packages/NDTensors/tAAFJ/src/dense/dense.jl:560 [inlined]
[6] contraction_output
@ ~/.julia/packages/NDTensors/tAAFJ/src/generic_tensor_operations.jl:47 [inlined]
[7] contract(tensor1::NDTensors.DenseTensor{ComplexF64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{ComplexF64, Vector{ComplexF64}}}, labelstensor1::Tuple{Int64, Int64}, tensor2::NDTensors.DenseTensor{Float64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, labelstensor2::Tuple{Int64, Int64}, labelsoutput_tensor::NTuple{4, Int64})
@ NDTensors ~/.julia/packages/NDTensors/tAAFJ/src/generic_tensor_operations.jl:93
[8] contract(::Type{NDTensors.CanContract{NDTensors.DenseTensor{ComplexF64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{ComplexF64, Vector{ComplexF64}}}, NDTensors.DenseTensor{Float64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}}}, tensor1::NDTensors.DenseTensor{ComplexF64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{ComplexF64, Vector{ComplexF64}}}, labels_tensor1::Tuple{Int64, Int64}, tensor2::NDTensors.DenseTensor{Float64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}}, labels_tensor2::Tuple{Int64, Int64})
@ NDTensors ~/.julia/packages/NDTensors/tAAFJ/src/generic_tensor_operations.jl:76
[9] contract
@ ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:331 [inlined]
[10] _contract(A::NDTensors.DenseTensor{ComplexF64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{ComplexF64, Vector{ComplexF64}}}, B::NDTensors.DenseTensor{Float64, 2, Tuple{Index{Int64}, Index{Int64}}, NDTensors.Dense{Float64, Vector{Float64}}})
@ ITensors ~/.julia/packages/ITensors/4aoLl/src/tensor_operations/tensor_algebra.jl:3
[11] _contract(A::ITensor, B::ITensor)
@ ITensors ~/.julia/packages/ITensors/4aoLl/src/tensor_operations/tensor_algebra.jl:9
[12] contract(A::ITensor, B::ITensor)
@ ITensors ~/.julia/packages/ITensors/4aoLl/src/tensor_operations/tensor_algebra.jl:104
[13] *
@ ~/.julia/packages/ITensors/4aoLl/src/tensor_operations/tensor_algebra.jl:91 [inlined]
[14] afoldl
@ ./operators.jl:533 [inlined]
[15] *(a::Complex{Int64}, b::Float64, c::ITensor, xs::ITensor)
@ Base ./operators.jl:560
[16] top-level scope
@ ~/transferred_from_sc50180/lhy/mps/mpshhg-1mode-testcoherent1/mps_hhg_quantumfield.jl:163
in expression starting at /public4/home/sc55941/transferred_from_sc50180/lhy/mps/mpshhg-1mode-testcoherent1/mps_hhg_quantumfield.jl:163

You may just be running out of memory on your computer, that’s a very large local Hilbert space to use.

About your question, is your current plan is to work with matrix product states having a site dimension of 10,000? Just wanted to understand which dimension you were talking about.

If that’s correct, I think you are going to run into many challenges apart from issues with ITensor. (As Matt said, one of them is running out of memory for normal reasons like tensors just being very large.) Also, using a very large site dimension can drastically slow down most tensor network algorithms. Depending on the details of the system you are wanting to study, a different approach that could work well for you could be the one used to represent bosons in this paper: