Get the wrong information of psi in idmrg

I using idmrg to calculate the wave functions psi. But when I use Print(psi(n_1)), I found that for odd number of sweeps, in the result n\neq n_1, while for even number of sweep, it is right.

I using idmrg to calculate the wave functions psi. But when I use Print(psi(n_1)), I found that for odd number of sweeps, in the result n\neq n_1, while for even number of sweep, it is right.

psi(1) = 
ITensor ord=3: 
(dim=100|id=365|"l=9,Link") <Out>
  1: 52 QN({"Q21",-1},{"Q31",0},{"Q41",0})
  2: 48 QN({"Q21",1},{"Q31",1},{"Q41",1})
(dim=4|id=219|"n=9,Site,Su4Spin") <Out>
  1: 1 QN({"Q21",-1},{"Q31",-1},{"Q41",-1})
  2: 1 QN({"Q21",1},{"Q31",0},{"Q41",0})
  3: 1 QN({"Q21",0},{"Q31",1},{"Q41",0})
  4: 1 QN({"Q21",0},{"Q31",0},{"Q41",1})
(dim=1|id=554|"V,Link") <In>
  1: 1 QN({"Q21",0},{"Q31",0},{"Q41",0})
{norm=1.00 (QDense Real)}
psi(1) = 
ITensor ord=3: 
(dim=100|id=879|"l=1,Link") <Out>
  1: 2 QN({"Q21",-2},{"Q31",-1},{"Q41",-2})
  2: 3 QN({"Q21",-2},{"Q31",-2},{"Q41",-1})
  3: 12 QN({"Q21",0},{"Q31",0},{"Q41",-1})
  4: 25 QN({"Q21",0},{"Q31",-1},{"Q41",0})
  5: 1 QN({"Q21",2},{"Q31",1},{"Q41",0})
  6: 4 QN({"Q21",2},{"Q31",0},{"Q41",1})
  7: 1 QN({"Q21",-3},{"Q31",-1},{"Q41",-1})
  8: 33 QN({"Q21",-1},{"Q31",0},{"Q41",0})
  9: 18 QN({"Q21",1},{"Q31",1},{"Q41",1})
  10: 1 QN({"Q21",3},{"Q31",2},{"Q41",2})
(dim=4|id=225|"n=1,Site,Su4Spin") <Out>
  1: 1 QN({"Q21",-1},{"Q31",-1},{"Q41",-1})
  2: 1 QN({"Q21",1},{"Q31",0},{"Q41",0})
  3: 1 QN({"Q21",0},{"Q31",1},{"Q41",0})
  4: 1 QN({"Q21",0},{"Q31",0},{"Q41",1})
(dim=1|id=469|"V,Link") <In>
  1: 1 QN({"Q21",0},{"Q31",0},{"Q41",0})
{norm=1.00 (QDense Real)}

the two outputs correspond to the same idmgr code but for different input number of sweeps. And I found for odd number of sweeps psi(1) correpond to n=N/2+1, here N is the total number of sites.

Another question is that when I calculate the correlation function, for very long range, the correlation function increases and even diverges. Does this mean my idmrg result not converge?

These two issues does not occur simutaneously.

1 Like

To understand the “index switching” even-odd behavior, you can read more about the algorithm on which this iDMRG code is based here: https://arxiv.org/abs/0804.2509. It is the expected behavior, so one thing you can do is just to do an even number of iterations.

Regarding how to measure correlation functions, please use the pattern shown in the sample folder run.cc file here:
https://github.com/ITensor/iDMRG/blob/master/sample/run.cc

The important thing to note is that there is a tensor psi(0) that you must access from the returned MPS that is the “bond tensor” that is usually called \Lambda in most MPS literature (such as Guifre Vidal’s papers on canonical forms or Schollwoeck’s “DMRG in the Age of MPS” article). This tensor contains the singular values when working in the canonical form (right-canonical form) where the tensors psi(1), psi(2), etc. are all right-orthogonal and the “center” of the orthogonality is on the link to the left of site 1.

Hope that helps –

thank miles, if the “index switching” happens, will this behavior change the overlap of \langle\psi_n^{\text{trial}}|\psi_n\rangle?

