dft.periodic_electrostatics
Periodic point-charge electrostatics for full-rank cells.
import mlx_atomistic.dft.periodic_electrostatics
Functions
Section titled “Functions”periodic_ewald_energy
Section titled “periodic_ewald_energy”def periodic_ewald_energy(charges: Sequence[float], positions: Sequence[Sequence[float]], cell_lengths: Cell | Sequence[float] | Sequence[Sequence[float]], *, eta: float | None = None, tolerance: float = 1e-10) -> floatReturn periodic point-charge Ewald energy with neutralizing background.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
charges | Sequence[float] | Point charges in atomic units. | |
positions | Sequence[Sequence[float]] | Cartesian positions in bohr. | |
cell_lengths | Cell | Sequence[float] | Sequence[Sequence[float]] | A periodic Cell, three orthorhombic lengths, or a full row-vector cell matrix in bohr. | |
eta | float | None | None | Optional Ewald splitting parameter in inverse bohr. Defaults to a cell-scaled value. |
tolerance | float | 1e-10 | Real/reciprocal truncation target. Defaults to 1e-10. |
Returns
float— Ewald energy in Hartree.
periodic_ewald_forces
Section titled “periodic_ewald_forces”def periodic_ewald_forces(charges: Sequence[float], positions: Sequence[Sequence[float]], cell_lengths: Cell | Sequence[float] | Sequence[Sequence[float]], *, displacement: float = 0.0001, eta: float | None = None, tolerance: float = 1e-10, method: str = 'analytic') -> np.ndarrayReturn forces for the periodic Ewald ion-ion energy.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
charges | Sequence[float] | Point charges in atomic units. | |
positions | Sequence[Sequence[float]] | Cartesian positions in bohr. | |
cell_lengths | Cell | Sequence[float] | Sequence[Sequence[float]] | A periodic Cell, three orthorhombic lengths, or a full row-vector cell matrix in bohr. | |
displacement | float | 0.0001 | Central-difference step used only when method="finite_difference". Defaults to 1e-4. |
eta | float | None | None | Optional Ewald splitting parameter. Defaults to a cell-scaled value. |
tolerance | float | 1e-10 | Ewald truncation target. Defaults to 1e-10. |
method | str | 'analytic' | "analytic" or the validation-only "finite_difference". Defaults to "analytic". |
Returns
np.ndarray— Force array with shape(n_ions, 3)in Hartree/bohr.
periodic_ewald_stress
Section titled “periodic_ewald_stress”def periodic_ewald_stress(charges: Sequence[float], positions: Sequence[Sequence[float]], cell_lengths: Cell | Sequence[float] | Sequence[Sequence[float]], *, eta: float | None = None, tolerance: float = 1e-10) -> np.ndarrayReturn compression-positive periodic Ewald stress.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
charges | Sequence[float] | Point charges in atomic units. | |
positions | Sequence[Sequence[float]] | Cartesian positions in bohr. | |
cell_lengths | Cell | Sequence[float] | Sequence[Sequence[float]] | Periodic cell in bohr. | |
eta | float | None | None | Optional Ewald splitting parameter in inverse bohr. |
tolerance | float | 1e-10 | Real/reciprocal truncation target. |
Returns
np.ndarray— Symmetric stress tensor in Hartree/bohr cubed.