Converting Finite MPS to Infinite MPS

Hi,

I am trying to convert a finite qn-conserving MPS (whose natural unit cell is, say, 5 sites long) to an infinite MPS through the following procedure. I would like to select out the middle 5 tensors from the finite MPS and then use these to construct a uniform MPS consisting of these 5 tensors repeated. Finally, I would like to ensure that this infinite MPS can be written to disk, read, and fed into ITensor’s VUMPS implementation.

My code is as follows:

using ITensors, ITensorMPS
using ITensorInfiniteMPS
using HDF5



base_path = joinpath(pkgdir(ITensorInfiniteMPS), "examples", "vumps", "src")
src_files = ["vumps_subspace_expansion.jl", "entropy.jl"]
for f in src_files
  include(joinpath(base_path, f))
end


directory_name="foo"
filename = directory_name*"/"*"MPS_GS.h5" #Reading Finite MPS, with QNs


ψfin= h5open(filename,"r") do fi
read(fi,"psi",MPS)
end
s = siteinds(ψfin) 

unit_start = 101;                # starting site of unit cell
cellrange = unit_start:unit_start+4;  # 5 sites
cell_sites = s[cellrange];              
cell_data  = [ψfin[n] for n in cellrange];
cell_data  = CelledVector{ITensor}(cell_data)

llim, rlim = 1, length(cell_data) 


ϕ = InfiniteMPS(cell_data, llim, rlim)  # Attempting to make Infinite MPS



file_name_UMPS = directory_name*"/"*"UMPS_GS.h5" 
f = h5open(file_name_UMPS,"w")
write(f,"psi",ϕ) #Attempting to Write Infinite MPS
close(f)


###READING INFINITE MPS
ψ = h5open(filename,"r") do fi
read(fi,"psi",InfiniteCanonicalMPS)
end

s = siteinds(ψ) 

###FORM HAMILTONIAN SOMEWHERE HERE

vumps_kwargs = (
  tol=tol,
  maxiter=max_vumps_iters,
  solver_tol=solver_tol,
  multisite_update_alg=multisite_update_alg,
)
subspace_expansion_kwargs = (cutoff=cutoff, maxdim=maxdim)

###FEED INFINITE MPS TO VUMPS
ψ = vumps_subspace_expansion(H, ψ; outer_iters, subspace_expansion_kwargs, vumps_kwargs)

At the present moment, the step

write(f,"psi",ϕ)

fails with the following error

ERROR: LoadError: Argument is an incomplete CelledVector type and does not have a definite size.
Stacktrace:

I would like to understand whether I’m constructing the InfiniteMPS struct incorrectly, and if so how to fix this. (I included the part of the code where I feed the constructed InfiniteMPS into VUMPS, which I have not been able to test – however if there is any failure anticipated here, that would be good to know as well.)

Thanks very much!