4.1.3. kwant.system.FiniteSystem

class kwant.system.FiniteSystem

Bases: kwant.system.System

Abstract finite low-level system, possibly with leads.

Notes

The length of leads must be equal to the length of lead_interfaces.

For lead n, the method leads[n].selfenergy must return a square matrix whose size is sum(len(self.hamiltonian(site, site)) for site in self.lead_interfaces[n]). The output of leads[n].modes has to be a tuple of StabilizedModes.

Often, the elements of leads will be instances of InfiniteSystem. If this is the case for lead n, the sites lead_interfaces[n] match the first len(lead_interfaces[n]) sites of the InfiniteSystem.

Attributes

leads (sequence of leads) Each lead has to provide a method selfenergy(energy, args). It may provide modes(energy, args) as well.
lead_interfaces (sequence of sequences of integers) Each sub-sequence contains the indices of the system sites to which the lead is connected.

Methods

hamiltonian(i, j, *args)

Return the hamiltonian matrix element for sites i and j.

If i == j, return the on-site Hamiltonian of site i.

if i != j, return the hopping between site i and j.

Hamiltonians may depend (optionally) on positional and keyword arguments

hamiltonian_submatrix(self, args=(), to_sites=None, from_sites=None, sparse=False, return_norb=False)

Return a submatrix of the system Hamiltonian.

Parameters:

args : tuple, defaults to empty

Positional arguments to pass to the hamiltonian method.

to_sites : sequence of sites or None (default)

from_sites : sequence of sites or None (default)

sparse : bool

Whether to return a sparse or a dense matrix. Defaults to False.

return_norb : bool

Whether to return arrays of numbers of orbitals. Defaults to False.

Returns:

hamiltonian_part : numpy.ndarray or scipy.sparse.coo_matrix

Submatrix of Hamiltonian of the system.

to_norb : array of integers

Numbers of orbitals on each site in to_sites. Only returned when return_norb is true.

from_norb : array of integers

Numbers of orbitals on each site in from_sites. Only returned when return_norb is true.

Notes

The returned submatrix contains all the Hamiltonian matrix elements from from_sites to to_sites. The default for from_sites and to_sites is None which means to use all sites of the system in the order in which they appear.

precalculate(energy=0, args=(), leads=None, what='modes')

Precalculate modes or self-energies in the leads.

Construct a copy of the system, with the lead modes precalculated, which may significantly speed up calculations where only the system is changing.

Parameters:

energy : float

Energy at which the modes or self-energies have to be evaluated.

args : sequence

Additional parameters required for calculating the Hamiltionians

leads : list of integers or None

Numbers of the leads to be precalculated. If None, all are precalculated.

what : ‘modes’, ‘selfenergy’, ‘all’

The quantitity to precompute. ‘all’ will compute both modes and self-energies. Defaults to ‘modes’.

Returns:

sys : FiniteSystem

A copy of the original system with some leads precalculated.

Notes

If the leads are precalculated at certain energy or args values, they might give wrong results if used to solve the system with different parameter values. Use this function with caution.

Previous topic

4.1.2. kwant.system.InfiniteSystem

Next topic

4.1.4. kwant.system.PrecalculatedLead

This Page