Skip to content

Input file generation

InputFile dataclass

An AkaiKKR input file.

Can be constructed directly from individual parameters or reconstructed from any parsed CalculationResult via from_result(). Call to_string() to render the free-column text that AkaiKKR expects, or write() to save it to disk.

Attributes:

Name Type Description
mode str

Calculation mode — "go", "dos", or "spc".

data_file str

Data file prefix written to the second line of the input (e.g. "data/fe").

bravais str

Bravais lattice type (e.g. "bcc", "fcc", "hexagonal").

a float

Lattice constant in bohr.

atom_types list[AtomType]

Ordered list of site-type definitions. Component concentrations must be fractions (0–1) and must sum to 1.0 per type.

positions list[AtomPosition]

Ordered list of fractional atomic positions.

c_over_a float

c/a ratio. Rendered as "," (AkaiKKR default) when equal to 1.0.

b_over_a float

b/a ratio. Same convention as c_over_a.

alpha float

α lattice angle in degrees. Rendered as "," when 90.0.

beta float

β lattice angle in degrees. Same convention.

gamma float

γ lattice angle in degrees. Same convention.

edelt float

Energy mesh spacing in Ry.

ewidth float

Energy window half-width in Ry.

reltyp str

Relativistic approximation ("nrl", "sra", "fra").

sdftyp str

Exchange-correlation functional (e.g. "mjwasa", "mjw", "ggapw").

magtyp str

Magnetic treatment (e.g. "mag", "nmag", "kick", or a variant like "kick3") — AkaiKKR treats this as a free string, not a fixed enum.

record str

Record type — "2nd" or "1st".

outtyp str

Output type — "update" or "quit".

bzqlty int | str

Brillouin zone mesh quality — an integer mesh count, or one of AkaiKKR's quality letter codes ("t", "l", "m", "h", "u").

maxitr int

Maximum number of SCF iterations.

pmix float

Mixing parameter.

mixtyp str

Mixing-type suffix attached directly to pmix with no separator (e.g. "br" for Broyden, rendered as "0.02br"). Empty string means no mixing type is specified.

title str

Optional comment placed on the first line. Auto-derived from bravais and the first atom-type name when empty.

kpath KPath | None

k-point path for Bloch spectral function calculations. Must be None unless mode is "spc".

primitive_vectors tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]] | None

Three explicit primitive lattice vectors (v1, v2, v3), each a (x, y, z) tuple in units of a. Required when bravais is "aux" or "prv" (AkaiKKR reads these instead of c_over_a/b_over_a/angles in that case); must be None otherwise.

__post_init__() -> None

Validate field consistency after construction.

Raises:

Type Description
InputValidationError

If any field violates a structural constraint.

from_file(path: Path | str) -> InputFile classmethod

Read an AkaiKKR input file from disk and parse it.

Parameters:

Name Type Description Default

path

Path | str

Path to the input file.

required

Returns:

Type Description
InputFile

The parsed InputFile.

Raises:

Type Description
InputValidationError

If the file content is malformed.

from_result(result: CalculationResult, *, mode: str | None = None, kpath: KPath | None = None, reset_rmt: bool = False) -> InputFile classmethod

Reconstruct an InputFile from a parsed AkaiKKR result.

All scalar parameters are taken from result.input_params. Atom types and positions are copied from the result, with an option to reset the muffin-tin radii to zero so AkaiKKR recomputes them.

Parameters:

Name Type Description Default

result

CalculationResult

Any parsed calculation result (GO, DOS, or SPC).

required

mode

str | None

Override the calculation mode. Defaults to the mode recorded in result.input_params.go.

None

kpath

KPath | None

k-point path for SPC calculations. Only valid when mode is "spc".

None

reset_rmt

bool

When True, sets every muffin-tin radius to 0.0 so AkaiKKR recomputes it automatically on the next run. Defaults to False, which preserves the radii exactly as they appear in the parsed result.

False

Returns:

Type Description
InputFile

A new InputFile ready to render or further modify.

Raises:

Type Description
InputValidationError

If the resolved mode is not a valid AkaiKKR mode, or if result.input_params.brvtyp is "aux"/"prv" — reconstructing explicit primitive vectors from a parsed result is not currently supported.

from_string(text: str) -> InputFile classmethod

Parse an AkaiKKR free-column input file into an InputFile.

This is the inverse of to_string(): it reads an optional title comment, mode/data_file line, lattice line, energy/relativistic line, outtyp/bzqlty/maxitr/pmix line, atom-type block, and position block, following the same free-format conventions to_string() writes (whitespace-separated tokens, "," meaning "use the default" for optional lattice parameters). Separator lines and comment lines — any line whose first character is "c", "C", or "#" — are skipped as structural landmarks only, matching AkaiKKR's own comment rule. A title comment is optional: AkaiKKR itself has no concept of one, so it is only captured when the very first line happens to be a comment.

When bravais is "aux" or "prv", the three primitive vectors are read in place of c/a, b/a, and the lattice angles, matching AkaiKKR's own special-case handling of those lattice types.

For mode == "spc", any content after the position block other than a bare "end" line is parsed as a KPath: the first line is nkpts and the remaining lines are x y z k-point triples. to_string() never writes k-point labels, so parsed KPoint instances always have label=None — this is an unrecoverable round-trip limitation.

Parameters:

Name Type Description Default

text

str

The full input-file text.

required

Returns:

Type Description
InputFile

The parsed InputFile.

Raises:

Type Description
InputValidationError

If the text is malformed — wrong token counts, non-numeric values where numbers are expected, or a structural constraint from __post_init__ is violated.

to_string() -> str

Render the input file as a string in AkaiKKR free-column format.

Returns:

Type Description
str

The complete input file text, terminated by a newline.

write(path: Path | str) -> None

Write the rendered input file to disk.

Parameters:

Name Type Description Default

path

Path | str

Destination file path. Parent directories must exist.

required

KPath dataclass

A sequence of high-symmetry k-points for a band-structure calculation.

Attributes:

Name Type Description
nkpts int

Total number of k-points sampled along the full path.

points list[KPoint]

Ordered list of high-symmetry k-points defining the path.

KPoint dataclass

One high-symmetry k-point on a band-structure path.

Coordinates are stored as strings to preserve fractional notation (e.g. "1/2", "3/4"), which AkaiKKR reads directly from the input file.

Attributes:

Name Type Description
x str

First reciprocal-lattice coordinate (e.g. "0", "1/2").

y str

Second reciprocal-lattice coordinate.

z str

Third reciprocal-lattice coordinate.

label str | None

Optional human-readable Brillouin-zone label (e.g. "Γ", "H"). Stored for annotation purposes only — not written to the AkaiKKR input file.