  TBTK
Introduction

# Origin and scope

TBTK (Tight-Binding ToolKit) originated as a toolkit for solving tight-binding models but has expanded in scope since then. Today it is best described as a framework for building applications that solve second-quantized Hamiltonians with discrete indices

$$H = \sum_{\mathbf{i}\mathbf{j}}a_{\mathbf{i}\mathbf{j}}c_{\mathbf{i}}^{\dagger}c_{\mathbf{j}} + \sum_{\mathbf{i}\mathbf{j}\mathbf{k}\mathbf{l}}V_{\mathbf{i}\mathbf{j}\mathbf{k}\mathbf{l}}c_{\mathbf{i}}^{\dagger}c_{\mathbf{j}}^{\dagger}c_{\mathbf{k}}c_{\mathbf{l}}$$.

Even more general interaction terms than above are possible to model, but there is currently limited support for solving interacting models. This manual, therefore, focuses on the non-interacting case.

Note that the use of discrete indices does not imply any restrictions on the type of systems that can be modeled. First, a continuous description can often be turned into a discrete description by choice of an appropriate basis. Second, any remaining continuous coordinate anyway has to be discretized before a numerical method is applied. For example, the Schrödinger equation in a central potential contains three continuous coordinates. By working in the basis of spherical harmonics, these are reduced to two discrete indices ( $$l$$ and $$m$$) and one remaining continuous coordinate $$r$$.

# A quantum mechanics framework

TBTK is not a scientific software that can perform a specific type of calculation. Rather, it is a framework aimed at simplifying the development of code for performing quantum mechanical calculations. The main focus is on providing general-purpose data structures for problems formulated in the language of second quantization. These data structures are designed with four goals in mind: generality, efficiency, readability, and modularity.

Generality means that a data structure captures the general structure of the concept it represents. It makes it reusable for many different types of problems.

Efficiency means that the overhead associated with using the data structure is small. Wherever performance is critical, it should be easy to convert it to the data format that is most suited for the given task. Method developers should have complete freedom to exploit whatever representation of their data that is needed to achieve maximum performance.

Readability means that it allows for highly readable code to be written. Application developers should be able to focus on physical questions rather than numerical details.

Modularity means that the data structures have limited interdependencies. This makes it possible to combine them in the many different ways that are required to implement a wide range of applications. Modularity also makes it easier for individual components to be broken apart whenever detailed control over the numerics is needed. This shields the application developer from unnecessary numerical details, while at the same time providing full transparency to the developer that needs to dig deeper.

Through these principles, TBTK makes it easy to get started implementing numerical calculations. It provides the efficiency of low-level languages, while also removing the complexity barrier that otherwise often is associated with C++. It also aims to make the community involved in developing code for quantum mechanical calculations more integrated. Thus, enabling and encouraging the sharing of code by providing a unifying framework that makes it possible to reuse other people's code with minimal effort.

TBTK also provides utilities and build tools that are meant to streamline the build process. Crucially, special attention is paid to enabling reproducibility of scientific results, and semantic versioning is adopted. Whenever the log is enabled, the version number together with the git hash for the specific commit is written there. This makes it possible to rerun a calculation at a later time with the exact same version of TBTK.