+1 vote
asked by (430 points)

Dear ITensor Team,
Thanks for your reply. Recently, I want to repeat entanglement entropy calculation as Fig.1 in Phys. Rev. Lett. 110, 115701 by using ITensor v3, which is just simulate 1/4 doped hubbard chain. I followed the tutorial http://itensor.org/docs.cgi?vers=cppv3&page=formulas/entanglement_mps

But i find my results(entropy and energy) are not converge ( we get different results every time )when i increase bond dimension. Is there any bug in my naive code? Please help me. Many thanks!

There is my naive code:

int main()
int Nx = 24;

auto N = Nx;
auto sites = Electron(N);

auto t = 1.0;

auto ampo = AutoMPO(sites);

for(int j=1; j<N; ++j)
ampo += -t, "Cdagup",j,"Cup",j+1;
ampo += -t, "Cdagdn",j,"Cdn",j+1;

for(int j=1; j<=N;++j)
ampo +=UU, "Nupdn",j;

auto H = toMPO(ampo);

auto state = InitState(sites,"Emp");
// for this part, naively, i want to doped my hubbard chain, is that correct?
for(int i=1; i<=Nx/4; ++i)
for(int i=Nx/4+1; i<=Nx/2; ++i)

auto sweeps = Sweeps(10);
sweeps.maxdim() = 10, 20, 50,500;
sweeps.noise() = 1E-7, 1E-8, 1E-10, 0;
sweeps.cutoff() = 1E-10;


auto psi0 = MPS(state);
auto [energy,psi] = dmrg(H,psi0,sweeps,{"Quiet=",true});


//Given an MPS called "psi",
//and some particular bond "b" (1 <= b < length(psi))
//across which we want to compute the von Neumann entanglement
auto b = Nx/2;

//"Gauge" the MPS to site b

//SVD this wavefunction to get the spectrum
//of density-matrix eigenvalues
auto l = leftLinkIndex(psi,b);
auto s = siteIndex(psi,b);
auto [U,S,V] = svd(psi(b),{l,s});
auto u = commonIndex(U,S);

//Apply von Neumann formula
//to the squares of the singular values
Real SvN = 0.;
for(auto n : range1(dim(u)))
auto Sn = elt(S,n,n);
auto p = sqr(Sn);
if(p > 1E-12) SvN += -plog(p);
printfln("Across bond b=%d, SvN = %.10f",b,SvN-2
printfln("Across bond b=%d, SvN = %.10f",b,SvN);

return 0;

commented by (430 points)
I also want to emphasis we should use periodic boundary condition in this calculation, so we can use iDMRG in the ITensor?
commented by (110 points)
Hi.  SugarYu .

I am really interested in the problem. Did you successfully reproduce the Calabrese paper?

commented by (430 points)
Hi Saumya,
       Oh, not exactly !


1 Answer

0 votes
answered by (70.1k points)

Here are some comments I hope are helpful:

(1) your Hamiltonian is not Hermitian. This is likely the main reason you are getting inconsistent results. The terms you are missing are these:
ampo += -t, "Cdagup",j+1,"Cup",j;
ampo += -t, "Cdagdn",j+1,"Cdn",j;

(2) you may also be getting different results each time because you are not doing enough sweeps. For a doped electron systems, sometimes 10 sweeps is just not enough. Please keep increasing the number of sweeps until you see the energy become stable to quite a few digits, say 4 digits of accuracy at least.

(3) to check if the filling is correct, you can compute the total quantum number of your MPS as totalQN(psi) and print that out. From it you will see how many electrons the MPS has (the "Nf" quantum number value) and work out whether you are correctly at the filling you want.

(4) for a small enough system, you can do reliable DMRG of a periodic Hamiltonian just by adding Hamiltonian terms which connect the first and last sites. So like:
ampo += "Cdagup",1,"Cup",N;
ampo += "Cdagup",N,"Cup",1;
ampo += "Cdagdn",1,"Cdn",N;
ampo += "Cdagdn",N,"Cdn",1;

But you do need to do a lot of sweeps to converge on periodic Hamiltonians.

You could consider iDMRG, but our iDMRG code is not officially supported and not too well documented, so you have to know how to carefully use it. It would not be too hard for an entropy calculation, though, so we could discuss that if it's really necessary for your project.


commented by (110 points)
Hi.  SugarYu .

I am really interested in the problem. Did you successfully reproduce the Calabrese paper?

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.