Skip to main content

Python library for constructing and analyzing tight-binding models.

Project description


DOI PyPI Conda Version PyPI Downloads Conda Downloads readthedocs status SPEC 0 — Minimum Supported Dependencies Run examples on Binder

PythTB is a Python library for constructing and analyzing tight-binding models, built for modern topological band theory applications. It provides a streamlined path from model specification to physical interpretation, making it useful for both learning electronic structure and conducting research-level studies. With only a few lines of code, you can define lattice models, build tight-binding Hamiltonians, and compute electronic properties.

PythTB provides tools for:

  • Band structures and density of states
  • Berry phases and Berry curvature
  • Chern numbers, Wilson loops, and related invariants
  • Quantum geometric tensors and local Chern markers
  • Chern-Simons axion angle
  • Maximally localized Wannier functions
  • Wannier-based tight-binding models generated through Wannier90

Resources

Installation

PythTB is available through conda-forge (recommended) and PyPI.

# Conda (pythtb >= 1.8.0)
conda install -c conda-forge pythtb

# pip
pip install pythtb

To install from source in editable mode:

git clone https://github.com/pythtb/pythtb.git
cd pythtb
pip install -e .

PythTB ≥ 2.0.0 requires Python ≥ 3.12 and the core dependencies:

  • numpy ≥ 2.0
  • matplotlib ≥ 3.9

Optional extras can be installed via pip install .[group]:

  • [plotting]: Plotly for interactive visualization
  • [speedup]: TensorFlow for GPU-accelerated routines
  • [notebooks]: Jupyter support (IPython ≥ 8.17, ipykernel, notebook, jupyter, jupyterlab)
  • [docs]: Sphinx toolchain for documentation
  • [tests]: pytest
  • [dev]: developer tools (pytest, ruff, pre-commit)

For more detailed instructions, see:

Citation

If you use the code in your paper, please cite us

@software{Cole_Python_Tight_Binding_2025,
author = {Cole, Trey and Coh, Sinisa and Vanderbilt, David},
doi = {10.5281/zenodo.12721315},
license = {GPL-3.0-or-later},
month = nov,
title = {{Python Tight Binding (PythTB)}},
url = {https://zenodo.org/records/12721315},
version = {2.0.0},
year = {2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythtb-2.0.2.tar.gz (36.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythtb-2.0.2-py3-none-any.whl (196.2 kB view details)

Uploaded Python 3

File details

Details for the file pythtb-2.0.2.tar.gz.

File metadata

  • Download URL: pythtb-2.0.2.tar.gz
  • Upload date:
  • Size: 36.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pythtb-2.0.2.tar.gz
Algorithm Hash digest
SHA256 f4577a54fa81cf308550dd3df211643ddb64f1c4b1f622ed8fc5cc70ebdae1c6
MD5 a0c3655e7219874b14338db6373692ca
BLAKE2b-256 b175396e241d8714de9a7643199528c0f4a1f8c1cc1152d22b51a16fef30031e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythtb-2.0.2.tar.gz:

Publisher: pypi-publish.yml on pythtb/pythtb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pythtb-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: pythtb-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 196.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pythtb-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa169c0bbb949788044fccb1ede3f3cbe058e9a3f5cc6cdff862fc730b19d26
MD5 8ce8741580231a7f29eed0c860486dd2
BLAKE2b-256 d4abbd69c37a93fc804da448ec0363f4303bcca3774191c070f0f879d2e0f009

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythtb-2.0.2-py3-none-any.whl:

Publisher: pypi-publish.yml on pythtb/pythtb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page