Skip to main content

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:

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:

Acknowledgments

HamiltonIO builds upon and integrates with:

  • sisl - SIESTA interface
  • ASE - Atomic simulation environment
  • NumPy - Numerical computing

Project details


Download files

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

Source Distribution

hamiltonio-0.3.5.tar.gz (106.9 kB view details)

Uploaded Source

Built Distribution

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

hamiltonio-0.3.5-py3-none-any.whl (115.6 kB view details)

Uploaded Python 3

File details

Details for the file hamiltonio-0.3.5.tar.gz.

File metadata

  • Download URL: hamiltonio-0.3.5.tar.gz
  • Upload date:
  • Size: 106.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for hamiltonio-0.3.5.tar.gz
Algorithm Hash digest
SHA256 ff7af4894c08f698f56faea6f6c763680392c84f4e1963efb1d0577746b8ddf1
MD5 e5ad0181dbf0c6e6fb7caa944e5c37a2
BLAKE2b-256 e0a44ebd8d1ffa3ea13ef628f2306bcaaf2541510c4daede8c3e6c34ce5a27b6

See more details on using hashes here.

File details

Details for the file hamiltonio-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: hamiltonio-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 115.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for hamiltonio-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3c83f548009883b6a6664d795d4fcf895a3c35e93d083992c93b685b1a21d3d0
MD5 b2aadf12954492773dc23e2c4bb21016
BLAKE2b-256 43ba2b9978c4ea529fab8bf5c90a941d5ad9449a2492318dadb25449ee5f4cb1

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