Skip to content

dft.periodic_gth

Analytical periodic GTH operators for cutoff-projected plane waves.

import mlx_atomistic.dft.periodic_gth

class PeriodicGTHNonlocalOperator
def __init__(pseudopotential: PseudopotentialData | Sequence[PseudopotentialData], basis: PlaneWaveBasis, positions: Sequence[Sequence[float]], *, cache: _GTHProjectorCache | None = None, cache_budget_bytes: int = _GTHProjectorCache.DEFAULT_BUDGET_BYTES)

Complete compact separable GTH operator at one Bloch k-point.

Parameters

NameTypeDefaultDescription
pseudopotentialPseudopotentialData | Sequence[PseudopotentialData]
basisPlaneWaveBasis
positionsSequence[Sequence[float]]
cache_GTHProjectorCache | NoneNone
cache_budget_bytesint_GTHProjectorCache.DEFAULT_BUDGET_BYTES

Methods

def apply(coefficients: mx.array) -> mx.array

Apply the nonlocal operator to one orbital or an orbital stack.

Parameters

NameTypeDefaultDescription
coefficientsmx.arrayOne admitted coefficient grid or a stack.

Returns

  • mx.array — Nonlocal operator action with the same shape.
def cache_info() -> dict[str, int]

Return bounded projector-cache accounting.

Returns

  • dict[str, int] — Budget, retained/peak bytes, entries, evictions, and invalidations.
def close() -> None

Release an operator-owned projector cache context.

Returns

  • None
def energy(coefficients: mx.array, *, occupations: Sequence[float]) -> mx.array

Return occupied nonlocal energy in Hartree.

Parameters

NameTypeDefaultDescription
coefficientsmx.arrayOrbital stack in the admitted basis.
occupationsSequence[float]One occupation per orbital.

Returns

  • mx.array — Real occupied nonlocal energy.
def forces(coefficients: mx.array, *, occupations: Sequence[float]) -> mx.array

Return analytic nonlocal-GTH Hellmann—Feynman forces.

Parameters

NameTypeDefaultDescription
coefficientsmx.arrayOrbital stack in the admitted basis.
occupationsSequence[float]One occupation per orbital.

Returns

  • mx.array — Nonlocal forces with shape (n_ions, 3) in Hartree/bohr.
def to_dict() -> dict[str, object]

Return JSON-safe nonlocal operator metadata.

Returns

  • dict[str, object] — Channel, projector, angular, ion, and k-point metadata.
def gth_local_potential_grid(pseudopotential: PseudopotentialData | Sequence[PseudopotentialData], basis: PlaneWaveBasis, positions: Sequence[Sequence[float]]) -> mx.array

Return the real periodic local GTH potential on the FFT grid.

Parameters

NameTypeDefaultDescription
pseudopotentialPseudopotentialData | Sequence[PseudopotentialData]One shared or one-per-ion parsed GTH pseudopotential.
basisPlaneWaveBasisPlane-wave basis supplying the FFT grid.
positionsSequence[Sequence[float]]Ionic Cartesian positions in bohr.

Returns

  • mx.array — Real local potential with shape basis.grid.shape.
def gth_local_reciprocal_coefficients(pseudopotential: PseudopotentialData | Sequence[PseudopotentialData], basis: PlaneWaveBasis, positions: Sequence[Sequence[float]]) -> mx.array

Return periodic local GTH Fourier-series coefficients.

The formula follows Quantum ESPRESSO’s analytical GTH transform in Hartree units, including the finite G=0 limit and ionic structure factor.

Parameters

NameTypeDefaultDescription
pseudopotentialPseudopotentialData | Sequence[PseudopotentialData]One shared or one-per-ion parsed GTH pseudopotential.
basisPlaneWaveBasisPlane-wave basis supplying reciprocal vectors and volume.
positionsSequence[Sequence[float]]Ionic Cartesian positions in bohr.

Returns

  • mx.array — Complex local-potential coefficients with shape basis.grid.shape.
def periodic_ewald_energy(charges: Sequence[float], positions: Sequence[Sequence[float]], cell_lengths: Sequence[float], *, eta: float | None = None, tolerance: float = 1e-10) -> float

Return periodic point-charge Ewald energy with neutralizing background.

Parameters

NameTypeDefaultDescription
chargesSequence[float]Point charges in atomic units.
positionsSequence[Sequence[float]]Cartesian positions in bohr.
cell_lengthsSequence[float]Orthorhombic cell lengths in bohr.
etafloat | NoneNoneOptional Ewald splitting parameter in inverse bohr. Defaults to a cell-scaled value.
tolerancefloat1e-10Real/reciprocal truncation target. Defaults to 1e-10.

Returns

  • float — Ewald energy in Hartree.
def periodic_ewald_forces(charges: Sequence[float], positions: Sequence[Sequence[float]], cell_lengths: Sequence[float], *, displacement: float = 0.0001, eta: float | None = None, tolerance: float = 1e-10, method: str = 'analytic') -> np.ndarray

Return forces for the periodic Ewald ion-ion energy.

Parameters

NameTypeDefaultDescription
chargesSequence[float]Point charges in atomic units.
positionsSequence[Sequence[float]]Cartesian positions in bohr.
cell_lengthsSequence[float]Orthorhombic cell lengths in bohr.
displacementfloat0.0001Central-difference step used only when method="finite_difference". Defaults to 1e-4.
etafloat | NoneNoneOptional Ewald splitting parameter. Defaults to a cell-scaled value.
tolerancefloat1e-10Ewald truncation target. Defaults to 1e-10.
methodstr'analytic'"analytic" or the validation-only "finite_difference". Defaults to "analytic".

Returns

  • np.ndarray — Force array with shape (n_ions, 3) in Hartree/bohr.
def periodic_gth_local_forces(density: mx.array, pseudopotential: PseudopotentialData | Sequence[PseudopotentialData], basis: PlaneWaveBasis, positions: Sequence[Sequence[float]]) -> mx.array

Return analytic local-GTH Hellmann—Feynman forces.

The derivative is evaluated in reciprocal space from the converged electron density and the phase derivative of each ionic local potential.

Parameters

NameTypeDefaultDescription
densitymx.arrayPositive electron density on basis.grid.
pseudopotentialPseudopotentialData | Sequence[PseudopotentialData]One shared or one-per-ion parsed GTH pseudopotential.
basisPlaneWaveBasisPlane-wave basis supplying the FFT grid and reciprocal vectors.
positionsSequence[Sequence[float]]Ionic Cartesian positions in bohr.

Returns

  • mx.array — Local electron-ion forces with shape (n_ions, 3) in Hartree/bohr.