0 votes
asked by (390 points)


I am trying to construct a finite temperature 1/beta MPS state using the ancilla/purification method, namely in a chain of 2 N spin half, then build the initial state as the identity matrix

auto psi = MPS(sites);
for(int n = 1; n <= 2*N; n += 2)
auto s1 = sites(n);
auto s2 = sites(n+1);
auto wf = ITensor(s1,s2);
wf.set(s1(1),s2(2), ISqrt2);
wf.set(s1(2),s2(1), -ISqrt2);
ITensor D;
psi.Aref(n) = ITensor(s1);
psi.Aref(n+1) = ITensor(s2);
psi.Aref(n) *= D;

and now apply exp[- beta/2 H] X 1 on psi. I want to time evolve with Trotter gates that only apply on the physical legs of the MPS. So I have built the gates

for(int b = 1; b <= N-1; ++b)
auto s1 = 2b+1,
s2 = 2

    auto hterm = sites.op("Sz",s1)*sites.op("Sz",s2);
    hterm += 0.5*sites.op("S+",s1)*sites.op("S-",s2);
    hterm += 0.5*sites.op("S-",s1)*sites.op("S+",s2);

    auto g = Gate(sites,s1,s2,Gate::tImag,tau/2.,hterm);

and with the reverse direction, but when I run


I obtain the error

From line 84, file itdata/combiner.cc

No contracted indices in combiner-tensor product

No contracted indices in combiner-tensor product
Abort trap: 6

What am I doing wrong?

Thanks so much!


1 Answer

0 votes
answered by (70.1k points)

Hi Jacopo,
Thanks for the question. So the problem here is on us, namely that we had not yet documented the gateTEvol method despite publicizing it. The key thing you are missing is that gateTEvol requires each of the gates passed to it to act only on consecutive (nearest-neighbor) site pairs.

I just started documenting it so people will know this in the future:

In order to do the ancilla technique with Trotter gates (which is a very good way to do it), you will need to insert "swap gates" into your gate list. You can use the "Gate = BondGate" class to make swap gates like this:

auto swapij = Gate(sites,i,j);

In the upcoming version 3 of ITensor we're going to make a more intuitive interface for making gates. (Probably just separate functions such as swapGate, realGate, imagGate etc.)

Best regards,

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.