Hi,
I am using the Julia version of ITensor and I was trying to compute the expected value of the operator
Rz(i) = exp[I pi Sz(i)],
where 'i' is a given site and 'I' is the imaginary number.
I did not manage to find a way to build the exponential of an operator using autoMPO. Am I missing something?
Nevertheless, going through the forum and some other documentation, I found a workaround to this. However, it is not working. Below, I show a minimal example code with my attempt. In this code, if I set 'i=1' or 'i=3', I get (Up,Z0,Dn| Rz(i) |Up,Z0,Dn) = -1, as expected. However, if I set 'i=2', I get 0, and I should get 1. Is this a bug?
Thanks a lot,
Gonçalo Catarina
PS: I just verified that removing 'conserve_sz=true' in this code makes it work.
using ITensors
Nsites = 3
sites = siteinds("S=1",Nsites;conserve_sz=true)
#build the state |Up,Z0,Dn>
statei = [isodd(i) ? "Up" : "Dn" for i in 1:Nsites]
statei[2] = "Z0"
ψi = randomMPS(sites,statei)
i=2
exponenti = 1im*pi*op("Sz",sites,i)
Rzi = exp(exponenti)
print(inner(ψi,apply(Rzi,ψi)))