4.1.1. kwant.system.System

class kwant.system.System

Bases: object

Abstract general low-level system.


The sites of the system are indexed by integers ranging from 0 to self.graph.num_nodes - 1.

Optionally, a class derived from System can provide a method pos which is assumed to return the real-space position of a site given its index.


graph (kwant.graph.CGraph) The system graph.


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.


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.


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.


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.

Previous topic

4.1. kwant.system – Low-level interface of systems

Next topic

4.1.2. kwant.system.InfiniteSystem

This Page