kwant.continuum.discretize#
- 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 aBuilder
instance that may be used withfill
.This is a convenience function that is equivalent to first calling
discretize_symbolic
and feeding its result intobuild_discretized
.Warning
This function uses
eval
(because it callssympy.sympify
), and thus should not be used on unsanitized input.- Parameters:
hamiltonian (str or SymPy expression) – Symbolic representation of a continuous Hamiltonian. It is converted to a SymPy expression using
kwant.continuum.sympify
.coords (sequence of strings, optional) – 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.
grid (scalar or kwant.lattice.Monatomic instance, optional) – 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.
locals (dict, optional) – 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'}
orlocals={'sigma_plus': [[0, 2], [0, 0]]}
.grid_spacing (int or float, optional) – (deprecated) Spacing of the discretization grid. If unset the default value will be 1. Cannot be used together with
grid
.
- Returns:
model – 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 thelattice
attribute.- Return type: