Skip to main content

Tools for AkaiKKR electronic structure calculation output files

Project description

akaitools-logo

akaitools

License: GPL-3.0-or-later Python Platforms

Tests Lint

DOI

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.

Report a Bug | Request a Feature | Documentation


Key features

  • Parse SCF, DOS, and SPC/BSF outputs with parse_go(), parse_dos(), and parse_spc()
  • Access spin-resolved DOS through spin_up, spin_down, get_component(), and select()
  • 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 SPC KPath / KPoint definitions

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. If you use akaitools in your research, please cite the following:

Sarıtürk, D. (2026). akaitools. Zenodo. https://doi.org/10.5281/zenodo.19874850

BibTeX:

@software{sariturk_2026_19874850,
  author    = {Sarıtürk, Doğuhan},
  title     = {akaitools},
  year      = 2026,
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.19874850},
  url       = {https://doi.org/10.5281/zenodo.19874850},
}

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

akaitools-0.1.1.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

akaitools-0.1.1-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file akaitools-0.1.1.tar.gz.

File metadata

  • Download URL: akaitools-0.1.1.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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

Hashes for akaitools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c6633db1128c2ac99e6cf87d0f1b0f7093a1fb0330fc7cbe195a7a3f12e3c09e
MD5 7b2e38dddd90cb4cc32d0190664d8d56
BLAKE2b-256 ecc9edea26084076648e2383b3ad4ccb5878189bf5823d98701d5d3cc3a91057

See more details on using hashes here.

File details

Details for the file akaitools-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: akaitools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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

Hashes for akaitools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 962ba8c943ac8291a6ce38f28b6c20297a051016ac1e9a160e04f0cbe39f6864
MD5 6257bfa6adf5db7c275d16a4d1708c5b
BLAKE2b-256 d35543e425a2550d89486ce565fd8db0db855044f849473c87853aca663e6aa6

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