Skip to content

dft.kpoints

k-point meshes and band-structure diagnostics.

import mlx_atomistic.dft.kpoints

class BandPath
def __init__(points: Sequence[KPoint])

Explicit k-point path for non-SCF band diagnostics.

Parameters

NameTypeDefaultDescription
pointsSequence[KPoint]

Methods

def line(start: Sequence[float], end: Sequence[float], *, count: int, start_label: str | None = None, end_label: str | None = None, coordinate_system: str = 'cartesian') -> BandPath

Build a linear path between two k points.

Parameters

NameTypeDefaultDescription
startSequence[float]Starting three-component k-point vector.
endSequence[float]Ending three-component k-point vector.
countintNumber of points, including both endpoints.
start_labelstr | NoneNoneOptional label for the first point.
end_labelstr | NoneNoneOptional label for the last point.
coordinate_systemstr'cartesian'"cartesian" or "reduced". Defaults to "cartesian" for compatibility with the toy band path.

Returns

  • BandPath — Explicit uniformly sampled band path.
class BandStructureResult
def __init__(kpoints: tuple[KPoint, ...], eigenvalues: mx.array, reused_density: bool, nonlocal_available: bool = False, nonlocal_applied: bool = False, nonlocal_projector_count: int = 0)

Non-SCF band energies along a path.

Parameters

NameTypeDefaultDescription
kpointstuple[KPoint, ...]Cartesian k-points evaluated in path order.
eigenvaluesmx.arrayEigenvalue array with shape (n_kpoints, n_bands).
reused_densityboolWhether the calculation reused the SCF density without another SCF cycle.
nonlocal_availableboolFalseWhether ion-backed nonlocal projector metadata was available on the system.
nonlocal_appliedboolFalseWhether nonlocal projectors were applied to the band Hamiltonian.
nonlocal_projector_countint0Number of projector channels included when nonlocal projectors were applied.

Methods

def to_dict() -> dict

Return JSON-safe band data.

Returns

  • dict
class KPoint
def __init__(vector: Sequence[float], *, weight: float = 1.0, label: str | None = None, coordinate_system: str = 'cartesian')

One reciprocal-space k point.

Parameters

NameTypeDefaultDescription
vectorSequence[float]Three-component k-point vector. Cartesian vectors are in the same reciprocal units as ReciprocalGrid.vectors; reduced vectors are fractional diagnostic coordinates and are not accepted by Hamiltonian evaluation.
weightfloat1.0Positive integration weight. Defaults to 1.0.
labelstr | NoneNoneOptional display label such as "Γ". Defaults to None.
coordinate_systemstr'cartesian'Either "cartesian" or "reduced". Defaults to "cartesian".

Methods

def gamma() -> KPoint

Return the Γ point.

Returns

  • KPoint
def to_dict() -> dict

Return a JSON-safe representation.

Returns

  • dict
class KPointMesh
def __init__(points: Sequence[KPoint])

Weighted k-point mesh.

Parameters

NameTypeDefaultDescription
pointsSequence[KPoint]

Methods

def gamma() -> KPointMesh

Return a one-point Γ mesh.

Returns

  • KPointMesh
def to_dict() -> dict

Return a JSON-safe representation.

Returns

  • dict
class MonkhorstPackGrid(KPointMesh)
def __init__(size: Sequence[int])

Simple Γ-centered Monkhorst-Pack-style mesh.

Parameters

NameTypeDefaultDescription
sizeSequence[int]
class TimeReversalOwnership
def __init__(entries: tuple[TimeReversalOwnershipEntry, ...], active_bases_admitted: bool = False)

Deterministic owner/partner topology for an explicit k-point mesh.

Parameters

NameTypeDefaultDescription
entriestuple[TimeReversalOwnershipEntry, ...]One ownership entry per explicit mesh point, in original order.
active_bases_admittedboolFalseWhether exact active-basis permutations have been checked and attached.

Properties

  • fallback_reasons dict[int, str] — Return independent-lane fallback reasons keyed by explicit index.
  • owned_indices tuple[int, ...] — Return explicit indices whose compact states are retained.
  • partner_indices tuple[int, ...] — Return explicit indices published from owner time-reversal views.
  • representative_indices tuple[int, ...] — Return admitted time-reversal representative indices.

Methods

def entry_for(explicit_index: int) -> TimeReversalOwnershipEntry

Return ownership metadata for one explicit index.

Parameters

NameTypeDefaultDescription
explicit_indexintOriginal mesh index.

