DeePTB is an innovative Python package that uses deep learning to accelerate ab initio electronic structure simulations. It offers versatile, accurate, and efficient simulations for a wide range of materials and phenomena. Trained on small systems, DeePTB can predict electronic structures of large systems, handle structural perturbations, and integrate with molecular dynamics for finite temperature simulations, providing comprehensive insights into atomic and electronic behavior.
- Key Features
DeePTB contains two main components:
-
DeePTB-SK: deep learning based local environment dependent Slater-Koster TB.
- Customizable Slater-Koster parameterization with neural network corrections for .
- Flexible basis and exchange-correlation functional choices.
- Handle systems with strong spin-orbit coupling (SOC) effects.
-
DeePTB-E3: E3-equivariant neural networks for representing quantum operators.
- Construct DFT Hamiltonians/density and overlap matrices under full LCAO basis.
- Utilize (Strictly) Localized Equivariant Message-passing ((S)LEM) model for high data-efficiency and accuracy.
- Employs SO(2) convolution for efficient handling of higher-order orbitals in LCAO basis.
-
For more details, see our papers:
-
Online documentation
For a comprehensive guide and usage tutorials, visit Documentation website.
-
Contributing
We welcome contributions to DeePTB. Please refer to our contributing guidelines for details.
Installing DeePTB is straightforward with UV, a fast Python package manager.
-
Requirements
- Git
- Python 3.10 to 3.13
- UV, used by
install.shas the fast installer frontend - For GPU installs: an NVIDIA driver compatible with the selected CUDA runtime
-
From Source (Recommended)
-
Install UV (if not already installed):
# On macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Or using pip pip install uv # On Windows (PowerShell) powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
-
Clone DeePTB:
git clone https://github.com/deepmodeling/DeePTB.git cd DeePTB -
Install DeePTB with tested dependencies:
Automatic CPU/GPU selection:
./install.sh
CPU-only install:
./install.sh cpu
GPU install:
nvidia-smi # check the driver-reported CUDA version ./install.sh gpu # auto-detect CUDA backend # Or force a tested CUDA wheel path: ./install.sh cu128 # RTX 50 / CUDA 12.8 path tested with torch 2.10.0 ./install.sh cu130 # requires a driver new enough for CUDA 13.0 runtime
This single command will:
- Automatically create a virtual environment (
.venv) - Install a tested PyTorch / PyG /
torch-scatterbinary-wheel combination - Refuse unsupported Python or CUDA/backend combinations instead of falling back to source builds
- Install all runtime and test dependencies
- Automatically create a virtual environment (
-
Activate the standalone environment:
install.shinstalls DeePTB into.venvunder the current DeePTB repository. Activate it before runningdptb:source .venv/bin/activate # On Unix/macOS .venv\Scripts\activate # On Windows dptb --help
-
Validate the installation: DeePTB is under active development, so new installations should run the test suite once before production use.
python -m pytest ./dptb/tests/
For a faster local check while iterating:
python -m pytest ./dptb/tests/ -m "not slow" -
Install optional dependencies (if needed):
# For 3D Fermi surface plotting ./install.sh auto --extra 3Dfermi # For TBtrans initialization ./install.sh auto --extra tbtrans_init # For pybinding support ./install.sh auto --extra pybinding
-
-
Developer Install
pyproject.tomldeclares the broader source-compatible range (Python >=3.10,<3.14,torch >=2.5.1,<=2.12.1). Developers who already manage their own Torch/PyG environment can still use:uv sync
This path is for developers who intentionally manage their own environment. For a tested standalone DeePTB environment, prefer
install.sh. -
Library Installation (Existing Environment)
[!WARNING] This path is for downstream projects or existing environments that import DeePTB as a library. The environment must provide a compatible PyTorch and
torch-scatterbinary wheel.DeePTB keeps a broad Torch compatibility range so downstream projects can choose their own CPU/GPU backend. In that case, install PyTorch first, then install a
torch-scatterbinary wheel matching the current Torch version and backend. If you are working from a DeePTB source checkout, the helper can inspect the current environment and print the matching PyG wheel command:python - <<'PY' import torch print("torch:", torch.__version__) print("cuda runtime:", torch.version.cuda) print("cuda available:", torch.cuda.is_available()) PY python docs/auto_install_torch_scatter.py --dry-run python docs/auto_install_torch_scatter.py
Then install DeePTB from the current source checkout:
pip install .Use
pip install -e .instead if you want an editable developer install. Published package installs, such aspip install dptb, were not part of this compatibility test pass; prefer a source checkout until that path is tested.For standalone DeePTB use on a new machine, use the From Source installer above instead; it creates
.venvand selects a tested Torch / PyG /torch-scattercombination.Example manual
torch-scattercommands:# CPU, torch 2.12.1 pip install --only-binary torch-scatter \ torch-scatter==2.1.2 \ -f https://data.pyg.org/whl/torch-2.12.1+cpu.html # CUDA 12.8 / torch 2.10.0 pip install --only-binary torch-scatter \ torch-scatter==2.1.2+pt210cu128 \ -f https://data.pyg.org/whl/torch-2.10.0+cu128.html
-
Julia Backend (Optional - for High-Performance Pardiso Solver)
[!NOTE] Platform Support: Pardiso backend currently supports Linux only.
- macOS: Not supported (Intel MKL limitations)
- Windows: Use WSL2 (Windows Subsystem for Linux)
If you want to use the Pardiso backend for accelerated band structure calculations:
Automated Installation (Recommended):
./install_julia.sh
Manual Installation:
- Install Julia:
# Linux (macOS can install Julia, but the Pardiso backend is not supported) curl -fsSL https://install.julialang.org | sh
- Install required packages:
julia install_julia_packages.jl
Verify Installation:
julia -e 'using Pardiso; println("Pardiso available: ", Pardiso.MKL_PARDISO_LOADED[])'Usage:
dptb pdso band.json -i model.pth -stu structure.vasp -o ./output
For more details, see:
To ensure the code is correctly installed, please run the unit tests first:
python -m pytest ./dptb/tests/Be careful if not all tests pass!
The following references are required to be cited when using DeePTB. Specifically:
-
For DeePTB-SK:
Q. Gu, Z. Zhouyin, S. K. Pandey, P. Zhang, L. Zhang, and W. E, Deep Learning Tight-Binding Approach for Large-Scale Electronic Simulations at Finite Temperatures with Ab Initio Accuracy, Nat Commun 15, 6772 (2024).
-
For DeePTB-E3:
Z. Zhouyin, Z. Gan, S. K. Pandey, L. Zhang, and Q. Gu, Learning Local Equivariant Representations for Quantum Operators, In The 13th International Conference on Learning Representations (ICLR) 2025.
