PAOFLOW.elphon.dfpt_vertex#

Coarse electron-phonon vertex from ph.x DFPT outputs (the native replacement of EPW’s epbwrite).

For every q of the coarse grid the Cartesian matrix elements

\[g_{mn,\kappa\alpha}(k, q) = \langle \psi_{m,k+q} | \partial V / \partial u_{\kappa\alpha}(q) | \psi_{n,k} \rangle\]

are assembled from the induced potential of ph.x (dvscf: Hartree and exchange-correlation response), the bare local pseudopotential derivative and the Kleinman-Bylander derivative terms, with the nscf wavefunctions of the same save directory that provides the PAO projections. The irreducible q of ph.x are unfolded to the full grid by rotating the induced potential on the FFT grid (QE dfile_star) and using the true wavefunctions at k and k + Sq; time-reversal partners use the conjugate potential. The result reproduces EPW’s epmatq (Ry/bohr, no 1/sqrt(2 M omega)) and feeds PAOFLOW.elphon.elph_bloch.vertex_pao_R() unchanged, or is built directly in the projected PAO basis phi_j,k = sum_n A*_nj(k) psi_nk (identical by linearity, never forming the band-basis array).

Classes#

StarMember

One q of the full coarse grid and how it derives from an irreducible q.

CoarseVertexSetup

Everything that does not depend on q: wavefunction geometry, tables, symmetries.

Functions#

cartesian_rotation(rotation, at)

Cartesian matrix of a crystal rotation x -> R x (positions in crystal coordinates).

rotate_q(rotation, q_cryst, at, bg)

S q in crystal (reciprocal) coordinates for a crystal rotation of positions.

star_members(q_irr_cryst, group, qgrid, at, bg[, ...])

Unfold the irreducible q-points to the full coarse grid.

rotate_periodic_field(field, rotation, translation)

f'(x) = f(g^-1 x) on the FFT grid for the space-group operation g: x -> R x - t.

cartesian_perturbation_potentials(dvscf_patterns, u, ...)

Induced potential of every Cartesian displacement at a star member (QE dfile_star).

orbital_shells(data_controller)

(shells_per_atom, atom_labels) of a PAOFLOW basis, the inputs of the orbital rotation.

pao_vertex_rotation_operators(setup, shells_per_atom, ...)

Orbital rotation matrices of every space-group operation (pao_sym Wigner-D).

rotate_pao_vertex(gk, kpts_cryst, q0_cryst, member, ...)

g_{S q0}(S k) for every k of the grid from g_{q0}(k) (PAO basis).

unfolded_pao_vertices(setup, A, kpts_cryst, ng, ops, ...)

Generate (member, g_q(k)) for every star member of the given irreducible q.

Module Contents#

class PAOFLOW.elphon.dfpt_vertex.StarMember[source]#

One q of the full coarse grid and how it derives from an irreducible q.

Variables:
  • q_cryst (ndarray (3,)) – Grid representative in [0, 1) (crystal coordinates).

  • iq_irr (int) – Index of the irreducible q.

  • isym (int) – Operation with S q_irr = q_cryst - umklapp (-S q_irr when time_reversed).

  • time_reversed (bool)

  • umklapp (ndarray (3,) int) – q_cryst - (+/-) S q_irr.

q_cryst: numpy.typing.NDArray[numpy.float64][source]#
iq_irr: int[source]#
isym: int[source]#
time_reversed: bool[source]#
umklapp: numpy.typing.NDArray[numpy.int_][source]#
PAOFLOW.elphon.dfpt_vertex.cartesian_rotation(rotation, at)[source]#

Cartesian matrix of a crystal rotation x -> R x (positions in crystal coordinates).

Parameters:
  • rotation (ndarray (3, 3)) – Acts on crystal coordinates of positions.

  • at (ndarray (3, 3)) – Lattice vectors as rows.

PAOFLOW.elphon.dfpt_vertex.rotate_q(rotation, q_cryst, at, bg)[source]#

S q in crystal (reciprocal) coordinates for a crystal rotation of positions.

PAOFLOW.elphon.dfpt_vertex.star_members(q_irr_cryst, group, qgrid, at, bg, time_reversal=True)[source]#

Unfold the irreducible q-points to the full coarse grid.

