exponential operator

I wish to calculate the expectation value of the following operator:

\hat{O} = e^{i \pi (S^x_1 + S^y_2 + S^z_3)}

I am trying to do this in the following way

s1 = Op("Sx",1)
s2 = Op("Sy",2)
s3 = Op("Sz",3)

O = Prod{Op}()
O *= exp(im*pi*s1)
O *= exp(im*pi*s2)
O *= exp(im*pi*s3)
K = MPO(W,sites)
#for some MPS psi
l = real(inner(psi, apply(K, psi)))

But I keep getting error:

LoadError: MethodError: no method matching MPO(::ITensors.LazyApply.Exp{Scaled{ComplexF64, Op}}, ::Vector{Index{Int64}})

I tried a way around this by not converting exp(Op) to an MPO and just use it as an operator.

 ex1 = exp(im*pi*op("Sx",sites, 1))
 ey2 = exp(im*pi*op("Sy",sites, 2))
 ez3 = exp(im*pi*op("Sz",sites, 3))
 ez = ex1*ey2*ez3
 l = real(inner(psi, apply(ez, psi)))

The preliminary check seems to give the right answer, it might be a bit slow though.
Kindly correct me if you find an error.

That’s the best way to do that right now and what I would have suggested. In principle we could make the first one work but it would get very complicated getting general algebraic expressions to work in the MPO construction (it is already complicated enough with the current system of just supporting sums of products of operators).

Thank you for your reply. I had tested the second method for S=1/2. However, when I am performing the same calculation for S=1, the memory requirement is increasing drastically. I am providing 200Gb memory for the calculation S=1, which doesn’t seem to be enough. I had provided 100gb for S=1/2 system for the same system size and it had worked without any error.

Maybe instead of contracting the tensors like this:

you meant to put them into an MPO like this:

 ez = MPO([ex1, ey2, ez3])

or you can put them into a list of gates and apply them like this:

apply([ex1, ey2, ez3], psi)

It really depends on what operations you are interested in. I assume you mean that it runs out of memory if you try to use larger system sizes, since I doubt you could be using that much memory with a system of just 3 sites.

Using it like the following way worked:

I am indeed using it for larger system sizes, so the way I was using it was creating some issues with memory.

1 Like