0 votes
asked by (390 points)


I have written a code that creates MPS's as a product of valence bonds for Hubbard. The code works fine for the cases where the valence bonds have adjacent sites., ie. for 6 sites: 1-2 3-4 5-6, 1-2 5-6 3-4, etc. My guess is that I am doing something wrong when I swap the indices and there must be a difference for Hubbard and Heisenberg, because for Heisenberg the same swapping part of the code works. Below is the code I have written:

            ITensor wf, S,V,U;
 for (int i=swaps_.size()-1; i>=0; i--){
  // swaps_ has all the swaps that are necessary so that I get the pattern that I want.
 // swaps_ is calculated somewhere else, but I do not think it matters for the code below.
 // Below is some code that gets the indices, again, not super important I think.
    ar1 = swaps_[i].first;
    ar2 = swaps_[i].second;
    s1.clear(); s1.push_back(siteIndex(psi,ar1));
    s2.clear(); s2.push_back(siteIndex(psi,ar2));
    auto is1 = IndexSet(s1);
    auto is2 = IndexSet(s2);
  // And below comes the swapping part that works for Heisenberg.
    wf = psi.A(ar1)*psi.A(ar2);
    U = psi.A(ar1);

Does anyone have any input maybe? Am I missing a sign for the fermionic wavefunction somehow that disturbs the final result? Could the error be somewhere else? The Hubbard that I am using preserves all quantum numbers.

Thank you,

commented by (14.1k points)
Probably you need to add a "fermionic swap" during your swap operation, i.e. an operator that acts as identity for even parity sectors of the site indices but has a minus sign for odd parity sectors of the site indices.

commented by (390 points)
But how does the parity sector translate into the site ordering? Do you maybe have an example?  

ie. 1,2,3,4 -> 1,4,2,3, does this need a sign correction?
commented by (14.1k points)
edited by
You should think about it as implementing a site reordering in terms of a series of pairwise swaps, i.e.:

    s1,s2,s3,s4 -> s1,s2,s4,s3 -> s1,s4,s2,s3

Then, there would be a fermionic swap gate that implements (s3,s4) -> (s4,s3), and then one that implements (s2,s4) -> (s4,s2). The same fermionic swap gate implements the general operation (si,sj) -> (sj,si). For spinless fermions, for example, the fermionic swap gate would be something like:

    1 0 0 0
    0 0 1 0
    0 1 0 0
    0 0 0 -1

where there is a `-1` in the doubly-occupied subspace (so for the basis |00>, |01>, |10>, |11>).
commented by (390 points)
Great, I think I understood now and I also think the code works. Thank you so much!

1 Answer

0 votes
answered by (14.1k points)

See the comments for an answer.

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.