Parameters:
  • q_irr_cryst (ndarray (nq_irr, 3))

  • group (SpaceGroup)

  • qgrid (sequence of int) – Coarse q-grid (nq1, nq2, nq3).

  • at (ndarray (3, 3)) – Lattice and reciprocal vectors (rows).

  • bg (ndarray (3, 3)) – Lattice and reciprocal vectors (rows).

  • time_reversal (bool, optional) – Also use q -> -q (non-magnetic systems).

Returns:

One entry per grid point, ordered by irreducible q then by discovery.

Return type:

list of StarMember

Raises:

ValueError – If the stars do not tile the grid exactly once (symmetry mismatch between ph.x and the nscf run, or a wrong q-grid).

PAOFLOW.elphon.dfpt_vertex.rotate_periodic_field(field, rotation, translation)[source]#

f'(x) = f(g^-1 x) on the FFT grid for the space-group operation g: x -> R x - t.

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

  • rotation (ndarray (3, 3) int)

  • translation (ndarray (3,)) – Crystal coordinates; must be commensurate with the grid.

Raises:

ValueError – If the operation does not map the grid onto itself.

PAOFLOW.elphon.dfpt_vertex.cartesian_perturbation_potentials(dvscf_patterns, u, q_irr_cryst, member, group, tau_cryst, at, bg)[source]#

Induced potential of every Cartesian displacement at a star member (QE dfile_star).

Parameters:
  • dvscf_patterns (ndarray (3 nat, nr1, nr2, nr3)) – dvscf records at the irreducible q (pattern basis, one spin component).

  • u (ndarray (3 nat, 3 nat)) – Displacement patterns (columns).

  • q_irr_cryst (ndarray (3,)) – The irreducible q.

  • member (StarMember)

  • group (SpaceGroup)

  • tau_cryst (ndarray (nat, 3)) – Atomic positions (crystal coordinates).

  • at (ndarray (3, 3))

  • bg (ndarray (3, 3))

Returns:

Lattice-periodic part of dV^Hxc / du_{kappa alpha} at member.q_cryst.

Return type:

ndarray (3 nat, nr1, nr2, nr3), complex

class PAOFLOW.elphon.dfpt_vertex.CoarseVertexSetup(save_dir, dfpt_dir, qgrid, prefix=None, pseudo_dir=None, cache_bytes=256 * 1024**2, unfold_kpoints=None)[source]#

Everything that does not depend on q: wavefunction geometry, tables, symmetries.

Parameters:
  • save_dir (str) – nscf save directory (Gamma-centred k-grid, the one used for the projections): either the full grid or, with K_POINTS automatic, its irreducible wedge.

  • dfpt_dir (str) – ph.x outputs (see PAOFLOW.elphon.dfpt_io.locate_dfpt_files()).

  • qgrid (sequence of int) – Coarse q-grid of the DFPT run.

  • prefix (str, optional) – QE prefix (inferred when omitted).

  • pseudo_dir (str, optional) – Directory of the UPF files (default: the save directory, where QE copies them).

  • cache_bytes (int, optional) – Memory budget of the per-rank cache of plane-wave blocks and projectors.

  • unfold_kpoints (bool, optional) – The save holds the irreducible wedge: rotate the stored Bloch functions to every point of the full grid (WavefunctionProvider). None (default) detects it from data-file-schema.xml (a Gamma-centred monkhorst_pack element with fewer stored k-points than the grid); False raises for such a save. The projections A must then come from pao_hamiltonian_from_save(..., unfold_kpoints=True).

Variables:

provider (WavefunctionProvider or None) – Set when the k-points are unfolded.

save_dir[source]#
files: PAOFLOW.elphon.dfpt_io.DFPTFiles[source]#
setup[source]#
nscf[source]#
group[source]#
provider = None[source]#
npol[source]#
spin_orbit[source]#
qgrid[source]#
tpiba[source]#
omega[source]#
tau_alat[source]#
tau_cryst[source]#
species_of_atom[source]#
nat[source]#
fft_grid[source]#
fft_smooth[source]#
upf[source]#
q_irr[source]#
members = [][source]#
vloc[source]#
kb[source]#
kpts_cryst[source]#
nk[source]#
nbnd = 0[source]#
cache_bytes = 268435456[source]#
block(ik)[source]#

