group_sites, n=2, labels=None, charges='same')[source]

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

  • 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.


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

Return type:

list of GroupedSite