Skip to content

dft.periodic_scf

Self-consistent weighted k-point plane-wave DFT.

import mlx_atomistic.dft.periodic_scf

class PeriodicBandPointResult
def __init__(requested_kpoint: KPoint, basis: PlaneWaveBasis, eigen: PeriodicEigenResult)

One fixed-density periodic eigensolve along a band path.

Parameters

NameTypeDefaultDescription
requested_kpointKPointReduced-coordinate path point requested by the caller.
basisPlaneWaveBasisPoint-specific cutoff-projected plane-wave basis.
eigenPeriodicEigenResultLowest periodic eigenpairs returned by Davidson.

Methods

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

Return a JSON-safe point summary.

Returns

  • dict[str, object]
class PeriodicBandStructureResult
def __init__(kpoints: tuple[KPoint, ...], eigenvalues: mx.array, residuals: mx.array, points: tuple[PeriodicBandPointResult, ...], occupied_band_count: int, cutoff_hartree: float, density_source: str, timings: dict[str, float], guard_band_count: int = 0)

Production non-self-consistent bands from one frozen periodic density.

Parameters

NameTypeDefaultDescription
kpointstuple[KPoint, ...]Evaluated reduced-coordinate path points.
eigenvaluesmx.arrayEigenvalues in Hartree with shape (n_kpoints, n_bands).
residualsmx.arrayDirect eigensolver residuals with the same shape.
pointstuple[PeriodicBandPointResult, ...]Basis and compact eigenspace retained for each path point.
occupied_band_countintNumber of doubly occupied bands in the source SCF.
cutoff_hartreefloatPlane-wave kinetic cutoff in Hartree.
density_sourcestr"scf_result" or "frozen_density".
timingsdict[str, float]Wall-clock phase timings in milliseconds.
guard_band_countint0Additional unpublished states used to stabilize the requested eigenspace boundary.

Properties

  • n_bands int — Return the number of bands solved at every k-point.

Methods

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

Return JSON-safe bands without materializing orbital coefficients.

Returns

  • dict[str, object]
class PeriodicDFTSystem
def __init__(cell_lengths: Sequence[float], grid_shape: Sequence[int], positions: Sequence[Sequence[float]], pseudopotential: PseudopotentialData | None = None, electron_count: float | None = None, *, pseudopotentials: Sequence[PseudopotentialData] | None = None)

Orthorhombic periodic DFT system with per-ion GTH pseudopotentials.

Parameters

NameTypeDefaultDescription
cell_lengthsSequence[float]Orthorhombic cell lengths in bohr.
grid_shapeSequence[int]FFT grid shape.
positionsSequence[Sequence[float]]Ionic Cartesian positions in bohr.
pseudopotentialPseudopotentialData | NoneNoneShared GTH pseudopotential for every ion. Mutually exclusive with pseudopotentials.
electron_countfloat | NoneNoneTotal valence electron count. Defaults to the neutral pseudopotential charge sum.
pseudopotentialsSequence[PseudopotentialData] | NoneNoneOrdered one-per-ion GTH pseudopotentials.

Properties

  • charges tuple[float, ...] — Valence point charges used by the periodic Ewald term.
  • fingerprint str — Stable identity of the periodic cell and per-ion Hamiltonian.
  • ion_count int — Number of ions in the periodic cell.
  • is_homogeneous bool — Whether every ion uses an identical pseudopotential.
  • pseudopotential PseudopotentialData — Return the shared pseudopotential of a homogeneous system.
  • symbols tuple[str, ...] — Element symbol assigned to every ion in position order.
class PeriodicDavidsonConfig
def __init__(max_iterations: int = 30, tolerance: float = 1e-05, max_subspace_size: int = 64, preconditioner_floor: float = 0.25)

Controls for the incremental block Davidson/Rayleigh-Ritz eigensolver.

Parameters

NameTypeDefaultDescription
max_iterationsint30
tolerancefloat1e-05
max_subspace_sizeint64
preconditioner_floorfloat0.25
class PeriodicEigenResult
def __init__(eigenvalues: mx.array, coefficients: mx.array, residuals: mx.array, orthonormality_error: float, iterations: int, converged: bool, subspace_size: int, restart_count: int, *, basis: PlaneWaveBasis | None = None)

