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 — |
data_file |
str
|
Data file prefix written to the second line of the input
(e.g. |
bravais |
str
|
Bravais lattice type (e.g. |
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 |
b_over_a |
float
|
b/a ratio. Same convention as |
alpha |
float
|
α lattice angle in degrees. Rendered as |
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 ( |
sdftyp |
str
|
Exchange-correlation functional (e.g. |
magtyp |
str
|
Magnetic treatment (e.g. |
record |
str
|
Record type — |
outtyp |
str
|
Output type — |
bzqlty |
int | str
|
Brillouin zone mesh quality — an integer mesh count, or one
of AkaiKKR's quality letter codes ( |
maxitr |
int
|
Maximum number of SCF iterations. |
pmix |
float
|
Mixing parameter. |
mixtyp |
str
|
Mixing-type suffix attached directly to |
title |
str
|
Optional comment placed on the first line. Auto-derived from
|
kpath |
KPath | None
|
k-point path for Bloch spectral function calculations. Must
be |
primitive_vectors |
tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]] | None
|
Three explicit primitive lattice vectors
|
__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 | str
|
Path to the input file. |
required |
Returns:
| Type | Description |
|---|---|
InputFile
|
The parsed |
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 |
|---|---|---|---|
|
CalculationResult
|
Any parsed calculation result (GO, DOS, or SPC). |
required |
|
str | None
|
Override the calculation mode. Defaults to the mode recorded in |
None
|
|
KPath | None
|
k-point path for SPC calculations. Only valid when |
None
|
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
InputFile
|
A new |
Raises:
| Type | Description |
|---|---|
InputValidationError
|
If the resolved mode is not a valid AkaiKKR
mode, or if |
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 |
|---|---|---|---|
|
str
|
The full input-file text. |
required |
Returns:
| Type | Description |
|---|---|
InputFile
|
The parsed |
Raises:
| Type | Description |
|---|---|
InputValidationError
|
If the text is malformed — wrong token
counts, non-numeric values where numbers are expected, or a
structural constraint from |
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 | 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. |
y |
str
|
Second reciprocal-lattice coordinate. |
z |
str
|
Third reciprocal-lattice coordinate. |
label |
str | None
|
Optional human-readable Brillouin-zone label (e.g. |