Skip to main content

Open-source software

Numerical simulations are a critical instrument in our research. We use them to build or check intuition, and to answer questions that are out of reach analytically. For as long as the group has existed, we have published the source code of every research project, linked from each paper. Whenever a piece of code turns out to be useful to others, we invest the extra effort to make it faster, more reliable, and easier to use: we turn it into a software package.

  • Kwant: tight-binding models and quantum transport.

  • Qsymm: symmetry analysis and symmetric Hamiltonian generation.

  • Pfapack: Pfaffians of dense and banded matrices.

  • Adaptive: parallel adaptive sampling of functions.

  • Pymablock: quasi-degenerate perturbation theory, numerical and symbolic.

  • ScatterWorks: scattering network models.

  • PyDACP: eigenvalues of Hermitian operators within an energy window (work in progress).

Our other code is on GitLab.

A worked example

To show how these packages fit together, let us follow how we would find the topological invariant of a two-dimensional crystalline insulator.

Build the model: Kwant

At the start we only have a guess: the kind of tight-binding model that should be topological, and an idea of what its edge states should look like. Coding a tight-binding model is an exercise that many projects repeat from scratch, but it is tedious and error-prone. Instead we use Kwant, a Python package for quantum transport simulations. Kwant defines complex models on arbitrary shapes and computes their spectrum, density of states, currents, and other coherent properties. It was published in 2014 and has since been used in over 1000 projects.

Check the symmetries: Qsymm

The symmetry of the model is critical, so we need to be sure that it has no unexpected symmetries and that we did not accidentally break the ones we want. With many hoppings, the model quickly becomes large and complicated. This is where Qsymm, a package for automated symmetry analysis, helps. Qsymm finds all Hamiltonians that respect a symmetry group, or all symmetries of a given Hamiltonian.

Qsymm workflow: a symmetry finder maps Hamiltonian families to symmetry groups, and a Hamiltonian generator maps symmetry groups back to Hamiltonian families.

Qsymm connects Hamiltonians and their symmetry groups in both directions.

Compute the invariant: Pfapack

With the model in hand, we compute its invariant. This often requires a Pfaffian, the less well-known sibling of the determinant, which Pfapack computes efficiently.

Map the phase diagram: Adaptive

To find where the invariant changes, we could compute it on a grid of parameter values. This is wasteful: the invariant is an integer that only changes at phase transitions. Instead we use Adaptive, which samples the parameter space where it matters and needs far fewer points. We were happy to see Adaptive used even in a simulation of wind turbines. The animation shows how Adaptive progressively samples an unknown function.

For a real research project that uses these packages together, see its code and data on Zenodo and the accompanying paper.

Going further

If the model has many orbitals or bands, we reduce it to an effective model with Pymablock. It implements quasi-degenerate perturbation theory for numerical and symbolic Hamiltonians, block-diagonalizing them order by order in the perturbation.

If the system is better described as a network of scatterers than as a tight-binding model, we build and solve it with ScatterWorks.

To find eigenvalues of a large Hamiltonian within an energy window, we are developing PyDACP.

All these packages are open source, and we are glad to see their user communities grow. If you have questions or suggestions, get in touch or open an issue in the package repository.