Tools for AkaiKKR electronic structure calculation output files
Project description
akaitools
akaitools parses output files from AkaiKKR, a Korringa-Kohn-Rostoker (KKR) Green's function code for electronic structure calculations. It turns raw text output into structured, fully typed Python objects and can generate new AkaiKKR input files from scratch or from parsed results.
Key features
- Parse SCF, DOS, and SPC/BSF outputs with
parse_go(),parse_dos(), andparse_spc() - Access spin-resolved DOS through
spin_up,spin_down,get_component(), andselect() - Read Bloch spectral function matrices with automatic spectral-data discovery and high-symmetry k-point labels
- Work with frozen dataclass models backed by NumPy arrays, with eV conversion helpers on energy-bearing fields
- Export DOS and SCF iteration data to pandas with
.to_dataframe() - Generate Matplotlib figures for DOS and SCF convergence with
akaitools.plot - Inspect files from the terminal with
akaitools go|dos|spc - Build AkaiKKR inputs programmatically with
InputFile, including CPA alloys, multi-site structures, and SPCKPath/KPointdefinitions
Installation
# Recommended
uv add akaitools
# pip
pip install akaitools
# Latest from GitHub
pip install git+https://github.com/dogusariturk/akaitools.git
For CLI-only use: install akaitools as a standalone tool available globally, without adding it to a project:
uv tool install akaitools
Or run one-off commands without installing:
uvx akaitools go calculation.out
uvx akaitools dos dos.out --json
Quickstart
SCF output
Use parse_go to parse a self-consistent field output file. The result contains the full convergence history, per-atom electronic and magnetic properties, and crystal structure information.
from akaitools import parse_go
scf = parse_go("calculation.out")
print(f"Converged : {scf.converged}")
print(f"Iterations : {len(scf.iterations)}")
print(f"Total energy: {scf.iterations[-1].total_energy:.8f} Ry")
print(f"Moment : {scf.iterations[-1].moment:.4f} uB")
df = scf.to_dataframe() # columns: neu, moment, total_energy_Ry, total_energy_eV, rms_error
DOS output
Use parse_dos to parse a density of states output file. Components can be accessed by index and spin with get_component, or filtered by element, site type, or label with select.
from akaitools import parse_dos
dos = parse_dos("dos.out")
for comp in dos.spin_up:
print(f"Component {comp.component_index} [{comp.label}] up: {len(comp.energy)} points")
fe_up = dos.get_component(1, "up")
print(f"Energy range: {fe_up.energy[0]:.3f} to {fe_up.energy[-1]:.3f} Ry")
print(f"d-DOS max : {fe_up.d.max():.4f} states/Ry/cell")
x_up = dos.select(symbol="X", spin="up")
df = dos.to_dataframe()
SPC output
Use parse_spc to parse a Bloch Spectral Function output. The *_up.spc and *_dn.spc data files are located automatically next to the log file, or can be provided explicitly via data_up and data_down.
from akaitools import parse_spc
spc = parse_spc("calculation.spc")
if spc.spectral_up is not None and spc.spectral_up.data is not None:
bsf = spc.spectral_up
print(f"BSF shape: {bsf.data.shape}")
print(f"k-labels : {bsf.kmesh.high_symmetry_indices}")
parse_spc() auto-locates *_up.spc and *_dn.spc next to the log file. Use base_dir, data_up, or data_down to override the discovery logic when needed.
Plotting
akaitools.plot provides ready-made Matplotlib figures for the most common visualizations. All functions return a Figure object for further customization before saving.
from akaitools import parse_dos, parse_go
from akaitools.plot import plot_convergence, plot_dos
scf = parse_go("calculation.out")
dos = parse_dos("dos.out")
plot_convergence(scf, field="rms_error").savefig("convergence.png")
plot_dos(dos, orbitals=["total", "d"], energy_unit="eV").savefig("dos.png")
plot_dos(dos, orbitals=["total"]).savefig("dos_overlay.png")
CLI
The akaitools command provides quick summaries of output files without writing any Python. Use --json for machine-readable output.
akaitools go calculation.out # summarize SCF output
akaitools go calculation.out --json # output as JSON
akaitools dos dos.out -c 1 # DOS summary for component 1
akaitools spc calculation.spc --base-dir /path/to/run # SPC summary
Input generation
Use InputFile to write a new AkaiKKR input file from scratch. All parameters have sensible defaults; only mode, data_file, bravais, a, atom_types, and positions are required.
from akaitools import InputFile, KPath, KPoint, parse_go
from akaitools.models import AtomicComponent, AtomPosition, AtomType
fe = InputFile(
mode="go",
data_file="data/fe",
bravais="bcc",
a=5.27,
atom_types=[
AtomType(
name="Fe",
rmt=0.0,
field=0.0,
lmxtyp=2,
components=[AtomicComponent(anclr=26.0, conc=1.0)],
)
],
positions=[AtomPosition(x=0.0, y=0.0, z=0.0, atom_type="Fe")],
)
fe.write("fe.in")
scf = parse_go("calculation.out")
InputFile.from_result(scf, mode="dos").write("dos.in")
kpath = KPath(
nkpts=300,
points=[
KPoint("0", "0", "0", label="G"),
KPoint("0", "1", "0", label="H"),
KPoint("1/2", "1/2", "0", label="N"),
],
)
InputFile.from_result(scf, mode="spc", kpath=kpath).write("spc.in")
License
This project is licensed under the GNU GPLv3 License. See LICENSE.
Citation
We are currently preparing a preprint for publication.
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 akaitools-0.1.0.tar.gz.
File metadata
- Download URL: akaitools-0.1.0.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd2bc62d540439295e50bbc532e7127fc38ac2d81e198a7869037a8096d95bb
|
|
| MD5 |
dd5bbe6dc7dd4e7bc32be9a3f5201f34
|
|
| BLAKE2b-256 |
d34c2b54fdd0c7ee0ac443c79f88b6e4d1f46d58870ce32488a51bd7e5d2f241
|
File details
Details for the file akaitools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: akaitools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51deb085ad471850f4b2a89b26dadeb142887c18d9bba05c70d95534816c748c
|
|
| MD5 |
a72add38b964bb80138feffea47fe988
|
|
| BLAKE2b-256 |
5fa88c8641f139bdab43600a373c559b8413e76a84a787560883580796eaf432
|