PAOFLOW.utils.zero_pad#

Functions#

zero_pad(aux, nk1, nk2, nk3, nfft1, nfft2, nfft3)

Zero-pad a 3-D frequency-domain array while preserving Hermitian symmetry.

zero_pad_float(aux, nk1, nk2, nk3, nfft1, nfft2, nfft3)

Zero-pad a 3-D real-valued frequency-domain array (deprecated).

Module Contents#

PAOFLOW.utils.zero_pad.zero_pad(aux, nk1, nk2, nk3, nfft1, nfft2, nfft3)[source]#

Zero-pad a 3-D frequency-domain array while preserving Hermitian symmetry.

Parameters:
  • aux (np.ndarray, shape (nk1, nk2, nk3), complex) – Input frequency-domain data (e.g. a real-space Hamiltonian slice after an inverse FFT).

  • nk1 (int) – Current size of aux along axis 0.

  • nk2 (int) – Current size of aux along axis 1.

  • nk3 (int) – Current size of aux along axis 2.

  • nfft1 (int) – Number of zeros to insert along axis 0 (nfft1 = nk1p - nk1).

  • nfft2 (int) – Number of zeros to insert along axis 1.

  • nfft3 (int) – Number of zeros to insert along axis 2.

Returns:

Zero-padded frequency-domain array. A forward FFT of this array yields an interpolated real-space representation on a finer grid.

Return type:

np.ndarray, shape (nk1+nfft1, nk2+nfft2, nk3+nfft3), complex

Notes

Zeros are inserted at the centre of the spectrum (around the Nyquist frequency) rather than at the end, so that the relationship \(A(-k) = A^*(k)\) required for real-valued data is preserved. For an even-sized dimension of length \(N\), the Nyquist component at index \(N/2\) is halved and its copy placed at both \(sk\) and \(-sk\) to prevent double-counting.

This is used by do_double_grid() to perform Fourier interpolation of the PAO Hamiltonian onto a denser k-grid without introducing Gibbs artefacts.

PAOFLOW.utils.zero_pad.zero_pad_float(aux, nk1, nk2, nk3, nfft1, nfft2, nfft3)[source]#

Zero-pad a 3-D real-valued frequency-domain array (deprecated).

Deprecated since version Use: zero_pad() instead. This function uses a legacy padding algorithm that does not preserve Hermitian symmetry for even-sized grids and inserts zeros at incorrect positions for odd-sized grids. It also accepts only real-valued input.

Parameters:
  • aux (np.ndarray, shape (nk1, nk2, nk3), float) – Input frequency-domain data.

  • nk1 (int) – Current size of aux along axis 0.

  • nk2 (int) – Current size of aux along axis 1.

  • nk3 (int) – Current size of aux along axis 2.

  • nfft1 (int) – Number of zeros to pad along axis 0.

  • nfft2 (int) – Number of zeros to pad along axis 1.

  • nfft3 (int) – Number of zeros to pad along axis 2.

Returns:

Zero-padded array.

Return type:

np.ndarray, shape (nk1+nfft1, nk2+nfft2, nk3+nfft3), float