+1 vote
asked by (300 points)
edited by

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)))

1 Answer

+1 vote
answered by (14.1k points)

Thanks for the report, indeed that is a bug.

The technical explanation of what is going on is that in the QN case, right now the code is only exponentiating the QN blocks that exist, but it is failing to treat ones on the diagonal that don't exist as zero which should get exponentiated to identity.

Should be a quick fix, thanks for pointing out this issue!

commented by (300 points)
Great, thanks a lot!
Please let me know when it is fixed.
commented by (14.1k points)
I fixed it here: https://github.com/ITensor/ITensors.jl/pull/682

It will be included in ITensors.jl v0.2.0, which hopefully we will release today.

You can try it out now by doing `add ITensors#main` in Pkg mode at the Julia REPL (see here https://itensor.github.io/ITensors.jl/dev/AdvancedUsageGuide.html#Installing-and-updating-ITensors.jl-1).
commented by (300 points)
I confirm it is now working properly, not only for this minimal example code but also for other codes that I have.
Again, thanks a lot!
commented by (14.1k points)
ITensors.jl v0.2.0 is now registered, so you can do:

julia> using Pkg

julia> Pkg.free("ITensors")

julia> Pkg.update("ITensors")

to use the official registered version.
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...