kwant.continuum.
discretize
(hamiltonian, coords=None, *, grid=None, locals=None, grid_spacing=None)[source]¶Construct a tight-binding model from a continuum Hamiltonian.
If necessary, the given Hamiltonian is sympified using
kwant.continuum.sympify
. It is then discretized symbolically and turned
into a Builder
instance that may be used with
fill
.
This is a convenience function that is equivalent to first calling
discretize_symbolic
and feeding its result into
build_discretized
.
Warning
This function uses eval
(because it calls sympy.sympify
), and
thus should not be used on unsanitized input.
Symbolic representation of a continuous Hamiltonian. It is
converted to a SymPy expression using kwant.continuum.sympify
.
The coordinates for which momentum operators will be treated as differential operators. May contain only “x”, “y” and “z” and must be sorted. If not provided, coords will be obtained from the input Hamiltonian by reading the present coordinates and momentum operators.
Lattice that will be used as a discretization grid. It must have orthogonal primitive vectors. If a scalar value is given, a lattice with the appropriate grid spacing will be generated. If not provided, a lattice with grid spacing 1 in all directions will be generated.
Additional namespace entries for sympify
. May be
used to simplify input of matrices or modify input before proceeding
further. For example:
locals={'k': 'k_x + I * k_y'}
or
locals={'sigma_plus': [[0, 2], [0, 0]]}
.
(deprecated) Spacing of the discretization grid. If unset the default
value will be 1. Cannot be used together with grid
.
Builder
The translationally symmetric builder that corresponds to the provided
Hamiltonian. This builder instance belongs to a subclass of the
standard builder that may be printed to obtain the source code of the
value functions. It also holds the discretization lattice (a
Monatomic
instance with lattice constant
grid_spacing) in the lattice
attribute.