Plane-wave block of k-point ik (cached within cache_bytes).

With unfolded k-points the block is rotated from its irreducible representative.

projectors(ik)[source]#

Kleinman-Bylander projectors on the sphere of k-point ik (cached).

clear_cache()[source]#

Drop the cached blocks and projectors.

coarse_q()[source]#

The full coarse q-grid in the order of members (crystal coordinates).

long_range_tensors()[source]#

(epsilon (3, 3), born_charges (nat, 3, 3)), zeros when ph.x had no epsil.

pao_vertex_at_q(member, A, kgrid_idx, ng, basis='auto', bands=None)[source]#

PAO-gauge vertex g_q(R_e) of one coarse q, the output of vertex_pao_R().

Parameters:
  • member (StarMember)

  • A (ndarray (nbnd, nawf, nk)) – PAO projections A_ni(k) = <phi_i|psi_nk> of the same nscf save.

  • kgrid_idx (ndarray (nk, 3) int) – Integer grid labels of the k-points.

  • ng (tuple of int) – Coarse k-grid dimensions.

  • basis ({'auto', 'pao', 'band'}, optional) – 'pao' applies the perturbation to the projected PAO Bloch functions phi_j,k = sum_n A*_nj(k) psi_nk (nawf functions per k); 'band' to the nbnd bands and rotates afterwards; 'auto' takes the cheaper one. The two agree to rounding.

  • bands (sequence of int, optional) – Band subset of the projector (see pao_vertex_k()).

Return type:

ndarray (nawf, nawf, 3 nat, n1, n2, n3), complex

pao_vertex_k(member, A, ng, basis='auto', bands=None)[source]#

PAO-gauge vertex g_q(k)_{ij,c} of one coarse q on the k-grid (before the R_e transform).

Parameters:
Returns:

In the k order of the nscf run.

Return type:

ndarray (nk, nawf, nawf, 3 nat), complex

potential_at(member)[source]#

Total perturbing potential (induced + bare local) of every Cartesian mode at member.

Return type:

ndarray (3 nat, nr1, nr2, nr3) on the smooth grid, Ry/bohr.

matrix_elements(member, potential, ik, ikq, umklapp, left=None, right=None)[source]#

<chi_{m,k+q}| dV/du_c |chi_{n,k}> for one k (bands, or projected functions).

Parameters:
  • member (StarMember)

  • potential (ndarray (3 nat, nr1, nr2, nr3)) – From potential_at().

  • ik (int) – Indices of k and of the grid point k' = k + q - G0.

  • ikq (int) – Indices of k and of the grid point k' = k + q - G0.

  • umklapp (ndarray (3,) int) – G0.

  • left (ndarray (nbnd, n), optional) – Coefficient matrices B such that the functions are chi_j = sum_n B*_nj psi_n at k + q (left) and k (right); None uses the bands themselves.

  • right (ndarray (nbnd, n), optional) – Coefficient matrices B such that the functions are chi_j = sum_n B*_nj psi_n at k + q (left) and k (right); None uses the bands themselves.

Return type:

ndarray (3 nat, n_left, n_right), complex, Ry/bohr

band_vertex_at_q(member, bands=None)[source]#

Band-basis Cartesian vertex d[k, m, n, c] of one q (all k of the coarse grid).

Parameters:
  • member (StarMember)

  • bands (sequence of int, optional) – Band subset (default: all nscf bands).

Returns:

The layout of PAOFLOW.elphon.elph_bloch.vertex_pao_R() (m at k+q).

Return type:

ndarray (nk, nb, nb, 3 nat), complex

nscf_grid()[source]#

The coarse k-grid of the nscf run (inferred from the k-point list).

PAOFLOW.elphon.dfpt_vertex.orbital_shells(data_controller)[source]#

(shells_per_atom, atom_labels) of a PAOFLOW basis, the inputs of the orbital rotation.

Parameters:

data_controller (DataController) – After projections.

Returns:

  • shells_per_atom (dict) – Species label -> list of l of its shells (arrays['shells']).

  • atom_labels (list of str) – Species label of every atom (arrays['atoms']).

