kwant.system.System#

class kwant.system.System[source]#

Bases: object

Abstract general low-level system.

graph[source]#

The system graph.

Type:

kwant.graph.CGraph

site_ranges[source]#

If provided, encodes ranges of sites that have the same number of orbitals. Each triple consists of (first_site, norbs, orb_offset): the first site in the range, the number of orbitals on each site in the range, and the offset of the first orbital of the first site in the range. In addition, the final triple should have the form (graph.num_nodes, 0, tot_norbs) where tot_norbs is the total number of orbitals in the system.

Type:

None or sorted sequence of triples of integers

parameters[source]#

The names of the parameters on which the system depends. This attribute is provisional and may be changed in a future version of Kwant

Type:

frozenset of strings

Notes

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.

Due to the ordering semantics of sequences, and the fact that a given first_site can only appear at most once in site_ranges, site_ranges is ordered according to first_site.

Consecutive elements in site_ranges are not required to have different numbers of orbitals.

Methods

discrete_symmetry(args, *, params=None)[source]#

Return the discrete symmetry of the system.

The returned object is an instance of DiscreteSymmetry.

Providing positional arguments via ‘args’ is deprecated, instead, provide named parameters as a dictionary via ‘params’.

abstract hamiltonian(i, j, *args, params=None)[source]#

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.

Providing positional arguments via ‘args’ is deprecated, instead, provide named parameters as a dictionary via ‘params’.

hamiltonian_submatrix(self, args=(), to_sites=None, from_sites=None, sparse=False, return_norb=False, *, params=None)[source]#

Return a submatrix of the system Hamiltonian.

Parameters:
  • args (tuple, defaults to empty) – Positional arguments to pass to the hamiltonian method. Mutually exclusive with ‘params’.

  • 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.

  • params (dict, optional) – Dictionary of parameter names and their values. Mutually exclusive with ‘args’.

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.