Returns

  • TimeReversalOwnershipEntry — Matching ownership entry.

Raises

  • IndexError — If the index is outside the explicit mesh.
def to_dict() -> dict[str, object]

Return JSON-safe topology metadata.

Returns

  • dict[str, object] — Admission state, counts, and ordered ownership entries.
class TimeReversalOwnershipEntry
def __init__(explicit_index: int, reduced_kpoint: tuple[float, float, float], original_weight: float, owner_index: int, partner_index: int | None, role: str, aggregated_weight: float, reciprocal_shift: tuple[int, int, int] | None, _time_reversal_permutation: np.ndarray | None = None, fallback_reason: str | None = None)

Ownership metadata for one explicit reduced-coordinate k-point.

The time-reversal permutation maps each active compact coefficient index at this explicit point to its signed-G index at partner_index. It is populated only after active-basis admission succeeds.

Parameters

NameTypeDefaultDescription
explicit_indexintOriginal index in the caller’s k-point mesh.
reduced_kpointtuple[float, float, float]Original reduced-coordinate point.
original_weightfloatOriginal normalized integration weight.
owner_indexintExplicit point whose compact eigenstate is retained.
partner_indexint | NoneTime-reversed explicit point, or None when absent.
rolestr"owner", "partner", or "independent".
aggregated_weightfloatIntegration weight consumed by the owner lane.
reciprocal_shifttuple[int, int, int] | NoneInteger vector satisfying k + k_partner = reciprocal_shift.
_time_reversal_permutationnp.ndarray | NoneNonePrivate source-to-partner compact-index permutation snapshot, or None when reuse is not admitted.
fallback_reasonstr | NoneNoneStable independent-lane reason, or None.

Properties

  • time_reversal_permutation np.ndarray | None — Return a caller-owned copy of the signed-G permutation.

Methods

def to_dict() -> dict[str, object]

Return a JSON-safe ownership record.

Returns

  • dict[str, object] — Explicit point, weight, owner, partner, role, permutation, and
  • dict[str, object] — fallback diagnostics.
def admit_time_reversal_bases(ownership: TimeReversalOwnership, bases: Sequence[Any]) -> TimeReversalOwnership

Admit exact signed-G permutations for active compact bases.

Parameters

NameTypeDefaultDescription
ownershipTimeReversalOwnershipGeometry/weight topology built before basis construction.
basesSequence[Any]One compact plane-wave basis per explicit point.

Returns

  • TimeReversalOwnership — Topology with read-only source-to-partner permutations. Only pairs whose
  • TimeReversalOwnership — active bases are exact one-to-one time reversals remain reused.

Raises

  • ValueError — If the basis count differs or admission was already run.
def build_time_reversal_ownership(kpoint_mesh: KPointMesh) -> TimeReversalOwnership

Build deterministic reduced-coordinate owner/partner topology.

Geometry is matched modulo integer reciprocal-lattice shifts. Missing or unequal-weight partners become independent lanes, while duplicate or multiply claimed maps fail closed. Active-basis permutations are admitted separately after bases exist.

Parameters

NameTypeDefaultDescription
kpoint_meshKPointMeshExplicit weighted reduced-coordinate mesh.

Returns

  • TimeReversalOwnership — Ordered topology without active-basis permutations.

Raises

  • ValueError — If input is non-finite, non-reduced, duplicated, or has an ambiguous/multiply-claimed time-reversal map.
def run_band_structure(system: DFTSystem, scf_result: SCFResult, band_path: BandPath, *, n_bands: int = 1, xc_functional: ExchangeCorrelationFunctional | None = None, apply_nonlocal: bool | None = None) -> BandStructureResult

Evaluate non-SCF bands on top of a converged density.

Parameters

NameTypeDefaultDescription
systemDFTSystemDFT system that supplied the SCF density.
scf_resultSCFResultConverged or diagnostic SCF result whose density is reused.
band_pathBandPathExplicit k-point path.
n_bandsint1Number of eigenvalues to report at each k-point. Defaults to 1.
xc_functionalExchangeCorrelationFunctional | NoneNoneExchange-correlation functional for the fixed-density operator; None uses LDA. Defaults to None.
apply_nonlocalbool | NoneNoneWhether to include ion-backed nonlocal pseudopotential projectors. None mirrors scf_result.nonlocal_applied. Defaults to None.

Returns

  • BandStructureResult — Non-SCF band energies and pseudopotential diagnostics.