0 votes
asked by (350 points)

I understand how to go about measuring a two-point correlator with respect to some eigenstate of the Hamiltonian - we simply follow the prescription outlined here . However how would we go about calculating < phi|OP1OP2|psi>, for two different eigenstates |phi> and |psi>? My attempt at the code is

auto op_i = sites.op(opi,i);
auto op_j = sites.op(opj,j);


auto ir = commonIndex(psi1.A(i),psi1.A(i+1),Link);
auto C = psi2.A(i)*op_i*dag(prime(psi1.A(i),Site,ir));

for(int k = i+1; k < j; ++k)
    C *= psi1.A(k);
    C *= dag(prime(psi2.A(k),Link));

C *= psi1.A(j);
C *= op_j;

auto jl = commonIndex(psi2.A(j),psi2.A(j-1),Link);
C *= dag(prime(psi2.A(j),jl,Site));
complex<double> result = C.cplx();
return result;

Similarly to calculate an expectation value of one operator, we take

auto opi = sites.op(op_i,i);
complex<double> result = (dag(prime(psi.A(i),Site))*opi*psi.A(i)).cplx();
return result;

Whereas the matrix element generalization

auto opi = sites.op(op_i,i);
complex<double> result = (dag(prime(psi1.A(i),Site))*opi*psi2.A(i)).cplx();
return result;

does not work. In the case of a two point correlator, I'm told that I need to pass 4 indices to .cplx(), and in the case of the matrix element I'm missing two indices. What am I missing? Thanks!

1 Answer

+1 vote
answered by (70.1k points)
selected by
Best answer

Hi, so you are on the right track; however, because these are two different MPS, they will have in general totally different bond/virtual/link indices. So the trick used in the code formula you based your code on will not work, specifically the part where the code skips over the MPS "A" tensors to the left of site i.

Instead, you will have to contract the two MPS together without using any aspect of their respective self-orthogonality properties.

Here is link to a new code formula I just posted for doing this, in response to your question:

commented by (350 points)
Unbelievable! Exactly what I needed thank you Miles. So say if i is 1, then would my definition of M change to M = psi.A(1)*op_i*dag(prime(phi.A(1),"Link")); ?
commented by (70.1k points)
Almost: you'd need to remove the Link argument from the priming function. (If you don't mind me suggesting, I'd suggest that when you read and develop code like this, that you always draw the associated diagrams.) The reason to remove the Link IndexType from the arguments to prime is that you also want to prime the Site index of that tensor, so that it contracts with the primed site index of op_i.

By the way, I made a small mistake in that code formula, which I just now fixed: the Link arguments should not be strings. The reason I had made them strings is that in the upcoming new version of ITensor, we are overhauling the IndexType system and replacing it with a string-based "tags" system.
commented by (350 points)
Understood. Thank you!
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.