A lightweight, high-performance Python package for adding On-Site Spin-Orbit Coupling to Wannier90 Tight-Binding models
- High Performance: Powered by JAX and Just-In-Time (JIT) compilation for lightning-fast fitting (<1s for typical systems).
- Auto-Alignment: Automatically detects the correct matching between TB and DFT bands, including partial band overlap when DFT has fewer bands than TB.
- Physically-Aware: Uses Gaussian-weighted loss centered at the Fermi level to prioritize accuracy near the Fermi surface.
- Differentiable: Uses exact gradients (Automatic Differentiation) for robust convergence, replacing slow derivative-free methods.
-
Non-Negative Constraints: Enforces physically meaningful
$\lambda \geq 0$ during optimization. - Flexible: Supports custom local axes and spin quantization axes.
For users who want to use the GUI without installing Python:
- Go to the Releases Page.
- Download the installer for your OS:
- Windows:
TBSOC-Windows-Installer.exe - macOS:
TBSOC-macOS.dmg
- Windows:
- Run the installer/DMG to set up TBSOC.
Note for macOS: You may need to right-click the app and select 'Open' to bypass security check for unnotarized apps.
If you prefer the command line or want to modify the code:
- Python 3.9+
- uv (Recommended for package management)
git clone https://github.com/DeePTB-Lab/TBSOC.git
cd TBSOC
uv syncpip install .TBSOC includes a modern web-based desktop application for interactive parameter tuning and real-time visualization.
- Ensure
uvis installed. - Frontend is pre-built and included in the repository.
-
Install Dependencies:
uv sync
-
Launch the App:
uv run python -m tbsoc.server.main
This will start a local server and open the GUI in your default browser at
http://localhost:8000.
⚠️ macOS Users: If you see a security warning when opening the app, see macOS Installation Guide for instructions on how to safely open unsigned apps.
-
Interactive Parameter Editor:
- Configure file paths (POSCAR, EIGENVAL, Wannier90 files) with native file picker
- Set Fermi energy and weighting parameters
- Adjust SOC parameters (
$\lambda$ ) with live sliders
-
Real-Time Band Visualization:
- Overlay TB+SOC bands (red) on DFT reference (blue dashed)
- Visualize Gaussian weighting function
- Auto-aligned k-point labels and high-symmetry points
-
Modern UI:
- Light/Dark Mode support
- Live Preview Mode: Drag sliders to instantly see band structure changes
- One-Click Fitting: Run JAX-accelerated optimization with progress tracking
- Partial Band Support: Handles cases where DFT calculations have fewer bands than the TB model
TBSOC provides a command-line interface (tbsoc) with four main modes:
Converts wannier90_hr.dat to a more efficient format.
tbsoc precalc input.jsonAutomatically fits the SOC parameters (EIGENVAL).
tbsoc fit input.jsonKey input.json parameters:
lambdas: Initial guess for SOC strengths (dict format:{"Ga:p": 0.1, "As:p": 0.05}or list). Zero values are fixed; non-zero are optimized.Efermi: DFT Fermi Energy (eV).weight_sigma: (Optional) Standard deviation of Gaussian weighting (default: 2.0 eV).
New in this version:
- Automatically handles partial band overlap (when DFT has fewer bands than TB)
- Uses bottom-half band alignment heuristic for robust matching
- Enforces
$\lambda \geq 0$ constraints
Calculates the final bands with specific SOC parameters and plots the result.
tbsoc addsoc input.jsonGenerate static band structure plots from fitted results.
tbsoc plot input.jsonSee example/ directory for complete examples (GaAs, Si, TaAs, etc.).
{
"lambdas": {"Ga:p": 0.1, "As:p": 0.05},
"Efermi": 4.0815,
"weight_sigma": 2.0,
"EMIN": -10,
"EMAX": 10
}- Partial Band Fitting: Robust alignment when DFT band count < TB band count
- Gaussian Weighting: More physically meaningful energy window weighting
- GUI Enhancements: Removed structure viewer, optimized layout for band visualization
-
Non-Negative Constraints: Ensures
$\lambda \geq 0$ during optimization - Improved Alignment: Bottom-half band matching heuristic for better convergence
If you use this code, please cite our paper:
@article{GU2023112090,
title = {A computational method to estimate spin–orbital interaction strength in solid state systems},
journal = {Computational Materials Science},
volume = {221},
pages = {112090},
year = {2023},
issn = {0927-0256},
doi = {https://doi.org/10.1016/j.commatsci.2023.112090},
url = {https://www.sciencedirect.com/science/article/pii/S0927025623000848},
author = {Qiangqiang Gu and Shishir Kumar Pandey and Rajarshi Tiwari}
}