dft.grids
Real- and reciprocal-space grids for toy plane-wave DFT.
import mlx_atomistic.dft.grids
Classes
Section titled “Classes”RealSpaceGrid
Section titled “RealSpaceGrid”class RealSpaceGrid def __init__(shape: Sequence[int], cell: Cell | Sequence[float] | Sequence[Sequence[float]])Uniform fractional real-space grid in a periodic cell.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
shape | Sequence[int] | ||
cell | Cell | Sequence[float] | Sequence[Sequence[float]] |
Properties
dvfloat— Volume represented by one grid point.lengthsmx.array— Cell lengths in atomic units.ndimint— Number of grid dimensions.sizeint— Total number of grid points.spacingmx.array— Grid-vector step lengths in atomic units.volumefloat— Cell volume in bohr cubed.
Methods
coordinates
Section titled “coordinates”def coordinates() -> mx.arrayReturn cell-centered Cartesian grid coordinates with shape (*shape, 3).
Returns
mx.array
ReciprocalGrid
Section titled “ReciprocalGrid”class ReciprocalGrid def __init__(real_grid: RealSpaceGrid, vectors: mx.array, g2: mx.array, zero_mask: mx.array, integer_g: mx.array | None = None, basis_matrix: mx.array | None = None, fingerprint: str | None = None)Reciprocal-space vectors matching a RealSpaceGrid FFT layout.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
real_grid | RealSpaceGrid | ||
vectors | mx.array | ||
g2 | mx.array | ||
zero_mask | mx.array | ||
integer_g | mx.array | None | None | |
basis_matrix | mx.array | None | None | |
fingerprint | str | None | None |
Methods
from_real_space
Section titled “from_real_space”def from_real_space(grid: RealSpaceGrid) -> ReciprocalGridBuild reciprocal vectors in exact NumPy FFT frequency order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
grid | RealSpaceGrid | Real-space grid whose FFT ordering and cell define the reciprocal descriptor. |
Returns
ReciprocalGrid— Reciprocal metadata with exact integerGcoordinates and aReciprocalGrid— deterministic grid fingerprint.