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.2.tar.gz (102.7 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.2-py3-none-any.whl (112.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hamiltonio-0.3.2.tar.gz
  • Upload date:
  • Size: 102.7 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.2.tar.gz
Algorithm Hash digest
SHA256 6b58b41eed3d68bcf6dc3de7eb1bfa928d63c73a1b1e8f322f14640c2cdd7fe5
MD5 f898f895b987116dbb701a038d0ff0c7
BLAKE2b-256 17165c5a5869662bd5301aa4310cff7b21d1d5feb6141933ef1162884524418f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hamiltonio-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 112.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da9c4dd0d4134e1a94511d16c2a5278f3af55c3c362a8caed5f4cad148a1346e
MD5 7a13175624f906cedf53b3f871557873
BLAKE2b-256 48d23af0730c9822898f15b867826aa307d1a0f22ab9392208195f064152baf0

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