Model

class Model(lattice: Lattice, *args: Iterable[Primitive | Shape | TranslationalSymmetry | SiteStateModifier | PositionModifier | OnsiteModifier | HoppingModifier | SiteGenerator | HoppingGenerator | Iterable[Primitive | Shape | TranslationalSymmetry | SiteStateModifier | PositionModifier | OnsiteModifier | HoppingModifier | SiteGenerator | HoppingGenerator]])

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:
latticeLattice

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

get_wave_vector

hamiltonian

Hamiltonian sparse matrix in the scipy.sparse.csr_matrix format

hamiltonian_build_seconds

is_complex

is_double

is_multiorbital

is_phase

lattice

Lattice specification

leads

List of Lead objects

modifiers

List of all modifiers applied to this model

onsite_map

StructureMap of the onsite energy

raw_hamiltonian

shape

Polygon or FreeformShape object

system

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

system_build_seconds

Methods

add(*args)

Add parameter(s) to the model

attach_lead(direction, contact)

Attach a lead to the main system

eval()

hopping_generators()

hopping_modifiers()

onsite_modifiers()

plot([num_periods, lead_length, axes])

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

position_modifiers()

report()

Return a string with information about the last build

set_wave_vector(k)

Set the wave vector for periodic models

site_generators()

site_state_modifiers()

structure_map(data)

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

to_lattice()

The site and position modifier is already done by the model, the energy modifiers still need to be added to the model.

tokwant()

Convert this model into kwant format (finalized)

add(*args: Iterable[Primitive | Shape | TranslationalSymmetry | SiteStateModifier | PositionModifier | OnsiteModifier | HoppingModifier | SiteGenerator | HoppingGenerator | Iterable[Primitive | Shape | TranslationalSymmetry | SiteStateModifier | PositionModifier | OnsiteModifier | HoppingModifier | SiteGenerator | HoppingGenerator]]) None

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: int, contact: Shape) None

Attach a lead to the main system

Not valid for 1D lattices.

Parameters:
directionint

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.

contactShape

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.

eval()
hopping_generators()
hopping_modifiers()
onsite_modifiers()
plot(num_periods: int = 1, lead_length: int = 6, axes: Literal['xy', 'xz', 'yx', 'yz', 'zx', 'zy'] = 'xy', **kwargs) None

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

Parameters:
num_periodsint

Number of times to repeat the periodic boundaries.

lead_lengthint

Number of times to repeat the lead structure.

axesstr

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

**kwargs

Additional plot arguments as specified in structure_plot_properties().

position_modifiers()
report()

Return a string with information about the last build

set_wave_vector(k: numpy.ndarray)

Set the wave vector for periodic models

Parameters:
karray_like

Wave vector in reciprocal space.

site_generators()
site_state_modifiers()
structure_map(data: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) StructureMap

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

Parameters:
dataOptional[array_like]

Data array to map to site positions.

Returns:
StructureMap
to_lattice() Lattice

The site and position modifier is already done by the model, the energy modifiers still need to be added to the model.

  1. Get the vectors [DONE]

  2. Get the positions [DONE]

  3. Get the onsite energies [DONE]

  4. Get the hoppings within the ‘unit-cell’->(0,0)

  5. Get the hoppings accross the boundaries

  6. Test if equivalent results are produced using model_to_lattice and the model itself

tokwant() KwantFiniteSystem

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.

property hamiltonian: csr_matrix

Hamiltonian sparse matrix in the scipy.sparse.csr_matrix format

property lattice: Lattice

Lattice specification

property leads: Leads

List of Lead objects

property modifiers: list

List of all modifiers applied to this model

property onsite_map: StructureMap

StructureMap of the onsite energy

property shape: Shape

Polygon or FreeformShape object

property system: System

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