0 votes
asked by (160 points)

Hi!

I have two states created with the same Site properties, e.g. \psi1 and \psi2. I want to calculate <psi_1|V|psi_2> where V is a local operator.

  1. question: the easiest way seems to be using the overlap function. However if I use ITensor objects, would my code be much faster?

  2. question: I tried to implement an ITensor way:

       psi1.position(j);
      ket = psi1.A(j);
      Print(ket);
    
       psi2.position(j);    // THIS DOESN'T SET THE LINK NUMBERS SAME WITH PSI_1
    
      ket2=psi2.A(j);
      bra=dag(prime(ket2,Site));
    
      bra=bra*delta(rightLinkInd(psi2, j),rightLinkInd(psi1, j));
      bra=bra*delta(leftLinkInd(psi2, j),leftLinkInd(psi1, j));
    
      Print(bra);
      Wmat=(bra*W*ket).real();
    

I'm setting the psi_1 to the site where my local operator is defined and my local operator:

      ITensor W = sites.op("Sz",j);

I was doing the same thing to the other state, \psi_2, but I realized that it does not work, their link numbers do not match, hence my code gets stuck in the execution. Here one question I have: why is this the case? I'm giving both the states same site to initialize their gauges, but they do not end up having the same link numbers.

So then I tried to replace the link numbers with the delta function. I first create the bra vector and then pass the rightLink index of psi1 to rightLink index of psi2. Same for left indices. However the expectation values that I'm generating this way and from the overlap function do not match.

Am I changing the indices in a wrong way? I printed out the ITensor indices as well. They seemed to have the right numbers, in fact my code gets executed. However the overlap function result physically makes more sense.

Any help appreciated! Thanks!

Best,
Ceren

1 Answer

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

Hello,

If you are trying to calculate the matrix element of two different MPS, using the gauge conditions will not work for calculating a local operator. Please see this code formula: http://www.itensor.org/docs.cgi?vers=cppv2&page=formulas/two_mps for information on how to calculate matrix elements involving two different MPS.

Also note that you could use the overlap function for this case, but it accepts input like overlap(MPS,MPO,MPS), so requires that you write your local operator as an MPO. This would also be a reasonable thing to do, and nearly as efficient as writing it by hand (depending on how you represent the operator as an MPO).

Cheers,
Matt

commented by (160 points)
Thank you very much Matt.
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

...