Hello Miles and Matt,
I’ve been trying to under the VUMPS code for the Heisenberg model and then apply to my own multi-site unit cell model.
My first question is concerned with defining the Model using
function unit_cell_terms(::Model"MyModel")
opsum = OpSum()
opsum += ....
end
Assuming we have a unit cell consisting of 4 sites, and the interaction term O_1O_2O_3 spans 3 neighboring sites, then if I follow the Heisenberg model definition, I would put
opsum += O, 1, O, 2, O, 3
opsum += O, 2, O, 3, O, 4
Would ITensor automatically include the inter-cell terms like O_3O_4O_5 and O_4O_5O_6? It seems that it would from the given Heisenberg example, but I just want to double check.
My second question is about the following part for the Heisenberg VUMPS:
function expect_two_site(ψ::InfiniteCanonicalMPS, h::ITensor, n1n2)
n1, n2 = n1n2
ϕ = ψ.AL[n1] * ψ.AL[n2] * ψ.C[n2]
return inner(ϕ, apply(h, ϕ))
end
function expect_two_site(ψ::InfiniteCanonicalMPS, h::MPO, n1n2)
return expect_two_site(ψ, contract(h), n1n2)
end
bs = [(1, 2), (2, 3)]
energy_infinite = map(b -> expect_two_site(ψ, H[b], b), bs)
It seems to me that the defined function expect_two_site() only works for systems with two-site unit cell. If it’s my 4-site unit cell system, then would it be modified like the following?
function expect_four_site(ψ::InfiniteCanonicalMPS, h::ITensor, n1n2n3n4)
n1, n2, n3, n4 = n1n2n3n4 ## n1n2n3n4 is a four-element array
ϕ = ψ.AL[n1] * ψ.AL[n2]* ψ.C[n2] * ψ.AL[n3]* ψ.C[n3]* ψ.AL[n4]* ψ.C[n4]
return inner(ϕ, apply(h, ϕ))
end
function expect_four_site(ψ::InfiniteCanonicalMPS, h::MPO, n1n2n3n4)
return expect_four_site(ψ, contract(h), n1n2n3n4)
end
bs = [(1, 2, 3, 4), (2, 3, 4, 5), (3, 4, 5, 6), (4, 5, 6, 7)]
energy_infinite = map(b -> expect_four_site(ψ, H[b], b), bs)
Thanks a lot for your time and I apologize for the long question.
-Meng