+1 vote
asked by (1.2k points)

Hi Miles,

Is it possible to split one "sites" into several pieces or combine several "sites" to form a bigger "sites"?

For instance, I defined a SpinOne SiteSet "auto sites1 = SpinOne(N);", then I wanted "sites2" which is part of "sites1". How do I cut "sites1"? And if I have several parts of "sites1", how do I combine them into a new SiteSet? Thanks.

Jin

1 Answer

+1 vote
answered by (70.1k points)

Hi Jin,
So the SiteSet class does have a constructor that can accept a vector of IQIndices that could be, say, the sites from two other site sets or a subset of sites from a single site set. So this ought to give you the main ability that you are asking for.

However, when using this constructor one would lose all of the information about local operators that are defined for each site. Is that still something you would need? I.e. to be able to call the .op method for each site after making your new site set?

Miles

commented by (1.2k points)
Hi Miles. Thanks for the answer. Yes, I still need the local operators. Is it easy to add this feature?
commented by (70.1k points)
Hi Jin,
So I just pushed a new version of ITensor that includes a function called "merge" that lets you merge two site sets together. Currently they have to be the same type of site set though possibly that requirement could be relaxed.

The basic way to use it is just:

auto msites = merge(sites1,sites2);

If you want to use only a subset of the sites in either sites1 or sites2 you can pass the named arguments "Start1", "End1", "Start2", "End2" (you can pass any subset of these arguments and they are 1-indexed). So like

auto msites = merge(sites1,sites2,{"Start1=",start1,"End1=",end1,"Start2=",start2,"End2=",end2});
commented by (70.1k points)
Oh, and for taking only a subset of the sites, you could either make a wrapper object around a site set that translates the new index numbers into the old ones without actually shortening the length of the original sites set. Or you could make a new function similar to the merge function (which is in mps/siteset.h at the bottom) but which takes only one SiteSet object and then constructs a new site set in a similar way.
commented by (1.2k points)
Thank you, Miles. Before I defined a big sites and worked on different parts separately. This function will help a lot.
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

...