Hi,
I have a system of spin-1/2 XXZ of length L. I want to compute the expectation value of the bond energy defined as
I can use the expect
function for a single site operator. Is there a way to implement this for a 2-site operator like the one described above? I could think about 2 different ways of doing it naively -
- Define a two-site operator using
ITensors.op(::OpName"E12", ::SiteType"S=1/2") = Matrix
, where Matrix is the (2,2,2,2) tensor for the above 2 site operator. Then use theapply(gate,psi)
function to act this gate on the MPS and compute its inner product with psi usinginner
.
ITensors.op(::OpName"E12", ::SiteType"S=1/2") = Matrix
gates = ITensor[]
push!(gates,op("E12",s[1],s[2]))
E12_psi = apply(gates, psi)
E12_val = inner(psi',E12_psi)
- Another way of doing it would be following what is suggested in the ITensor documentation
orthogonalize!(psi,1)
E12_psi = deepcopy(psi)
ITensors.op(::OpName"E12", ::SiteType"S=1/2") = Matrix
G = op("E12",s[1],s[2])
wf = (E12_psi[1]*E12_psi[2])*G
inds3 = uniqueinds(E12_psi[1],E12_psi[2])
U,S,V = svd(wf,inds3,cutoff=1E-8)
E12_psi[1] = U
E12_psi[2] = S*V
E12_val = inner(psi',E12_psi)
The first method works, but is it possible to use the operator “E12” with the function expect
? Something similar was suggested in this discussion, but I could not understand how to use it and would appreciate any help regarding this.
The second method gives me an error about matching indices. It would be very helpful if someone could help me understand where I am going wrong in the second approach.
Finally, I would like to know which is the best method to compute this expectation value.
Thanks.