kwant.continuum.discretize_symbolic

kwant.continuum.discretize_symbolic#

kwant.continuum.discretize_symbolic(hamiltonian, coords=None, *, locals=None)[source]#

Discretize a continuous Hamiltonian into a tight-binding representation.

If necessary, the given Hamiltonian is sympified using kwant.continuum.sympify. It is then discretized symbolically.

The two return values may be used directly as the first two arguments for build_discretized.

Warning

This function uses eval (because it calls sympy.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.

  • 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'} or locals={'sigma_plus': [[0, 2], [0, 0]]}.

Returns:

  • tb_hamiltonian (dict) – Keys are tuples of integers; the offsets of the hoppings ((0, 0, 0) for the onsite). Values are symbolic expressions for the hoppings/onsite.

  • coords (list of strings) – The coordinates that have been discretized.