Model

class Model(lattice, *args)

Builds a Hamiltonian from lattice, shape, symmetry and modifier parameters

The most important attributes are system and hamiltonian which are constructed based on the input parameters. The System contains structural data like site positions. The tight-binding Hamiltonian is a sparse matrix in the scipy.sparse.csr_matrix format.

Parameters:

lattice : Lattice

The lattice specification.

*args

Can be any of: shape, symmetry or various modifiers. Note that:

  • There can be at most one shape and at most one symmetry. Shape and symmetry can be composed as desired, but physically impossible scenarios will result in an empty system.
  • Any number of modifiers can be added. Adding the same modifier more than once is allowed: this will usually multiply the modifier’s effect.

Attributes

hamiltonian Hamiltonian sparse matrix in the scipy.sparse.csr_matrix format
lattice Lattice specification
leads List of Lead objects
modifiers List of all modifiers applied to this model
onsite_map StructureMap of the onsite energy
shape Polygon or FreeformShape object
system Structural data like site positions and hoppings, see System for details

Methods

add(*args) Add parameter(s) to the model
attach_lead(direction, contact) Attach a lead to the main system
plot([num_periods, lead_length, axes]) Plot the structure of the model: sites, hoppings, boundaries and leads
report() Return a string with information about the last build
set_wave_vector(k: numpy.ndarray) Set the wave vector for periodic models
structure_map([data]) Return a StructureMap of the model system mapped to the specified data
tokwant() Convert this model into kwant format (finalized)
add(*args)

Add parameter(s) to the model

Parameters:

*args

Any of: shape, symmetry, modifiers. Tuples and lists of parameters are expanded automatically, so M.add(p0, [p1, p2]) is equivalent to M.add(p0, p1, p2).

attach_lead(direction, contact)

Attach a lead to the main system

Not valid for 1D lattices.

Parameters:

direction : int

Lattice vector direction of the lead. Must be one of: 1, 2, 3, -1, -2, -3. For example, direction=2 would create a lead which intersects the main system in the \(a_2\) lattice vector direction. Setting direction=-2 would create a lead on the opposite side of the system, but along the same lattice vector.

contact : Shape

The place where the lead should contact the main system. For a 2D lattice it’s just a line() describing the intersection of the lead and the system. For a 3D lattice it’s the area described by a 2D FreeformShape.

plot(num_periods=1, lead_length=6, axes='xy', **kwargs)

Plot the structure of the model: sites, hoppings, boundaries and leads

Parameters:

num_periods : int

Number of times to repeat the periodic boundaries.

lead_length : int

Number of times to repeat the lead structure.

axes : str

The spatial axes to plot. E.g. ‘xy’, ‘yz’, etc.

**kwargs

Additional plot arguments as specified in structure_plot_properties().

report()

Return a string with information about the last build

set_wave_vector(k: numpy.ndarray)

Set the wave vector for periodic models

Parameters:

k : array_like

Wave vector in reciprocal space.

structure_map(data=None)

Return a StructureMap of the model system mapped to the specified data

Parameters:

data : Optional[array_like]

Data array to map to site positions. Defaults to sublattice IDs if not specified.

Returns:

StructureMap

tokwant()

Convert this model into kwant format (finalized)

This is intended for compatibility with the kwant package: http://kwant-project.org/.

Returns:

kwant.system.System

Finalized system which can be used with kwant compute functions.

hamiltonian

Hamiltonian sparse matrix in the scipy.sparse.csr_matrix format

lattice

Lattice specification

leads

List of Lead objects

modifiers

List of all modifiers applied to this model

onsite_map

StructureMap of the onsite energy

shape

Polygon or FreeformShape object

system

Structural data like site positions and hoppings, see System for details