kwant.system.SiteFamily

class kwant.system.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 either ‘normalize_tag’ or ‘normalize_tags’, which brings a tag (or, in the latter case, a sequence of tags) to the standard format for this site family.

Site families may also implement methods pos(tag) and positions(tags), which return a vector of realspace coordinates or an array of vectors of realspace coordinates of the site(s) belonging to this family with the given tag(s). These methods are used in plotting routines. positions(tags) should return an array with shape (N, M) where N is the length of tags, and M is the realspace dimension.

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.

Methods

normalize_tag(tag)[source]

Return a normalized version of the tag.

Raises TypeError or ValueError if the tag is not acceptable.

normalize_tags(tags)[source]

Return a normalized version of the tags.

Raises TypeError or ValueError if the tags are not acceptable.

Previous topic

kwant.system.SiteArray

Next topic

kwant.system.Symmetry

This Page