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
andhamiltonian
which are constructed based on the input parameters. TheSystem
contains structural data like site positions. The tight-binding Hamiltonian is a sparse matrix in thescipy.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.
- lattice
Attributes
get_wave_vector
Hamiltonian sparse matrix in the
scipy.sparse.csr_matrix
formathamiltonian_build_seconds
is_complex
is_double
is_multiorbital
is_phase
Lattice
specificationList of
Lead
objectsList of all modifiers applied to this model
StructureMap
of the onsite energyraw_hamiltonian
Polygon
orFreeformShape
objectStructural data like site positions and hoppings, see
System
for detailssystem_build_seconds
Methods
add
(*args)Add parameter(s) to the model
attach_lead
(direction, contact)Attach a lead to the main system
eval
()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 the wave vector for periodic models
structure_map
(data)Return a
StructureMap
of the model system mapped to the specifieddata
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 toM.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. Settingdirection=-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 2DFreeformShape
.
- 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 specifieddata
- 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.
Get the vectors [DONE]
Get the positions [DONE]
Get the onsite energies [DONE]
Get the hoppings within the ‘unit-cell’->(0,0)
Get the hoppings accross the boundaries
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 onsite_map: StructureMap¶
StructureMap
of the onsite energy
- property shape: Shape¶
Polygon
orFreeformShape
object