One would have to properly code that overlap. I’m not sure how \psi^\text{trial} is defined here, though, so I’d need more information from you to answer the question more specifically.

The trail wave function is defined according to this https://arxiv.org/abs/0804.2509. I read the overlap just from the idmrg output coded with outpulevel=1. I found the overlap is very small (which should be close to 1), but the energy seems to converge.

I use the following code to calculate the correlation function

auto res = idmrg(psi, H, sweeps,{"OutputLevel",1});


int N=Nx*Ny;
auto wf1 = psi(0)*psi(1); 
auto oi = uniqueIndex(psi(0),psi(1),"Link");
auto SzOp1 = op(sites,"S11",1);
auto lcorr = prime(wf1,oi)*SzOp1*dag(prime(wf1));
        
        for(int j = 2; j <= 100; ++j){
            int n = (j-1)%N+1;
            auto ui = uniqueIndex(psi(n),lcorr,"Link");

            auto SzOp2 = op(sites,"S11",n);
            auto val=eltC(dag(prime(psi(n)))*lcorr*prime(psi(n),ui)*SzOp2);
            printfln("%d %.20f",j,val);

            lcorr *= psi(n);
            lcorr *= dag(prime(psi(n),"Link"));
            }

the output is

2 (0.10879420061947264742,0.00000000000000000000)
3 (0.11508818087658925777,0.00000000000000000000)
4 (0.11815706598003240801,0.00000000000000000000)
5 (1.23949669493040603996,0.00000000000000000000)
6 (1.24606751436592078086,0.00000000000000000000)
7 (1.48657273837375991654,0.00000000000000000000)
8 (1.42940227619627702182,0.00000000000000000000)
9 (1.57326181416847599159,0.00000000000000000000)
10 (1.55524539629912084138,0.00000000000000000000)
11 (1.60083757880997046286,0.00000000000000000000)
12 (1.43749952488535148731,0.00000000000000000000)
13 (15.83026791747665562582,0.00000000000000000000)
14 (15.86047248668146991690,0.00000000000000000000)
15 (17.97589940337926961433,0.00000000000000000000)
16 (16.89447429114174070719,0.00000000000000000000)
17 (18.45684667187655136900,0.00000000000000000000)
18 (18.04257410964084229477,0.00000000000000000000)
19 (18.56510641077285228562,0.00000000000000000000)
20 (16.64896786604148815059,0.00000000000000000000)
21 (183.71751342772182624685,0.00000000000000000000)
22 (184.03314803200160554297,0.00000000000000000000)
23 (208.06218937791473422294,0.00000000000000000000)
24 (195.32110121609332509252,0.00000000000000000000)
25 (213.29549405235619019550,0.00000000000000000000)
26 (208.38217676198522099185,0.00000000000000000000)
27 (214.41242786306739276370,0.00000000000000000000)
28 (192.26371635855448971597,0.00000000000000000000)
29 (2121.48488708657623647014,0.00000000000000000000)
30 (2125.11449974074093915988,0.00000000000000000000)
31 (2402.30708005464657617267,0.00000000000000000000)
32 (2255.07290395640211499995,0.00000000000000000000)

I found the result grows quickly as I go to long range.

Based on the information provided, I don’t know why this isn’t working. It could be that your state isn’t well converged. However, it’s likely something else because correlations should generically decay with distance for any right-orthogonal MPS that is properly normalized.

So I would start by doing a few things:
(1) can you run your code in an easier-to-converge case. I see something about Nx and Ny in your code: does that mean you are studying a 2D system? If so, how large is Ny?

(2) you could check whether the MPS tensors really obey the correct right-orthogonal properties. To do so, you can contract each MPS tensor psi(1), psi(2), etc. with itself over the right link index and site index, priming the left link index on one copy to make a matrix which should be very close to the identity.

(3) what is the norm of the MPS? This should be given by the sum of the squares of the entries of psi(0)

Lastly, what is the overall context here? What system are you studying and why are you using iDMRG to study it?

Hi miles,
(1) I am working on a su(4) spin model, this is a test code with Nx=2, Ny=6,
(2) I found there is one matrix at site=7 which is not identity matrix, it is even far away from identity,does this mean the wave function not converge
(3)I use norm(\psi(0)) and find the norm is 1

I think I have solved this problem