Lowest eigenspace result with compact runtime-owned coefficients.

Public construction accepts full-grid coefficients only with an explicit basis. Runtime code uses the private compact factory, so no dense fallback is retained.

Parameters

NameTypeDefaultDescription
eigenvaluesmx.arrayLowest eigenvalues in Hartree.
coefficientsmx.arrayPublic full-grid coefficient stack.
residualsmx.arrayDirect H(X) - epsilon X norm per returned eigenpair.
orthonormality_errorfloatMaximum overlap error.
iterationsintDavidson iteration count.
convergedboolWhether the requested tolerance was reached.
subspace_sizeintFinal Davidson subspace width.
restart_countintNumber of Davidson restarts.
basisPlaneWaveBasis | NoneNoneOptional basis used to pack the public full-grid coefficient input. When omitted, the legacy eight-argument constructor stores only the input’s exact nonzero support for round-trip compatibility.

Properties

  • coefficients mx.array — Materialize a fresh full-grid coefficient stack.
  • is_time_reversal_view bool — Whether coefficients are an uncached time-reversed owner view.

Methods

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

Return a JSON-safe eigensolver summary.

Returns

  • dict[str, object] — Eigenvalues, residuals, convergence, and subspace diagnostics.
class PeriodicFrozenDensity
def __init__(density: mx.array, cutoff_hartree: float, electron_count: float, system_fingerprint: str | None = None)

Portable fixed-density input for a periodic non-SCF calculation.

Parameters

NameTypeDefaultDescription
densitymx.arrayConverged electron density on system.grid.
cutoff_hartreefloatPlane-wave kinetic cutoff used by the source SCF.
electron_countfloatElectron count represented by the density.
system_fingerprintstr | NoneNoneOptional source-system identity. Required when the density is reused for a multi-element calculation.
class PeriodicKPointResult
def __init__(reduced_kpoint: tuple[float, float, float], weight: float, basis: PlaneWaveBasis, eigen: PeriodicEigenResult, explicit_index: int | None = None, aggregated_weight: float | None = None, ownership_role: str = 'independent', fallback_reason: str | None = None)

One weighted k-point result in a periodic SCF calculation.

Parameters

NameTypeDefaultDescription
reduced_kpointtuple[float, float, float]
weightfloat
basisPlaneWaveBasis
eigenPeriodicEigenResult
explicit_indexint | NoneNone
aggregated_weightfloat | NoneNone
ownership_rolestr'independent'
fallback_reasonstr | NoneNone

Properties

  • integration_weight float — Return the owner-aggregated or original integration weight.

Methods

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

Return a JSON-safe k-point summary.

Returns

  • dict[str, object] — Reduced k-point, weight, basis metadata, and eigensolver summary.
class PeriodicKohnShamOperator
def __init__(basis: PlaneWaveBasis, effective_local_potential: mx.array, nonlocal_operator: PeriodicGTHNonlocalOperator | None = None, observer: RuntimeObserver | None = None)

Fixed-density periodic Kohn-Sham operator in coefficient space.

Parameters

NameTypeDefaultDescription
basisPlaneWaveBasis
effective_local_potentialmx.array
nonlocal_operatorPeriodicGTHNonlocalOperator | NoneNone
observerRuntimeObserver | NoneNone

Properties

  • effective_local_potential mx.array — Return a fresh caller-owned copy of the fixed local potential.

Methods

def apply(coefficients: mx.array, *, observer: RuntimeObserver | None = None) -> mx.array

Apply kinetic, local, and optional nonlocal terms.

Parameters

NameTypeDefaultDescription
coefficientsmx.arrayOne coefficient grid or an orbital stack.
observerRuntimeObserver | NoneNoneOptional observer overriding an absent operator observer.

Returns

  • mx.array — Hamiltonian action with matching shape.
def rayleigh_quotients(coefficients: mx.array, *, observer: RuntimeObserver | None = None) -> mx.array

Return one Rayleigh quotient per orbital.

Parameters

NameTypeDefaultDescription
coefficientsmx.arrayOrbital stack in coefficient space.
observerRuntimeObserver | NoneNoneOptional runtime observer.

Returns

  • mx.array — Real energy estimates in Hartree.
