+1 vote
asked by (220 points)

For the exthubbard.cc code, when we take N sites, we define the Hamiltonian using for-loops where the index goes from 1 to N.
Can we make the index go from -N/2 to N/2?

1 Answer

+1 vote
answered by (70.1k points)

This isn't supported, since the numbering of the operators is meant to match the possible inputs to the site set object.

Let's say you define a site set object as:

auto sites = SpinHalf(N);

Then sites(1) accesses the first index of the lattice, sites(2) the second, etc.

The AutoMPO class uses the site set to know how to construct the various operators defined for each site when making an MPO. So the numbering of the AutoMPO input needs to match that of the site set.

commented by (220 points)
Thanks for the answer. So now if I consider an impurity at N/2 (I wanted the impurity at origin so I wanted -N/2 to N/2, which is not applicable), I need to put the index for correlation functions of the type i= (N/2 - x)*scale, j= (N/2 - xp)*scale and so on. But when I do so I get the following error.

In the program  itensor/itensor/itensor_interface.ih

Wrong number of IndexVals passed to real/cplx (expected 4, got 0)

If I put i=x*scale and j=xp*scale, it works fine. Can you please tell me why this happens?
commented by (70.1k points)
I'm not sure exactly why you're getting that error based on the information you gave, but generally that error comes from a function or a piece of code that's supposed to result in a scalar. Some piece of code is calling the .real() method on a tensor to retrieve its value, assuming it is a scalar, but instead it is not a scalar due to mismatched indices.
commented by (220 points)
edited by
Thanks for the clarification. But I got it now. What happened was that for calculating the correlation functions, the indices i and j goes from 1 to N and i+1 to N respectively. Hence j > i always. When I did the shift (N/2-x, etc. )as told above, it was getting values such that i > j. But when I chose those values where i<j, it worked out fine.
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

...