+1 vote
asked by (190 points)

Hello all, my name is Axel! I am currently working on a lattice model essentially consisting of a 1D chain of cavities with bosonic degrees of freedom, connected via two-level systems (qubits), like Q-C-Q-C-Q-C....

I need to perform a DMRG calculation on the system. As I understand it, I am supposed to define a SiteSet describing the combined degree of freedom of an adjacent cavity and qubit, then use AutoMPO to define the Hamiltonian. Presumably, I could somehow also construct the site set and the operators by hand.

My question is: what is the best way of using ITensor to do this? Am I missing something here? It would be really useful if there was some kind of Kronecker product which I could use to define the MPO:s for example, since there is already a SiteSet defined for spin 1/2. That would make the pre-defined SiteSets much more flexible, I guess.

I also want to take the opportunity to thank the ITensor developers: I think that you have developed a comprehensible and very promising tensor library, and look forward to using and contributing to it in the future.

1 Answer

+1 vote
answered by (70.1k points)

Hi Axel,
Thanks for the kind words about the library.

Yes, at the moment the main approach to new types of lattice Hilbert spaces is to make a SiteSet by hand. However, despite a lot of "boilerplate", the SiteSet definition files are actually rather simple and shouldn't be too hard to customize (plus I can help).

If you take a look at the SiteSets which come with ITensor, you'll see that one mainly needs to define a constructor which makes a set of IQIndex objects then also define a few methods of the form getXYZ such as getOp, getSi, and getState. The first returns operators; the second individual site indices; the last returns "IndexVals" which represent an index set to a particular value. Most of the other methods are optional and are needed e.g. if you want to write your SiteSet to disk.

One key question is: what sort of bosons live on the C sites? Are they "hard core" bosons or is their occupation number unbounded? Both are fine, but for regular "soft" bosons you will need to restrict the Hilbert space to a maximum occupancy number. (There are other fancier tricks to handle large numbers of bosons but they are rather specialized.)

That's a really nice idea about viewing SiteSets as being made of more granular objects just representing a single site of a particular type. Then it would trivial to make a S=1 chain, but with S=1/2 sites on one or both ends for example. We plan to improve the SiteSet system in the near future and will strongly consider this suggestion.


commented by (190 points)
Ok! Then I get the picture, and what's currently possible!

I already started looking at how to write a new SiteSet. The bosons are unbounded/soft and the truncation should be set by the coupling constants of the problem. I do have some questions with SiteSet, especially since I'm not very experienced in C++:

-  What purpose does the vector/DefaultOpsT 'dops' serve? It is obviously connected to the basis of measurement (if I check the source of 'SpinHalf') but _why_ is it important to define a default operator? Is this not obvious from its diagonal form in the particular basis?
- Is there a particular reason why both function  'getSi' and 'si' are defined?

I will probably be back with more questions soon... thank you for the answer!
commented by (190 points)
I am struggling with the 'constructSites' function, where I now have to create two blocks (spin up and down), since there are two quantum numbers (Sz and n). Inside the iteration over sites, I therefore write:

    auto v1 = stdx::reserve_vector<IndexQN>(M_);
    auto v2 = stdx::reserve_vector<IndexQN>(M_);
    for(int k = 0; k <= M_-1; ++k)
                Index("Up/" + std::to_string(k) + "/" + std::to_string(j)),
                Index("Up/" + std::to_string(k) + "/" + std::to_string(j)),

    auto iq1 = IQIndex("Up", std::move(v1), Out, 0);
    auto iq2 = IQIndex("Dn", std::move(v2), Out, 0);

    site_.at(j) = IQIndex(
        "S=1/2/M=" + std::to_string(M_) + "/j=" + std::to_string(j),

Is this the correct way to do it? And how can I access IQIndexVals labelled by both quantum numbers? So far I haven't been able to do it at all...
commented by (70.1k points)
Hi Axel,
I feel your pain! Ok so you are in luck. As I mentioned we've been wanting to improve the internals of SiteSet anyway. So I just finished reworking it based on the design you suggested.

If you pull the latest version of ITensor from Github, then do "git checkout newsiteset" you'll get the latest code.

Have a look at the file sites/spinone.h to see an example of a site set that can have a mixture of two kinds of sites. The code for the constructor is at the bottom and depending on some flags, either makes sites 1 and N SpinHalfSite objects or SpinOneSite objects.

The new classes SpinHalfSite, SpinOneSite, HubbardSite, etc. implement the idea you suggested, which is that operators and states are now defined on a site-by-site level. So with this design you can mix together as many types of sites as you want.

Also AutoMPO already "borrows" information about operator names from the SiteSet objects, so whatever operator names you define in your own custom site type should immediately work with AutoMPO (modulo some tricky issues with fermions - if you plan to define a new fermionic site type we can talk in more detail).

commented by (70.1k points)
Of course, this is brand new code so if you try it please let me know of any issues.

Also I am happy to help if you have more questions about it.
commented by (190 points)
That's perfect, thank you! I will have a look at the code, since I will surely be having similar problems in the future.

Overnight, I tried another solution which now seems to work: similar to the code suggested in the question http://itensor.org/support/50/bosonic-sites-with-itensor-2 I added a SpinHalf on every odd site and a truncated boson site on every even. It seems to work with AutoMPO as well and the DMRG simulation runs, but I will try your new code next week!
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.