0 votes
asked by (390 points)

Follow up on this question: https://itensor.org/support/1920/valence-bond-states-fast-implementation

Now my purpose instead of having 2-site products of singlets is to create 2-site products of states that are of the form (|uiuj>)x(|ukul>), etc.

For singlets, I did this:

for(int n = 1; n <= 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.ref(n) = ITensor(s1);
        psi.ref(n+1) = ITensor(s2);
        svd(wf,psi.ref(n),D,psi.ref(n+1));
        psi.ref(n) *= D;
      }

So I thought that this should be easy and it should be:

wf.set(s1(1),s2(1), 1);

Unfortunately, when I compute its expectation value with the H that I have (it doesn't really matter which one it is), I do not get the same result as when I construct an all up state explicitly.

Any idea about what I might be doing wrong?


In addition to that, I would also like to construct products of tetramers. The example of a tetramer on sites 1,2,3,4 is here:here:

I tried:

for(int n = 1; n <= N; n += 4)
        {

        auto s1 = sites(n);
        auto s2 = sites(n+1);
        auto s3 = sites(n+2);
        auto s4 = sites(n+3);

        auto wf = ITensor(s1,s2,s3,s4);
        wf.set(s1(1),s2(1),s3(2),s4(2), sqrt(12));
        wf.set(s1(1),s2(2),s3(1),s4(2), -sqrt(12));
        wf.set(s1(1),s2(2),s3(2),s4(1), 2*-sqrt(12));
        wf.set(s1(2),s2(1),s3(1),s4(2), 2*-sqrt(12));
        wf.set(s1(2),s2(1),s3(2),s4(1), -sqrt(12));
        wf.set(s1(2),s2(2),s3(1),s4(1), sqrt(12));


        ITensor D;
        psi.ref(n) = ITensor(s1);
        psi.ref(n+1) = ITensor(s2);
        svd(wf,psi.ref(n),D,psi.ref(n+1));
        psi.ref(n) *= D;



        ITensor D2;
        psi.ref(n+2) = ITensor(s3);
        psi.ref(n+3) = ITensor(s4);
        svd(wf,psi.ref(n+2),D2,psi.ref(n+3));
        psi.ref(n) *= D2;

      }

but I am getting a findInds error (and I am not really sure that I am doing the SVD right anyway...)

Any thoughts on that?

Thank you very much,
Thanos

1 Answer

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

Hi, regarding the two parts of your question, let me answer them in reverse order:

(2) for the second part of your question, regarding tetramers, the main issue with the code you tried is that you are making tensors with 4 indices (which is fine) but then just splitting them into two pieces using the SVD (two, not counting the singular values, which you could multiply into either U or V). To end up with a proper MPS that you can use, each MPS tensor has to carry only one site index. But the code you wrote would result in some tensors of psi carrying three site indices, while others carry just one.

What I'd recommend is that you draw out, using tensor diagrams, what each part of the tetramer code above is doing and I think you'll see what I mean.

The solution to making tetramers is to keep going past the code you wrote by iterating the SVD step. Take the singular values "D" and multiply them into "V" (which you have stored into psi.ref(n+1). Next call the svd function on D*V, splitting off the second site index of that tetramer. Then finally split the third and fourth site indices apart with one more SVD. Throughout this process, you can use the ITensor function "commonindex" to get the newly created "Link" indices made by previous calls to svd, which you will need to pass as the "row" indices to the SVD function (using our new SVD interface, which would be better for this purpose).

(1) regarding setting a wavefunction all up, the answer is sort of similar to making dimers. The code you showed does, I think, make tensors which carry two site indices, whereas an MPS has to have tensors carrying only one site index each. Again, please diagram out what your code is doing and you should see where it's going wrong, in terms of resulting in a set of tensors you are putting into "psi" which do not have a proper MPS structure.

Hope that helps -

Miles

commented by (390 points)
Regarding the first part, I had a bug somewhere else in the code (very unfortunate) and regarding the second part I understood what you meant and I finally coded it.

Thank you very much for your reply, it was really helpful!
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

...