kwant.lattice.Polyatomic#
- class kwant.lattice.Polyatomic(prim_vecs, basis, name='', norbs=None)[source]#
Bases:
object
A Bravais lattice with an arbitrary number of sites in the basis.
Contains
Monatomic
sublattices. Note that an instance ofPolyatomic
is not itself aSiteFamily
, only its sublattices are.- Parameters:
prim_vecs (2d array-like of floats) – The primitive vectors of the Bravais lattice
basis (2d array-like of floats) – The coordinates of the basis sites inside the unit cell.
name (string or sequence of strings, optional) – The name of the lattice, or a sequence of the names of all the sublattices. If the name of the lattice is given, the names of sublattices are obtained by appending their number to the name of the lattice.
norbs (int or sequence of ints, optional) – The number of orbitals per site on the lattice, or a sequence of the number of orbitals of sites on each of the sublattices.
- Raises:
ValueError – If dimensionalities do not match.
Methods
- neighbors(n=1, eps=1e-08)[source]#
Return n-th nearest neighbor hoppings.
- Parameters:
n (integer) – Order of the hoppings to return. Note that the zeroth neighbor is the site itself or any other sites with the same position.
eps (float) – Tolerance relative to the length of the shortest lattice vector for when to consider lengths to be approximately equal.
- Returns:
hoppings – The n-th nearest neighbor hoppings.
- Return type:
list of kwant.builder.HoppingKind objects
Notes
The hoppings are ordered lexicographically according to sublattice from which they originate, sublattice on which they end, and their lattice coordinates. Out of the two equivalent hoppings (a hopping and its reverse) only the lexicographically larger one is returned.
- shape(function, start)[source]#
Return a key for all the lattice sites inside a given shape.
The object returned by this method is primarily meant to be used as a key for indexing
Builder
instances. See example below.- Parameters:
function (callable) – A function of real space coordinates that returns a truth value: true for coordinates inside the shape, and false otherwise.
start (1d array-like) – The real-space origin for the flood-fill algorithm.
- Returns:
shape_sites
- Return type:
function
Notes
When the function returned by this method is called, a flood-fill algorithm finds and yields all the lattice sites inside the specified shape starting from the specified position.
A
Symmetry
orBuilder
may be passed as sole argument when calling the function returned by this method. This will restrict the flood-fill to the fundamental domain of the symmetry (or the builder’s symmetry). Note that unless the shape function has that symmetry itself, the result may be unexpected.Examples
>>> def circle(pos): ... x, y = pos ... return x**2 + y**2 < 100 ... >>> lat = kwant.lattice.honeycomb() >>> syst = kwant.Builder() >>> syst[lat.shape(circle, (0, 0))] = 0 >>> syst[lat.neighbors()] = 1
- vec(int_vec)[source]#
Return the coordinates of a Bravais lattice vector in real space.
- Parameters:
vec (integer vector) –
- Returns:
output
- Return type:
real vector
- wire(center, radius)[source]#
Return a key for all the lattice sites inside an infinite cylinder.
This method makes it easy to define cylindrical (2d: rectangular) leads that point in any direction. The object returned by this method is primarily meant to be used as a key for indexing
Builder
instances. See example below.- Parameters:
center (1d array-like of floats) – A point belonging to the axis of the cylinder.
radius (float) – The radius of the cylinder.
Notes
The function returned by this method is to be called with a TranslationalSymmetry instance (or a
Builder
instance whose symmetry is used then) as sole argument. All the lattice sites (in the fundamental domain of the symmetry) inside the specified infinite cylinder are yielded. The direction of the cylinder is determined by the symmetry.Examples
>>> lat = kwant.lattice.honeycomb() >>> sym = kwant.TranslationalSymmetry(lat.a.vec((-2, 1))) >>> lead = kwant.Builder(sym) >>> lead[lat.wire((0, -5), 5)] = 0 >>> lead[lat.neighbors()] = 1
Attributes