class PeriodicSCFConfig
def __init__(max_iterations: int = 40, density_tolerance: float = 1e-05, energy_tolerance: float = 1e-06, orbital_tolerance: float = 1e-05, min_iterations: int = 2, mixing_beta: float = 0.35, mixer: str = 'diis', davidson: PeriodicDavidsonConfig = PeriodicDavidsonConfig(), kpoint_batch_size: int = 8, max_batch_padding_fraction: float = _CompactBatch._DEFAULT_MAX_PADDING_FRACTION, max_batch_transient_bytes: int = _CompactBatch._DEFAULT_MAX_TRANSIENT_BYTES, hpsi_shape_policy: str = 'finite-buckets', adaptive_eigensolver_tolerance: bool = False, initial_eigensolver_tolerance: float = 0.01, eigensolver_tolerance_scale: float = 0.1)

Controls for weighted k-point self-consistent field iteration.

Parameters

NameTypeDefaultDescription
max_iterationsint40
density_tolerancefloat1e-05
energy_tolerancefloat1e-06
orbital_tolerancefloat1e-05
min_iterationsint2
mixing_betafloat0.35
mixerstr'diis'
davidsonPeriodicDavidsonConfigPeriodicDavidsonConfig()
kpoint_batch_sizeint8
max_batch_padding_fractionfloat_CompactBatch._DEFAULT_MAX_PADDING_FRACTION
max_batch_transient_bytesint_CompactBatch._DEFAULT_MAX_TRANSIENT_BYTES
hpsi_shape_policystr'finite-buckets'
adaptive_eigensolver_toleranceboolFalse
initial_eigensolver_tolerancefloat0.01
eigensolver_tolerance_scalefloat0.1

Methods

def batch_policy() -> dict[str, int | float | str | list[int]]

Return the exact bounded compact-batch policy.

Returns

  • dict[str, int | float | str | list[int]]
class PeriodicSCFResult
def __init__(converged: bool, status: str, iterations: int, total_energy: float, electron_count: float, density_residual: float, energy_delta: float | None, density: mx.array, kpoints: tuple[PeriodicKPointResult, ...], energy_by_term: dict[str, float], history: tuple[dict[str, float | int | str | None], ...], timings: dict[str, float], time_reversal_ownership: TimeReversalOwnership | None = None, batch_policy: dict[str, int | float | str | list[int]] = dict(), numerical_status: str = 'not_evaluated', resume_integrity_status: str = 'fresh', timing_admission_status: str = 'fresh', lineage: tuple[str, ...] = (), system_fingerprint: str | None = None, _owned_kpoints: tuple[PeriodicKPointResult, ...] | None = None, _checkpoint_state: _PeriodicSCFContinuationState | None = None, _artifact_execution_contract_fingerprint: str | None = None, _artifact_calculation_fingerprint: str | None = None)

Result bundle for a weighted periodic plane-wave SCF calculation.

Parameters

NameTypeDefaultDescription
convergedbool
statusstr
iterationsint
total_energyfloat
electron_countfloat
density_residualfloat
energy_deltafloat | None
densitymx.array
kpointstuple[PeriodicKPointResult, ...]
energy_by_termdict[str, float]
historytuple[dict[str, float | int | str | None], ...]
timingsdict[str, float]
time_reversal_ownershipTimeReversalOwnership | NoneNone
batch_policydict[str, int | float | str | list[int]]dict()
numerical_statusstr'not_evaluated'
resume_integrity_statusstr'fresh'
timing_admission_statusstr'fresh'
lineagetuple[str, ...]()
system_fingerprintstr | NoneNone
_owned_kpointstuple[PeriodicKPointResult, ...] | NoneNone
_checkpoint_state_PeriodicSCFContinuationState | NoneNone
_artifact_execution_contract_fingerprintstr | NoneNone
_artifact_calculation_fingerprintstr | NoneNone

Properties

  • continuation_coefficients tuple[object, ...] — Return an explicit owner-aware initial-coefficient sequence.
  • owned_kpoints tuple[PeriodicKPointResult, ...] — Return the compact-state-owning k-point results.

Methods

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

Return a JSON-safe periodic SCF summary.

Returns

  • dict[str, object] — Convergence, energy, k-point, history, and timing diagnostics without
  • dict[str, object] — dense orbital or density payloads.
