group_sites

tenpy.networks.site.group_sites(sites, n=2, labels=None, charges='same')[source]

Given a list of sites, group each n sites together.

Parameters:
  • sites (list of Site) – The sites to be grouped together.

  • n (int) – We group each n consecutive sites from sites together in a GroupedSite.

  • labels – See GroupedSite.

  • charges – See GroupedSite.

Returns:

grouped_sites – The grouped sites. Has length (len(sites)-1)//n + 1.

Return type:

list of GroupedSite