PAOFLOW.elphon.plane_waves#

Plane-wave blocks of a QE nscf run and their transforms to and from the FFT grid.

The coarse electron-phonon vertex of PAOFLOW.elphon.dfpt_vertex works with the raw plane-wave coefficients of wfc<ik>.dat (no Loewdin step, unlike the projection reader PAOFLOW.projection.do_atwfc_proj.read_QE_wfc()), the periodic parts of the Bloch functions on the smooth FFT grid and the gather of a real-space product back onto the k + q + G sphere.

Conventions (QE): psi_nk(r) = Omega^-1/2 sum_G c_n(G) exp(i (k+G).r) with sum_G |c_n(G)|^2 = 1; the periodic part on the grid is u_n(r) = sum_G c_n(G) exp(i G.r) (inverse FFT without scaling); the forward transform carries the 1/N factor. Grid index [i, j, k] is the point i/nr1 a1 + j/nr2 a2 + k/nr3 a3.

Classes#

PlaneWaveBlock

Plane-wave coefficients of all bands at one k-point.

Functions#

read_plane_wave_block(save_dir, ik, alat[, nspin, ...])

Read wfc<ik+1>.dat (or the HDF5 variant) of a QE save directory.

k_plus_g_cart(block, bg)

k + G vectors of a block (Cartesian, 2 pi / alat), shape (npw, 3).

box_indices(miller, fft_grid)

FFT-box indices (i1, i2, i3) of Miller indices (negative frequencies wrap).

periodic_part_on_grid(coefficients, miller, fft_grid)

Periodic parts u_n(r) = sum_G c_n(G) exp(i G.r) on the FFT grid.

project_on_plane_waves(fields, miller, fft_grid[, umklapp])

Fourier components of periodic fields on a k + q + G sphere.

interpolate_to_grid(field, fft_out[, gcut])

Fourier-interpolate a periodic field from one FFT grid to another (QE fft_interpolate).

g_sphere(fft_grid, bg, gcut_tpiba2)

Reciprocal vectors of the FFT box inside |G|^2 <= gcut (QE ggen).

Module Contents#

class PAOFLOW.elphon.plane_waves.PlaneWaveBlock[source]#

Plane-wave coefficients of all bands at one k-point.

Variables:
  • xk_cart (ndarray, shape (3,)) – k-point (Cartesian, 2 pi / alat).

  • miller (ndarray, shape (3, npw), int) – Miller indices of the k + G sphere (QE igk order).

  • coefficients (ndarray, shape (nbnd, npol * npw), complex) – Raw coefficients c_n(G) (spinor components concatenated for npol = 2).

  • npol (int) – Spinor components.

xk_cart: numpy.typing.NDArray[numpy.float64][source]#
miller: numpy.typing.NDArray[numpy.int_][source]#
coefficients: numpy.typing.NDArray[numpy.complex128][source]#
npol: int[source]#
property npw: int[source]#

Number of plane waves.

property nbnd: int[source]#

Number of bands.

PAOFLOW.elphon.plane_waves.read_plane_wave_block(save_dir, ik, alat, nspin=1, ispin=0, bands=None)[source]#

Read wfc<ik+1>.dat (or the HDF5 variant) of a QE save directory.

Parameters:
  • save_dir (str) – QE outdir/prefix.save directory.

  • ik (int) – Zero-based k-point index in the nscf order.

  • alat (float) – Lattice parameter (bohr): the file stores k in bohr^-1, the block in 2 pi / alat.

  • nspin (int, optional) – 1 (or 4 for noncollinear) reads wfc<ik>; 2 reads wfcup/wfcdw.

  • ispin (int, optional) – Spin channel for nspin = 2 (0 = down, 1 = up, as the projection reader).

  • bands (slice, optional) – Subset of bands to keep.

Return type:

PlaneWaveBlock

PAOFLOW.elphon.plane_waves.k_plus_g_cart(block, bg)[source]#

k + G vectors of a block (Cartesian, 2 pi / alat), shape (npw, 3).

Parameters:
  • block (PlaneWaveBlock)

  • bg (ndarray, shape (3, 3)) – Reciprocal lattice vectors (rows, 2 pi / alat).

PAOFLOW.elphon.plane_waves.box_indices(miller, fft_grid)[source]#

FFT-box indices (i1, i2, i3) of Miller indices (negative frequencies wrap).

PAOFLOW.elphon.plane_waves.periodic_part_on_grid(coefficients, miller, fft_grid)[source]#

Periodic parts u_n(r) = sum_G c_n(G) exp(i G.r) on the FFT grid.

Parameters:
  • coefficients (ndarray, shape (nb, npw), complex) – Plane-wave coefficients (one spinor component).

  • miller (ndarray, shape (3, npw), int) – Their Miller indices.

  • fft_grid (tuple of int) – (nr1, nr2, nr3).

Return type:

ndarray, shape (nb, nr1, nr2, nr3), complex

PAOFLOW.elphon.plane_waves.project_on_plane_waves(fields, miller, fft_grid, umklapp=(0, 0, 0))[source]#

Fourier components of periodic fields on a k + q + G sphere.

Parameters:
  • fields (ndarray, shape (..., nr1, nr2, nr3), complex) – Periodic functions on the grid (for instance dv(r) u_n(r)).

  • miller (ndarray, shape (3, npw), int) – Miller indices of the stored block at k' = k + q - G0.

  • fft_grid (tuple of int) – (nr1, nr2, nr3).

  • umklapp (array_like, shape (3,), int, optional) – G0: the component at G' = G'' - G0 is returned for every stored G''.

Returns:

(1/N) sum_r f(r) exp(-i (G'' - G0).r).

Return type:

ndarray, shape (..., npw), complex

PAOFLOW.elphon.plane_waves.interpolate_to_grid(field, fft_out, gcut=None)[source]#

Fourier-interpolate a periodic field from one FFT grid to another (QE fft_interpolate).

Parameters:
  • field (ndarray, shape (..., nr1, nr2, nr3), complex)

  • fft_out (tuple of int) – Target grid.

  • gcut (ndarray of bool, optional) – Mask over the target box selecting the G vectors to keep (None: every component representable on both grids).

Return type:

ndarray, shape (..., \*fft_out), complex

PAOFLOW.elphon.plane_waves.g_sphere(fft_grid, bg, gcut_tpiba2)[source]#

Reciprocal vectors of the FFT box inside |G|^2 <= gcut (QE ggen).

Parameters:
  • fft_grid (tuple of int)

  • bg (ndarray, shape (3, 3)) – Reciprocal lattice vectors (rows, 2 pi / alat).

  • gcut_tpiba2 (float) – Cutoff ecut / tpiba^2 in (2 pi / alat)^2 units.

Returns:

  • miller (ndarray, shape (3, ng), int)

  • g_cart (ndarray, shape (ng, 3)) – Cartesian G (2 pi / alat).