kwant.continuum.build_discretized#
- kwant.continuum.build_discretized(tb_hamiltonian, coords, *, grid=None, locals=None, grid_spacing=None)[source]#
Create a template builder from a symbolic tight-binding Hamiltonian.
The provided symbolic tight-binding Hamiltonian is put on a (hyper) square lattice and turned into Python functions. These functions are used to create a
Builder
instance that may be used withfill
to construct a system of a desired shape.The return values of
discretize_symbolic
may be used directly for the first two arguments of this function.Warning
This function uses
eval
(because it callssympy.sympify
), and thus should not be used on unsanitized input.- Parameters:
tb_hamiltonian (dict) – Keys must be the offsets of the hoppings, represented by tuples of integers ((0, 0, 0) for onsite). Values must be symbolic expressions for the hoppings/onsite or expressions that can by sympified with
kwant.continuum.sympify
.coords (sequence of strings) – The coordinates for which momentum operators will be treated as differential operators. May contain only “x”, “y” and “z” and must be sorted.
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 not provided, 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: