Errors occured when one do subspace expansions in ITensorTDVP.jl

Hello everyone!

I want to use ITensorTDVP.jl to achieve global subspace expansion (GSE) TDVP algorithm to do real time evolution.

But errors occured when I use function ITensorTDVP.extend(psi,[psi,phi1,phi2]) to exptend basis.

ERROR: LoadError: `perutedims!(output_tensor::Tensor, tensor::Tensor, perm, f::Function=(r, t) -> t)` not implemented for `typeof(output_tensor) = NDTensors.DiagBlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.DiagBlockSparse{Float64, Float64, 2}}`, `typeof(tensor) = NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}`, `perm = (1, 2)`, and `f = #283`.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] permutedims!(output_tensor::NDTensors.DiagBlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.DiagBlockSparse{Float64, Float64, 2}}, tensor::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}, perm::Tuple{Int64, Int64}, f::Function)
    @ NDTensors C:\Users\Wang\.julia\packages\NDTensors\tAAFJ\src\generic_tensor_operations.jl:20
  [3] permutedims!!(output_tensor::NDTensors.DiagBlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.DiagBlockSparse{Float64, Float64, 2}}, tensor::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}, perm::Tuple{Int64, Int64}, f::Function)
    @ NDTensors C:\Users\Wang\.julia\packages\NDTensors\tAAFJ\src\generic_tensor_operations.jl:14
  [4] _map!!(f::Function, R::NDTensors.DiagBlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.DiagBlockSparse{Float64, Float64, 2}}, T1::NDTensors.DiagBlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.DiagBlockSparse{Float64, Float64, 2}}, T2::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}})
    @ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\itensor.jl:1921
  [5] map!(f::Function, R::ITensor, T1::ITensor, T2::ITensor)
    @ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\itensor.jl:1926
  [6] copyto!
    @ C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\broadcast.jl:321 [inlined]
  [7] materialize!
    @ .\broadcast.jl:871 [inlined]
  [8] materialize!
    @ .\broadcast.jl:868 [inlined]
  [9] -(A::ITensor, B::ITensor)
    @ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\itensor.jl:1843
 [10] extend(psi::MPS, phis::Vector{MPS}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\xjpcf\src\basis_extend.jl:47
 [11] extend(psi::MPS, phis::Vector{MPS})
    @ ITensorTDVP C:\Users\Wang\.julia\packages\ITensorTDVP\xjpcf\src\basis_extend.jl:21
 [12] top-level scope
    @ F:\data\superlattice\julia_example\GSE_TDVP\sl_gse_tdvp.jl:216
in expression starting at F:\data\superlattice\julia_example\GSE_TDVP\sl_gse_tdvp.jl:6

The following script shows the detail.

tstep=0.01
ttotal=100

sites=siteinds("Boson",L;conserve_qns = true,conserve_number = true,dim = 5)

#initial state
state=[]
for n=1:L
    if isodd(n)
        push!(state,"1")    
    elseif iseven(n)
        push!(state,"0")
    end
end
psi=productMPS(sites,state)

#MPO of hamiltonian
hal=OpSum()
    for i=1:L-1
        if isodd(i)
            hal += -j1,"Adag",i,"A",i+1
            hal += -j1,"Adag",i+1,"A",i
        elseif iseven(i)
            hal += -j2,"Adag",i,"A",i+1
            hal += -j2,"Adag",i+1,"A",i
        end
        hal += U/2,"N",i,"N",i
        hal += -U/2,"N",i
    end
hal += U/2,"N",L,"N",L
hal += -U/2,"N",L
H = toMPO(hal,sites)

#the first-order expansion of the time evolution operator,
Id=MPO(sites,"Id")
Krylov_MPO=Id-im*tstep*H

#time evolution
for i in 0:1:div(ttotal,tstep)
        tsofar=i*tstep
        @show tsofar
        noise=1e-14

        psi=normalize!(psi)
        phi1=apply(Krylov_MPO,psi)
        normalize!(phi1)
        phi2=apply(Krylov_MPO,phi1)
        normalize!(phi2)
       
       #subspace expansion
       psi=ITensorTDVP.extend(psi,[psi,phi1,phi2])
        phi1=0
        phi2=0
        phi3=0
       #one-site TDVP
        psi = tdvp(
            solver_backend="applyexp",
            H,
            -im*tstep,
            psi;
            nsweeps=1,
            maxdim=300,
            cutoff=1E-14,
            noise,
            reverse_step=true,
            nsite=1,
            order=1,
            outputlevel=1,
            normalize=true,
            solver_tol=1e-12,
            solver_maxiter=300,
            solver_krylovdim=50
        )  
end

Are there some mistakes in my script or did I misunderstand the way to achieve GSE-TDVP algorithm in ITensor?

Also, how could I set the “linkdim” larger than 1 when I want to use “MPS(sites,state)” or “productMPS(sites,state)” like randomMPS(sites,state;linkdims=50) to specify a certain initial state for the purpose of one-site TDVP real time evolution?
It seems like when “linkdim=1”, the initial MPS cannot totally evolved when use one-site TDVP.

Any help will be appreciate!

Hi, I think the GSE is not implemented in the 0.3.0 version of ITensorTDVP.jl. Is this some earlier version you are referring to?

Also, could you share the output of using Pkg; Pkg.status()? That error is coming from the file src/generic_tensor_operations.jl in NDTensors.jl but that file doesn’t even exist anymore in the latest version of the NDTensors.jl package: ITensors.jl/NDTensors/src at v0.5.8 · ITensor/ITensors.jl · GitHub. It looks like your packages must be out of date.