API Reference
High-level drivers
Engines
Core data model
- class poraque.core.grid.Grid(shape, cell, pbc=True)[source]
Real-space grid and its dual plane-wave (reciprocal) basis.
Poraquê represents fields (densities, potentials, Kohn-Sham orbitals) on a uniform real-space grid that fills the periodic unit cell. The grid is the primal representation; its discrete Fourier transform spans a plane-wave basis
\[\psi(\mathbf{r}) = \sum_{\mathbf{G}} c_{\mathbf{G}}\, e^{i \mathbf{G}\cdot\mathbf{r}},\]where the wavevectors \(\mathbf{G}\) are the reciprocal-lattice points sampled by the FFT (see
get_g_vectors()). This duality is what lets the kinetic operator be applied exactly (and diagonally) in reciprocal space while local potentials are applied diagonally in real space. The completeness of the basis is controlled by the grid density, i.e. by the plane-wave kinetic-energy cutoff (seefrom_ecut()).- classmethod from_ecut(cell, ecut, pbc=True, density_factor=2.0)[source]
Build a grid dense enough for a given plane-wave kinetic cutoff.
The wavefunction plane-wave cutoff
ecut(Hartree) corresponds to a maximum wavevectorg_max = sqrt(2 * ecut). The electron density, being the square of the orbitals, contains components up todensity_factor * g_max(2for an exact product), so the grid spacing must satisfy the Nyquist conditionh <= pi / (density_factor * g_max)along each lattice vector.- Parameters:
cell (array_like) –
3x3lattice vectors (Bohr).ecut (float) – Plane-wave kinetic-energy cutoff for the wavefunctions (Hartree).
pbc (bool or tuple of bool, optional) – Periodic boundary conditions.
density_factor (float, optional) – Ratio between the density and wavefunction cutoffs (default
2.0).
- Returns:
A grid whose shape resolves the requested cutoff. The attribute
ecutrecords the cutoff used.- Return type:
- kinetic_g2(kpoint_cartesian=None)[source]
Squared shifted reciprocal vectors \(|\mathbf{G} + \mathbf{k}|^2\).
- Parameters:
kpoint_cartesian (array_like, optional) – Bloch wavevector in Cartesian reciprocal coordinates (1/Bohr). Defaults to the \(\Gamma\) point, recovering
get_g2().- Returns:
Array of shape
shapeused to build the kinetic operatorT = 1/2 |G + k|^2in reciprocal space.- Return type:
numpy.ndarray
- kpoint_to_cartesian(kpoint_fractional)[source]
Convert a fractional k-point to Cartesian reciprocal coordinates.
- Parameters:
kpoint_fractional (array_like) –
(3,)k-point in fractional reciprocal coordinates (the convention used byase.dft.kpoints.monkhorst_pack()).- Returns:
(3,)Cartesian wavevector (1/Bohr).- Return type:
numpy.ndarray
- get_g_vectors()[source]
Build the reciprocal-space grid vectors (Gx, Gy, Gz).
These are the angular wavevectors
G = 2*pi*ksampled by the FFT for the current grid spacing, returned as three arrays each shaped like the grid.- Returns:
(Gx, Gy, Gz)arrays of shapeself.shape.- Return type:
tuple of numpy.ndarray
- class poraque.core.system.System(positions, atomic_numbers, cell, pbc=True, electrons=None, spin_polarized=False)[source]
Represents the physical system (ions, electrons, cell).
- classmethod from_ase(atoms, charge=0)[source]
Create a System object from an ASE
Atomsobject.Positions and cell are converted from Ångström (ASE convention) to Bohr (internal atomic units).
- Parameters:
atoms (ase.Atoms) – The atomic structure.
charge (int, optional) – Net charge; the electron count is
sum(Z) - charge.
- to_ase()[source]
Export this system to an ASE
Atomsobject.Positions and cell are converted from Bohr (internal) back to Ångström (ASE convention). The inverse of
from_ase()for neutral systems.- Returns:
The atomic structure in ASE units.
- Return type:
ase.Atoms
- class poraque.core.density.Density(grid, data=None)[source]
Represents the electron density on the grid.
- class poraque.core.state.State(grid, orbitals, occupations=None)[source]
Represents the electronic state (orbitals, occupations). Mainly used for KS-DFT.