Can not pass Array type parameters to ITensorTDVP.tdvp()

Hello everyone!

I’m trying to use ITensorTDVP.jl do some time-evolving tests.

When I pass array type parameters like “maxdim”,“cutoff” to ITensorTDVP.tdvp(), here comes an error.

ERROR: LoadError: BoundsError: attempt to access 1-element Vector{Any} at index [2]
Stacktrace:
 [1] setindex!
   @ .\essentials.jl:492 [inlined]
 [2] setindex!
   @ .\array.jl:980 [inlined]
 [3] _extend_sweeps_param(param::Vector{Int64}, nsweeps::Int64)
   @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\u9Bwz\src\tdvp_generic.jl:24
 [4] process_sweeps(; kwargs::Base.Pairs{Symbol, Any, NTuple{13, Symbol}, NamedTuple{(:nsweeps, :solver_backend, :maxdim, :cutoff, :noise, :reverse_step, :nsite, :order, :outputlevel, :normalize, :solver_tol, :solver_krylovdim, :solver_maxiter), Tuple{Int64, String, Vector{Int64}, Vector{Float64}, Vector{Float64}, Bool, Int64, Int64, Int64, Bool, Float64, Int64, Int64}}})
   @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\u9Bwz\src\tdvp_generic.jl:37
 [5] tdvp(solver::Function, PH::ProjMPO, t::ComplexF64, psi0::MPS; kwargs::Base.Pairs{Symbol, Any, NTuple{13, Symbol}, NamedTuple{(:solver_backend, :nsweeps, :maxdim, :cutoff, :noise, :reverse_step, :nsite, :order, :outputlevel, :normalize, :solver_tol, :solver_krylovdim, :solver_maxiter), Tuple{String, Int64, Vector{Int64}, Vector{Float64}, Vector{Float64}, Bool, Int64, Int64, Int64, Bool, Float64, Int64, Int64}}})
   @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\u9Bwz\src\tdvp_generic.jl:49
 [6] tdvp(solver::Function, H::MPO, t::ComplexF64, psi0::MPS; kwargs::Base.Pairs{Symbol, Any, NTuple{13, Symbol}, NamedTuple{(:solver_backend, :nsweeps, :maxdim, :cutoff, :noise, :reverse_step, :nsite, :order, :outputlevel, :normalize, :solver_tol, :solver_krylovdim, :solver_maxiter), Tuple{String, Int64, Vector{Int64}, Vector{Float64}, Vector{Float64}, Bool, Int64, Int64, Int64, Bool, Float64, Int64, Int64}}})
   @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\u9Bwz\src\tdvp_generic.jl:150
 [7] #tdvp#41
   @ C:\Users\Wang\.julia\packages\ITensorTDVP\u9Bwz\src\tdvp.jl:47 [inlined]
 [8] macro expansion
   @ .\timing.jl:262 [inlined]
 [9] top-level scope
   @ G:\data\superlattice\julia_example\sl_tdvp\test\sweep_2\order1\sl_tdvp.jl:227
in expression starting at G:\data\superlattice\julia_example\sl_tdvp\test\sweep_2\order1\sl_tdvp.jl:6

Here is part of my code.

maxdim=[200,250,400,600,800,1200,2000,2400,2600,3000]
cutoff=[1e-10,1e-10,1e-12,1e-12,1e-12,1e-12,1e-14,1e-14,1e-14,1e-14]
noise=[1e-8,1e-8,1e-10,1e-12,1e-12,1e-14,1e-14,0,0,0] 
psi = @time tdvp(
            solver_backend="applyexp",
            H,
            -im * tstep,
            psi;
            nsweeps=20,
            maxdim,
            cutoff,
            noise,
            reverse_step=false,
            nsite=2,
            order=2,
            outputlevel=1,
            normalize=true,
            solver_tol=1e-12,
            solver_krylovdim=25,
            solver_maxiter=300,
        )  

Thank you.

Sorry, but I’m not able to reproduce your issue when I run the code. I did get a similar error and error message when I set nsweeps to be less than the length of the arrays of parameters, but for nsweeps=20 it worked correctly.

Can you please do the following steps:

  • make sure your code is updated to the latest version of ITensorTDVP (version 0.1.1)
  • try again after that, making sure nsweeps is greater than or equal to the number of parameters in the arrays
  • if the bug still persists, could you please post an issue on the ITensorTDVP package with a fully working, minimal code that reproduces the error?

Thanks!

1 Like