kwant.continuum.build_discretized(tb_hamiltonian, coords, *, grid_spacing=1, locals=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 with fill 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.


This function uses eval (because it calls sympy.sympify), and thus should not be used on unsanitized input.


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_spacing : int or float, default: 1

Spacing of the (quadratic or cubic) discretization grid.

locals : dict, defaults to empty

Additional namespace entries for the calls of sympify on the values of tb_hamiltonian. 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]]}.


model : 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.

Previous topic


Next topic


This Page