def run_periodic_band_structure(system: PeriodicDFTSystem, source: PeriodicSCFResult | PeriodicFrozenDensity, band_path: BandPath, *, n_bands: int | None = None, guard_bands: int = 0, config: PeriodicDavidsonConfig | None = None, xc_functional: ExchangeCorrelationFunctional | None = None, observer: RuntimeObserver | None = None) -> PeriodicBandStructureResult

Solve production periodic bands on top of a converged frozen density.

This is a non-self-consistent calculation: the ionic, Hartree, and exchange-correlation potentials are built once from source and reused unchanged at every path point. Each k-point still receives its own cutoff-projected plane-wave basis and complete local plus nonlocal GTH Hamiltonian.

Parameters

NameTypeDefaultDescription
systemPeriodicDFTSystemPeriodic GTH system matching the source SCF calculation.
sourcePeriodicSCFResult | PeriodicFrozenDensityConverged periodic SCF result or validated portable density.
band_pathBandPathExplicit reduced-coordinate k-point path.
n_bandsint | NoneNoneLowest bands to return. Defaults to occupied bands plus eight.
guard_bandsint0Extra unpublished states used to contain degeneracies at the requested eigenspace boundary. Defaults to zero.
configPeriodicDavidsonConfig | NoneNoneDavidson controls. Defaults to PeriodicDavidsonConfig.
xc_functionalExchangeCorrelationFunctional | NoneNoneExchange-correlation functional. Defaults to production PBE, matching run_periodic_scf.
observerRuntimeObserver | NoneNoneOptional progress and work observer.

Returns

  • PeriodicBandStructureResult — Fixed-density band energies, residuals, bases, and compact eigenstates.

Raises

  • RuntimeError — If a path-point Davidson solve does not converge.
  • TypeError — If source has an unsupported type.
  • ValueError — If source, path, density, or band metadata are inconsistent.
def run_periodic_scf(system: PeriodicDFTSystem, *, cutoff_hartree: float, kpoint_mesh: KPointMesh, n_bands: int | None = None, config: PeriodicSCFConfig | None = None, xc_functional: ExchangeCorrelationFunctional | None = None, initial_density: mx.array | None = None, initial_coefficients: Sequence[mx.array] | None = None, observer: RuntimeObserver | None = None) -> PeriodicSCFResult

Run weighted self-consistent periodic plane-wave DFT.

Parameters

NameTypeDefaultDescription
systemPeriodicDFTSystemPeriodic GTH system.
cutoff_hartreefloatKinetic cutoff in Hartree.
kpoint_meshKPointMeshWeighted reduced-coordinate k-point mesh.
n_bandsint | NoneNoneNumber of occupied bands. Defaults to half the electron count.
configPeriodicSCFConfig | NoneNoneSCF controls. Defaults to PeriodicSCFConfig.
xc_functionalExchangeCorrelationFunctional | NoneNoneExchange-correlation functional. Defaults to production PBE.
initial_densitymx.array | NoneNoneOptional starting density on the FFT grid.
initial_coefficientsSequence[mx.array] | NoneNoneOptional orbital stack per k-point.
observerRuntimeObserver | NoneNoneOptional progress, synchronized timing, and work observer.

Returns

  • PeriodicSCFResult — Periodic SCF result with complete weighted k-point diagnostics.
def solve_periodic_eigenproblem(operator: PeriodicKohnShamOperator, *, n_bands: int, config: PeriodicDavidsonConfig | None = None, initial_coefficients: mx.array | None = None, observer: RuntimeObserver | None = None) -> PeriodicEigenResult

Solve the lowest periodic eigenpairs with block Davidson/Rayleigh-Ritz.

Parameters

NameTypeDefaultDescription
operatorPeriodicKohnShamOperatorFixed-density periodic Kohn-Sham operator.
n_bandsintNumber of lowest states to return.
configPeriodicDavidsonConfig | NoneNoneDavidson controls. Defaults to PeriodicDavidsonConfig.
initial_coefficientsmx.array | NoneNoneOptional initial orbital stack. Defaults to the lowest kinetic plane waves.
observerRuntimeObserver | NoneNoneOptional progress and work observer. Defaults to the observer carried by operator.

Returns

  • PeriodicEigenResult — Converged or exhausted result sealed by direct final residuals.