Rust/Rayon implementation for DFTB calculations.
Project description
Rust_DFTB
rust_dftb is a Rust/Rayon implementation for DFTB-style calculations with a Python interface. The repository is intended for development and verification of the Rust backend, Python API, and ASE wrapper.
This package does not bundle Slater-Koster parameter files. Pass an external directory containing .skf files through skf_dir.
Requirements
- Python >= 3.10
- Rust toolchain >= 1.76, including
cargo maturin >= 1.5,<2- NumPy >= 1.23
- A BLAS/LAPACK backend
- Optional: ASE, for
rust_dftb.aseand the ASE examples
The default Cargo feature set uses openblas-system, so the build expects system OpenBLAS with CBLAS/LAPACKE headers and libraries. On Debian/Ubuntu-like systems this usually means installing the OpenBLAS development package before building.
Development install
python -m pip install -U pip maturin numpy
maturin develop --release --features python
For ASE support:
python -m pip install ase
For tests and development tools:
python -m pip install -e ".[dev]"
python -m pytest
cargo test
Minimal Python API example
import numpy as np
from rust_dftb import DftbCalculator, backend_info
z = np.array([1, 1], dtype=np.int64)
positions = np.array(
[[0.0, 0.0, 0.0], [0.74, 0.0, 0.0]],
dtype=np.float64,
)
print(backend_info())
calc = DftbCalculator(skf_dir="/path/to/skf", order=2, parallel=True)
print(calc.energy(z, positions))
print(calc.forces(z, positions))
For periodic calculations, pass a cell in Angstrom:
cell = np.eye(3) * 20.0
print(calc.energy(z, positions, cell_angstrom=cell))
print(calc.stress(z, positions, cell_angstrom=cell))
Minimal ASE example
from ase import Atoms
from rust_dftb.ase import ase_calculator
atoms = Atoms("H2", positions=[[0.0, 0.0, 0.0], [0.74, 0.0, 0.0]])
atoms.calc = ase_calculator(skf_dir="/path/to/skf", order=2, parallel=True)
print(atoms.get_potential_energy())
print(atoms.get_forces())
ASE-facing quantities use ASE conventions: positions and cells in Angstrom, energies in eV, forces in eV/Angstrom, and stress in eV/Angstrom^3. The lower-level Python API uses the native units documented in the implementation and examples.
Examples
More complete usage examples are in examples/:
python examples/python_api_all_levels.py --skf-dir /path/to/skf --structure water
python examples/ase_all_levels.py --skf-dir /path/to/skf --structure methane --levels dftb2
See examples/README.md for the longer walkthroughs.
References
The implementation and examples in this repository are related to the following DFTB, SCC-DFTB, DFTB3, multipole-extended DFTB, and ASE references.
-
D. Porezag, T. Frauenheim, T. Köhler, G. Seifert, and R. Kaschner, “Construction of tight-binding-like potentials on the basis of density-functional theory: Application to carbon,” Phys. Rev. B 51, 12947 (1995). DOI:
10.1103/PhysRevB.51.12947. -
M. Elstner, D. Porezag, G. Jungnickel, J. Elsner, M. Haugk, T. Frauenheim, S. Suhai, and G. Seifert, “Self-consistent-charge density-functional tight-binding method for simulations of complex materials properties,” Phys. Rev. B 58, 7260 (1998). DOI:
10.1103/PhysRevB.58.7260. -
M. Gaus, Q. Cui, and M. Elstner, “DFTB3: Extension of the self-consistent-charge density-functional tight-binding method (SCC-DFTB),” J. Chem. Theory Comput. 7, 931-948 (2011). DOI:
10.1021/ct100684s. -
V.-Q. Vuong, T. W. Williams, J. Li, Q. Cui, and I. S. Ufimtsev, “Multipole expansion of atomic electron density fluctuation interactions in the density-functional tight-binding method,” J. Chem. Theory Comput. 19, 8152-8171 (2023). DOI:
10.1021/acs.jctc.3c00778. -
A. H. Larsen et al., “The atomic simulation environment — a Python library for working with atoms,” J. Phys.: Condens. Matter 29, 273002 (2017). DOI:
10.1088/1361-648X/aa680e.
License
GPL-3.0-or-later.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rust_dftb-0.1.0.tar.gz.
File metadata
- Download URL: rust_dftb-0.1.0.tar.gz
- Upload date:
- Size: 192.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44a596dac3d167132397907311d6d9a9d9aa81b3c74e5f9d106b38265ff031e3
|
|
| MD5 |
37a8eafb8a793e2d2339f84c3b71b1fd
|
|
| BLAKE2b-256 |
1df1f75a8017ee4a864b2437bb240b0c2b006748e551a8be14b123ca8ba52e63
|