Skip to main content

A unified deep learning package for electronic structure models including tight-binding, KS Hamiltonian and density matrix models

Project description

DeePTB Logo

DeepModeling Build Test PyPI version License

🚀 About DeePTB

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:
    1. 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.
    2. 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:

📚 Documentation

🛠️ Installation

Installing DeePTB is straightforward with UV, a fast Python package manager.

  • Requirements

    • Git
    • Python 3.9 to 3.12 (UV can auto-install if needed)
    • PyTorch 2.0.0 to 2.5.1 (auto-installed by UV)
  • From Source (Recommended)

    1. 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"
      
    2. Clone DeePTB:

      git clone https://github.com/deepmodeling/DeePTB.git
      cd DeePTB
      
    3. Install DeePTB with all dependencies:

      CPU version (default):

      uv sync
      # Or use the convenience script
      ./install.sh
      

      GPU version (specify CUDA version via command line, no file editing needed):

      # Check your CUDA version first
      nvidia-smi  # Look for CUDA Version
      
      # Install with your CUDA version (examples):
      uv sync --find-links https://data.pyg.org/whl/torch-2.5.0+cu118.html  # CUDA 11.8
      uv sync --find-links https://data.pyg.org/whl/torch-2.5.0+cu121.html  # CUDA 12.1
      uv sync --find-links https://data.pyg.org/whl/torch-2.5.0+cu124.html  # CUDA 12.4
      
      # Or use the convenience script
      ./install.sh cu121  # for CUDA 12.1
      

      This single command will:

      • Automatically create a virtual environment (.venv)
      • Install PyTorch (>=2.0.0, <=2.5.1) with the specified variant (CPU/GPU)
      • Install torch_scatter from PyTorch Geometric index
      • Install all other dependencies
    4. Install optional dependencies (if needed):

      # For 3D Fermi surface plotting
      uv sync --extra 3Dfermi
      
      # For TBtrans initialization
      uv sync --extra tbtrans_init
      
      # For pybinding support
      uv sync --extra pybinding
      
      # Install all optional dependencies
      uv sync --all-extras
      
    5. Run DeePTB:

      # UV automatically activates the environment when using 'uv run'
      uv run dptb --help
      
      # Or activate the environment manually
      source .venv/bin/activate  # On Unix/macOS
      .venv\Scripts\activate     # On Windows
      dptb --help
      
  • GPU Support (Optional)

    GPU installation is now built into the main installation step above! Simply use:

    # Check CUDA version
    nvidia-smi
    
    # Install with command line (recommended - no file editing!)
    uv sync --find-links https://data.pyg.org/whl/torch-2.5.0+cu121.html
    
    # Or use convenience script
    ./install.sh cu121
    

    See step 3 above for all available CUDA versions.

  • Easy Installation (PyPI)

    [!WARNING] PyPI installation requires manual torch_scatter installation first, as torch_scatter is not available on PyPI.

    For CPU:

    # 1. Install torch_scatter first
    pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0+cpu.html
    
    # 2. Install DeePTB
    pip install dptb
    

    For GPU (example with CUDA 12.1):

    # 1. Install torch with CUDA support
    pip install torch --index-url https://download.pytorch.org/whl/cu121
    
    # 2. Install torch_scatter matching your CUDA version
    pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0+cu121.html
    
    # 3. Install DeePTB
    pip install dptb
    

    [!TIP] For easier installation with automatic GPU/CPU detection, use the From Source method above instead.

  • 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:

    1. Install Julia:
      # Linux (macOS can install Julia, but the Pardiso backend is not supported)
      curl -fsSL https://install.julialang.org | sh
      
    2. 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:

Test code

To ensure the code is correctly installed, please run the unit tests first:

uv run pytest ./dptb/tests/

Be careful if not all tests pass!

🤝 How to Cite

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

dptb-2.2.1-py3-none-any.whl (55.9 MB view details)

Uploaded Python 3

File details

Details for the file dptb-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: dptb-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 55.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for dptb-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db8e9e602a90b35e4afd084c3831d9847e445c7dd82ec840f396f667fc22d946
MD5 484fd3e9ecea9bbc8026718d51b53906
BLAKE2b-256 5b055d27718e29eefb79e3a2ff675a073e93ea4ac7a66f0718f11923b0a19fd4

See more details on using hashes here.

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