A library for reading/writting Hamiltonian with localized basis set.
Project description
HamiltonIO
A library for reading and analyzing Hamiltonian files from various DFT codes (ABACUS, SIESTA, EPW/Quantum ESPRESSO, Wannier90).
Features
- Multi-code support: ABACUS, SIESTA, EPW, Wannier90
- Spin configurations: Non-polarized, collinear, non-collinear, spin-orbit coupling
- Real and k-space analysis: Band structures, DOS, Hamiltonian decomposition
- Command-line tools: Easy-to-use CLI for common analysis tasks
- Python API: Full programmatic access for custom workflows
Installation
pip install hamiltonIO
Or install from source:
git clone https://github.com/mailhexu/HamiltonIO.git
cd HamiltonIO
pip install .
Quick Start
Command Line Tools
HamiltonIO provides CLI tools for quick analysis:
# Convert EPW files to NetCDF
hamiltonio-epw epw_to_nc --path ./data --prefix material --output epmat.nc
# Analyze ABACUS intra-atomic Hamiltonians
hamiltonio-abacus intra-atomic --outpath OUT.ABACUS
# Analyze SIESTA intra-atomic Hamiltonians
hamiltonio-siesta intra-atomic siesta.fdf
For detailed CLI usage, see CLI Documentation.
Python Library
# ABACUS
from HamiltonIO.abacus import AbacusParser
parser = AbacusParser(outpath="./OUT.material/")
model = parser.get_models()
evals, evecs = model.solve([0, 0, 0]) # Solve at Gamma point
# SIESTA
from HamiltonIO.siesta import SiestaHam
model = SiestaHam("siesta.fdf")
evals, evecs = model.solve([0, 0, 0])
# EPW
from HamiltonIO.epw import Epmat
epmat = Epmat()
epmat.read(path="./", prefix="material", epmat_ncfile="epmat.nc")
# Wannier90
from HamiltonIO.wannier import Wannier90Hamiltonian
model = Wannier90Hamiltonian("wannier90_hr.dat")
evals, evecs = model.solve([0, 0, 0])
Documentation
Detailed documentation for each interface:
- Installation - Installation methods and requirements
- CLI Tools - Command-line interface usage
- ABACUS - ABACUS interface and examples
- SIESTA - SIESTA interface and examples
- EPW - EPW/Quantum ESPRESSO interface
- Wannier90 - Wannier90 interface
- Distance Analysis - Hopping distance analysis
Key Features by Code
ABACUS
- Automatic spin detection (non-polarized, collinear, noncollinear)
- Binary and text CSR format support
- Split-SOC analysis via finite difference
- Intra-atomic Hamiltonian decomposition
SIESTA
- NetCDF and HSX format support
- Split-SOC from native SIESTA output
- Collinear and non-collinear calculations
- Integration with sisl library
EPW (Quantum ESPRESSO)
- Binary to NetCDF conversion
- Wigner-Seitz grid handling
- Electron-phonon coupling matrices
- Crystal structure from EPW data
Wannier90
- HR format parsing
- Distance-resolved hopping analysis
- Band interpolation
- Orbital projections
Common Workflows
Intra-Atomic Analysis
# ABACUS: Analyze atoms 0, 1, 2 with full matrices
hamiltonio-abacus intra-atomic --outpath OUT.Fe \
--atoms 0,1,2 --show-matrix -o analysis.txt
# SIESTA: Split-SOC analysis
hamiltonio-siesta intra-atomic siesta.fdf \
--split-soc --show-matrix -o soc_analysis.txt
File Conversion
# EPW: Convert binary to NetCDF (faster I/O)
hamiltonio-epw epw_to_nc --path ./epw_data \
--prefix material --output epmat.nc
Band Structure
import numpy as np
from HamiltonIO.abacus import AbacusParser
# Load model
parser = AbacusParser(outpath="./OUT.material/")
model = parser.get_models()
# High-symmetry path
k_path = np.array([
[0.0, 0.0, 0.0], # Gamma
[0.5, 0.0, 0.0], # X
[0.5, 0.5, 0.0], # M
])
# Calculate bands
bands = []
for k in k_path:
evals, _ = model.solve(k)
bands.append(evals)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the terms specified in the LICENSE file.
Citation
If you use HamiltonIO in your research, please cite:
@software{hamiltonIO,
author = {Xu, He},
title = {HamiltonIO: A Library for DFT Hamiltonian I/O},
url = {https://github.com/mailhexu/HamiltonIO},
year = {2024}
}
Contact
For questions, bug reports, or feature requests:
- GitHub Issues: https://github.com/mailhexu/HamiltonIO/issues
- Email: mailhexu@gmail.com
Acknowledgments
HamiltonIO builds upon and integrates with:
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hamiltonio-0.3.1.tar.gz.
File metadata
- Download URL: hamiltonio-0.3.1.tar.gz
- Upload date:
- Size: 102.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
828f3834a7f86d8633eaf037b980a0303423f9a450464c5a8d8e6b916f75887d
|
|
| MD5 |
2bf79bc25e6dab9d24ffbae877c7c1f8
|
|
| BLAKE2b-256 |
055118df8f6d0deb16e0286166550c1bbdd8ce4f56549406be09e6390bad1f47
|
File details
Details for the file hamiltonio-0.3.1-py3-none-any.whl.
File metadata
- Download URL: hamiltonio-0.3.1-py3-none-any.whl
- Upload date:
- Size: 112.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34e1dc3d06ff02a5434d14a5b3ab8a5fce464fbfded5446a5173ebbedc9170bd
|
|
| MD5 |
34cd1981ddf12c8fededa1d83c99e5a8
|
|
| BLAKE2b-256 |
3cc4c3ce416b8c608fcd7cb1cc3141d8abee9f24b849b9edb13132534a237f36
|