PythTB API Reference#
Core Classes#
PythTB centers on a small set of core classes for constructing and analyzing tight-binding models. This page highlights what each component is for and links to the API reference in the tables below.
pythtb.TBModelTight-binding Hamiltonians on arbitrary lattices. Use it to set hoppings, sweep parameters, compute spectra, and evaluate derived quantities such as Berry curvature, quantum geometric tensors, axion angles, or local Chern markers.pythtb.WFArrayMesh-aware wavefunction storage. Solve a model across \((k, \lambda)\) grids, then evaluate Wilson loops, Berry phases, Chern numbers, and other objects with consistent periodic boundary conditions.pythtb.W90Interface with Wannier90 and export a Wannierized tight-binding model in the form of aTBModel.
Added in version 2.0.0: These classes were introduced in PythTB version 2.0.0.
pythtb.MeshDescribes k-space grids, paths, and parameter sweeps. Encodes topology (loops, endpoints, adiabatic cycles) soWFArraycan apply appropriate gauge conditions downstream.pythtb.LatticeHolds real- and reciprocal-space geometry, orbital positions, and nearest-neighbour shells. Every model and wavefunction array references the same lattice instance to ensure consistent coordinates.pythtb.WannierBuild Wannier gauges directly inside PythTB from a {py:class}WFArray, perform projections, disentanglement and maximal localization, and analyze spreads and centers.
The class-level autosummary below links to detailed API pages.
|
Build, parametrize, and solve tight-binding Hamiltonians. |
|
Wavefunction container defined on a sampling mesh. |
|
Store lattice and orbital information. |
|
Store and manage a mesh in \((k, \lambda)\)-space. |
|
Interface to Wannier90 |
|
Construct Wannier functions using the projection method. |
Predefined Models#
PythTB also provides a collection of predefined tight-binding models. Import and use these models using the following syntax:
from pythtb.models import haldane, graphene, ssh
Collection of tight-binding models. |
I/O Utilities#
PythTB ships with lightweight readers for importing data from external software packages such as Wannier90 and Quantum ESPRESSO.