class kwant.builder.SiteFamily(canonical_repr, name, norbs)[source]

Bases: object

Abstract base class for site families.

Site families are the ‘type’ of Site objects. Within a family, individual sites are uniquely identified by tags. Valid tags must be hashable Python objects, further details are up to the family.

Site families must be immutable and fully defined by their initial arguments. They must inherit from this abstract base class and call its __init__ function providing it with two arguments: a canonical representation and a name. The canonical representation will be returned as the objects representation and must uniquely identify the site family instance. The name is a string used to distinguish otherwise identical site families. It may be empty. norbs defines the number of orbitals on sites associated with this site family; it may be None, in which case the number of orbitals is not specified.

All site families must define the method normalize_tag which brings a tag to the standard format for this site family.

Site families that are intended for use with plotting should also provide a method pos(tag), which returns a vector with real-space coordinates of the site belonging to this family with a given tag.

If the norbs of a site family are provided, and sites of this family are used to populate a Builder, then the associated Hamiltonian values must have the correct shape. That is, if a site family has norbs = 2, then any on-site terms for sites belonging to this family should be 2x2 matrices. Similarly, any hoppings to/from sites belonging to this family must have a matrix structure where there are two rows/columns. This condition applies equally to Hamiltonian values that are given by functions. If this condition is not satisfied, an error will be raised.



Return a normalized version of the tag.

Raises TypeError or ValueError if the tag is not acceptable.

Previous topic


Next topic


This Page