4.6. kwant.qsymm – Integration with Qsymm

kwant.qsymm.builder_to_model(syst, momenta=None, real_space=True, params=None)[source]

Make a qsymm.BlochModel out of a Builder.

  • syst (Builder) – May have translational symmetries.

  • momenta (list of strings or None) – Names of momentum variables. If None, ‘k_x’, ‘k_y’, … is used.

  • real_space (bool (default True)) – If False, use the unit cell convention for Bloch basis, the exponential has the difference in the unit cell coordinates and k is expressed in the reciprocal lattice basis. This is consistent with kwant.wraparound. If True, the difference in the real space coordinates is used and k is given in an absolute basis. Only the default choice guarantees that qsymm is able to find nonsymmorphic symmetries.

  • params (dict, optional) – Dictionary of parameter names and their values; used when evaluating the Hamiltonian matrix elements.


model – Model representing the tight-binding Hamiltonian.

Return type



The sites in the the builder are in lexicographical order, i.e. ordered first by their family and then by their tag. This is the same ordering that is used in finalized kwant systems.

kwant.qsymm.find_builder_symmetries(builder, momenta=None, params=None, spatial_symmetries=True, prettify=True, sparse=None)[source]

Finds the symmetries of a Kwant system using qsymm.

  • builder (Builder) –

  • momenta (list of strings or None) – Names of momentum variables, if None ‘k_x’, ‘k_y’, … is used.

  • params (dict, optional) – Dictionary of parameter names and their values; used when evaluating the Hamiltonian matrix elements.

  • spatial_symmetries (bool (default True)) – If True, search for all symmetries. If False, only searches for the symmetries that are declarable in Builder objects, i.e. time-reversal symmetry, particle-hole symmetry, chiral symmetry, or conservation laws. This can save computation time.

  • prettify (bool (default True)) – Whether to carry out sparsification of the continuous symmetry generators, in general an arbitrary linear combination of the symmetry generators is returned.

  • sparse (bool, or None (default None)) – Whether to use sparse linear algebra in the calculation. Can give large performance gain in large systems. If None, uses sparse or dense computation depending on the size of the Hamiltonian.


symmetries – The symmetries of the Kwant system.

Return type

list of qsymm.PointGroupElements and/or qsymm.ContinuousGroupElement

kwant.qsymm.model_to_builder(model, norbs, lat_vecs, atom_coords, *, coeffs=None)[source]

Make a Builder out of qsymm.Models or qsymm.BlochModels.

  • model (qsymm.Model, qsymm.BlochModel, or an iterable thereof) – The Hamiltonian (or terms of the Hamiltonian) to convert to a Builder.

  • norbs (OrderedDict or sequence of pairs) – Maps sites to the number of orbitals per site in a unit cell.

  • lat_vecs (list of arrays) – Lattice vectors of the underlying tight binding lattice.

  • atom_coords (list of arrays) – Positions of the sites (or atoms) within a unit cell. The ordering of the atoms is the same as in norbs.

  • coeffs (list of sympy.Symbol, default None.) – Constant prefactors for the individual terms in model, if model is a list of multiple objects. If model is a single Model or BlochModel object, this argument is ignored. By default assigns the coefficient c_n to element model[n].


syst – The unfinalized Kwant system representing the qsymm Model(s).

Return type



Onsite terms that are not provided in the input model are set to zero by default.

The input model(s) representing the tight binding Hamiltonian in Bloch form should follow the convention where the difference in the real space atomic positions appear in the Bloch factors.

Previous topic


Next topic

5.1. kwant.system – Low-level interface of systems

This Page