# MPO for number operators and the calculation of correlation function in VUMPS

Hi Matt,

I have been trying to define the MPO for electron number operators following the definition of the Hamiltonian MPO:

``````function ITensorInfiniteMPS.unit_cell_terms(::Model"eNumber")
opsum = OpSum()
opsum += "Ntot", 1
return opsum
end

NumberOp = InfiniteSum{MPO}(Model("eNumber"), s)
``````

However, I got the error “LoadError: MethodError: no method matching translatecell(::ITensorInfiniteMPS.var”#_shift_cell#149"{Int64}, ::Scaled{ComplexF64, Prod{Op}}, ::Int64)".

Another related question is how do we calculate the electron correlation functions in VUMPS? Is there a documentation or example that I could refer to?

-Meng

Hi Meng-Zeng,

I also would like to calculate correlation functions by VUMPS. Any insights on that? Or do you find any references?

Best,
Feng

This example includes computing a correlation matrix by slicing an infinite MPS to a finite MPS and computing the correlation matrix of that slice with ITensors.jl: https://github.com/ITensor/ITensorInfiniteMPS.jl/blob/main/examples/vumps/vumps_hubbard_extended.jl

@Meng-Zeng could you show a complete runnable example? For example, you don’t show what `s` is.

Hi everyone.

@mtfishman Not sure if I should make a new question, but this error is exactly what I get when I try to construct the infinite MPO for a Hamiltonian of a custom model. Here is a runnable example.

``````m2= 10
ld =1

maxdim = 100 # Maximum bond dimension
cutoff = 1e-8 # 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 = 8 # Number of times to increase the bond dimension

N = 10 # Number of sites in the unit cell

initstate(n) = isodd(n) ? "1" : "2"
s = infsiteinds("Boson", N; dim=8, conserve_qns, initstate)
ψ = InfMPS(s, initstate)

model = Model("Realphi4")

# Form the Hamiltonian
H = InfiniteSum{MPO}(model, s)
``````

Where the “Realphi4” model is

``````function ITensorInfiniteMPS.unit_cell_terms(::Model"Realphi4")
opsum = OpSum()
opsum += 0.5, "cpi2",1
opsum += 0.5*(1+m2), "phi",1,"phi",1
opsum += 0.5, "phi",2,"phi",2
opsum += -1, "phi",1,"phi",2
opsum += ld/24 ,"phi",1,"phi",1,"phi",1,"phi",1
return opsum
end
``````

where the local custom operators have matrix elements equivilent to superpositions of A and Adag, and their squares.

The error comes from the InfiniteSum. Thanks!

Best,
Jake