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
from ase.io import read
from HamiltonIO.abacus import AbacusParser
from HamiltonIO import plot_band_structure
parser = AbacusParser(outpath="./OUT.material/")
model = parser.get_models()
atoms = read("structure.cif")
# Automatic ASE high-symmetry path and Matplotlib plot
bands, ax = plot_band_structure(
model,
atoms,
path=None, # or e.g. path="GXMG"
npoints=300,
fermi_energy=5.2, # optional; shifts plotted energies only
filename="bands.png",
)
# Reuse the raw band data programmatically
print(bands.kpoints.shape, bands.energies.shape)
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:
Metadata
Release files for HamiltonIO 0.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hamiltonio-0.3.8.tar.gz | 141.6 kB | Without provenance | Details for hamiltonio-0.3.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hamiltonio-0.3.8-py3-none-any.whl | Python 3 | none | any | Details for hamiltonio-0.3.8-py3-none-any.whl |
Total release size: 286.1 kB
Release files / hamiltonio-0.3.8.tar.gz
| Download URL | hamiltonio-0.3.8.tar.gz |
|---|---|
| Size | 141.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e67b40fb4c8206a03747c2836bc417ff2beae613e7a25af57ba2b23a4b940baf
|
|
BLAKE2b-256 checksum How to use checksums |
5eff1107763c2b3f95578bb48fd10468483375dae87251b975d42accbf7f2ece
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / hamiltonio-0.3.8-py3-none-any.whl
| Download URL | hamiltonio-0.3.8-py3-none-any.whl |
|---|---|
| Size | 144.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff93299b70f91987c02f06cafcf2f01a7434abf17ae673a496fbc22e2e18e29a
|
|
BLAKE2b-256 checksum How to use checksums |
6f89dded97f742e873dbb70f89aa2da17472a9ea3cb53e604c77de1254169c04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Security for HamiltonIO 0.3.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.