PAOFLOW.elphon.dfpt_vertex.pao_vertex_rotation_operators(setup, shells_per_atom, atom_labels, ng)[source]#

Orbital rotation matrices of every space-group operation (pao_sym Wigner-D).

Parameters:
Returns:

The operator set of PAOFLOW.elphon.symmetry.build_dv_symmetry_operators() plus 'rotations' (crystal, acting on positions), 'translations' and 'equivalent_atoms' of the group.

Return type:

dict

PAOFLOW.elphon.dfpt_vertex.rotate_pao_vertex(gk, kpts_cryst, q0_cryst, member, setup, ops, ng, conjugate_u=False)[source]#

g_{S q0}(S k) for every k of the grid from g_{q0}(k) (PAO basis).

Parameters:
  • gk (ndarray (nk, nawf, nawf, 3 nat)) – g_{q0}(k)_{ij,c} in the k order of kpts_cryst (the output layout of CoarseVertexSetup.pao_vertex_at_q() before the transform to R_e).

  • kpts_cryst (ndarray (nk, 3))

  • q0_cryst (ndarray (3,)) – The irreducible q of gk.

  • member (StarMember) – Target star member (S q0 or -S q0, plus its umklapp vector).

  • setup (CoarseVertexSetup)

  • ops (dict) – From pao_vertex_rotation_operators().

  • conjugate_u (bool, optional) – Use U^dagger instead of U (convention switch of the Wigner-D matrices).

Returns:

g_{q}(k) at q = member.q_cryst, in the k order of kpts_cryst.

Return type:

ndarray (nk, nawf, nawf, 3 nat)

Notes

The PAO Bloch sums carry the cell phase, phi_{j,k} = sum_R exp(i k.R) w_j(r - R - tau_j) (structure factor exp(-i (k+G).tau)), so under g: r -> R r + f with R tau_a + f = tau_a' + L_a they transform as O_g phi_{j,k} = exp(-i Sk.L_j) sum_j' D_j'j phi_{j',Sk} and the displacement operators as O_g dV_{q,kappa alpha} O_g^-1 = exp(-i Sq.L_kappa) sum_beta M_beta alpha dV_{Sq,kappa' beta}; hence

\[g_{Sq}(Sk)_{i'j',\kappa'\beta} = \sum_{ij\alpha} D_{i'i}\, e^{-i(Sk+Sq)\cdot L_i}\, g_q(k)_{ij,\kappa\alpha}\, e^{+i Sk\cdot L_j}\, D^*_{j'j}\, M_{\beta\alpha}\, e^{+i Sq\cdot L_\kappa}.\]

Both g_q(k) and the stored vertex are periodic in k and q in this convention, so grid representatives need no extra phases; time-reversal partners are the complex conjugate (real orbitals, no spin-orbit coupling). The identity holds when the band projector of the projections commutes with the operation (complete multiplets in nbnd), which unfolded_pao_vertices() checks on one member.

PAOFLOW.elphon.dfpt_vertex.unfolded_pao_vertices(setup, A, kpts_cryst, ng, ops, irreducible, basis='auto', check_member=True, tol=1e-06, conjugate_u=True)[source]#

Generate (member, g_q(k)) for every star member of the given irreducible q.

The vertex is computed once per irreducible q and rotated to its star (rotate_pao_vertex()); for the first star with more than one member one rotated member is also computed directly and compared.

Parameters:
  • setup (CoarseVertexSetup)

  • A (ndarray (nbnd, nawf, nk))

  • kpts_cryst (ndarray (nk, 3))

  • ng (sequence of int)

  • ops (dict) – From pao_vertex_rotation_operators().

  • irreducible (sequence of int) – Indices of the irreducible q to process.

  • basis (str, optional)

  • check_member (bool, optional) – Perform the self-check (one direct computation).

  • tol (float, optional) – Largest tolerated relative deviation of the self-check.

  • conjugate_u (bool, optional) – Wigner-D convention (True reproduces the direct vertices).

Yields:

tuple – (member, gk) with gk (nk, nawf, nawf, 3 nat).

Raises:

ValueError – If the self-check deviates by more than tol: the nscf band set cuts a degenerate multiplet at some k-point (the projected PAO functions are then not symmetric); change nbnd so that the highest band is isolated everywhere, or use unfold='full'.