• full name: tenpy.models.lattice.get_order_grouped

  • parent module: tenpy.models.lattice

  • type: function

tenpy.models.lattice.get_order_grouped(shape, groups, priority=None)[source]

Variant of get_order(), grouping some sites of the unit cell.

This function is usefull for lattices with a unit cell of more than 2 sites (e.g. Kagome). For 2D lattices with a unit cell, the ordering goes first within a group , then along y, then the next group (for the same x-value), again along y, and finally along x when all groups are done.

As an example, consider the Kagome lattice.

(Source code, png, hires.png, pdf)



In this doc-string, the word ‘direction’ referst to a physical direction of the lattice or the index u of the unit cell as an “artificial direction”.

  • shape (tuple of int) – The shape of the lattice, i.e., the length in each direction.

  • groups (tuple of tuple of int) – A partition and reordering of range(shape[-1]) into smaller groups. The ordering goes first within a group, then along the last spatial dimensions, then changing between different groups and finally in Cstyle order along the remaining spatial dimensions.

  • priority (None | tuple of ints) – By default (None), use C-style order for everything except the unit cell, as shown above. If a tuple, it should have length len(shape) and specifies which order to go first, similarly as in get_order(). To group sites in the unit cell, you should make the last entry of priority the largest. However, you can also choose to group along another direction - in that case groups should be a partitioning of range(shape(argmax(priority))). Try and plot it, if you need it!


order – An order of the sites for Lattice.order in the specified ordering.

Return type

ndarray (, len(shape))

See also


method in Lattice to obtain the order from parameters.


visualizes the resulting order in a Lattice.