PAOFLOW.elphon.elph_bloch#

Shared Bloch / PAO-gauge vertex machinery for the electron-phonon PAO route.

Provides the geometry reader and the interpolation primitives used by PAOFLOW.elphon.do_pao_eph to turn QE’s coarse-grid Cartesian coupling into the dense-grid Eliashberg properties:

  • read_nscf() – k-points, eigenvalues, Fermi level and lattice from the QE data-file-schema.xml;

  • kq_index_map()k -> (index of k+q on the grid, umklapp G0);

  • vertex_pao_R() – rotate the band-basis Cartesian coupling into the PAO gauge A_{k+q}^dagger d A_k and Fourier-transform it to the electron real-space cells g(R_e);

  • lambda_q_dense_ws() – Wigner-Seitz interpolate the electrons (HRs) and the vertex to a dense grid and evaluate the Fermi-surface double delta -> lambda_{q nu}.

Attributes#

Functions#

read_nscf(save_dir)

Read k-points, eigenvalues, Fermi level and lattice from data-file-schema.xml.

kq_index_map(kpts_cryst, q_cryst, nkgrid[, tol])

Map k -> (index of k+q on the grid, umklapp G0).

vertex_pao_R(d, A, ikq, kgrid_idx, ng)

PAO-gauge vertex in real space g(R_e) for one q (EPW electron transform).

lambda_q_dense_ws(gR, HRs, q_cryst, ng_coarse, at, ...)

lambda_{q nu} with a Wigner-Seitz (EPW-style) electron interpolation.

precompute_dense_electrons(HRs, at, Nk, sigmas_ry, ...)

Dense-grid electron spectrum + Fermi-surface delta, shared by every q.

lambda_q_dense_ws_fast(gR, electrons, q_cryst, zmass, ...)

lambda_{q nu} for one q, reusing a precompute_dense_electrons() cache.

Module Contents#

PAOFLOW.elphon.elph_bloch.HARTREE_TO_RY = 2.0[source]#
PAOFLOW.elphon.elph_bloch.RY_TO_THZ = 3289.842[source]#
PAOFLOW.elphon.elph_bloch.RY_TO_EV = 13.605693122994[source]#
PAOFLOW.elphon.elph_bloch.AMU_RY = 911.4442421[source]#
PAOFLOW.elphon.elph_bloch.read_nscf(save_dir)[source]#

Read k-points, eigenvalues, Fermi level and lattice from data-file-schema.xml.

Returns:

{'kpts_cart', 'kpts_cryst', 'eigs_ry', 'ef_ry', 'nbnd', 'nk', 'bg', 'at', 'alat', 'omega', 'fft'}. kpts_cart in 2*pi/alat, kpts_cryst in reciprocal-lattice fractions, energies in Ry (referred to E_F), bg reciprocal vectors (rows, 2*pi/alat), at real vectors (rows, alat).

Return type:

dict

PAOFLOW.elphon.elph_bloch.kq_index_map(kpts_cryst, q_cryst, nkgrid, tol=1e-05)[source]#

Map k -> (index of k+q on the grid, umklapp G0).

Parameters:
  • kpts_cryst (ndarray (nk, 3)) – k-points in crystal coordinates.

  • q_cryst (ndarray (3,)) – q-point in crystal coordinates.

  • nkgrid (tuple(int, int, int)) – Monkhorst-Pack grid dimensions (for snapping to integer grid indices).

Returns:

  • ikq (ndarray (nk,) int) – Index of the grid point equal to k + q modulo a reciprocal vector.

  • G0 (ndarray (nk, 3) int) – The umklapp vector G0 = (k + q) - k' in reciprocal-lattice units.

PAOFLOW.elphon.elph_bloch.vertex_pao_R(d, A, ikq, kgrid_idx, ng)[source]#

PAO-gauge vertex in real space g(R_e) for one q (EPW electron transform).

Rotates the band-basis deformation potentials to the PAO gauge, g^{PAO}_{ij,c}(k) = (A_{k+q}^\dagger d_c(k) A_k)_{ij}, places them on the coarse k-grid and Fourier-transforms to the electron cells R_e. The transform matches PAOFLOW’s HRs convention so the result can be interpolated with PAOFLOW.elphon.eph_kq.estates_on_grid().

Parameters:
  • d (ndarray (nk, nbnd, nbnd, ncart)) – Band-basis Cartesian deformation potentials d_{mn,c}(k) (QE’s el_ph_mat / ahc_gkk on the coarse k-grid).

  • A (ndarray (nbnd, nawf, nk)) – PAO projections A_{n i}(k) = <psi_{nk}|phi_i> (arry['U'][..., ispin]).

  • ikq (ndarray (nk,)) – Index of k+q on the coarse grid.

  • kgrid_idx (ndarray (nk, 3) int) – Integer grid labels round(k_cryst * ng) % ng of each k-point.

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

Returns:

The PAO-gauge vertex in the electron real-space cells.

Return type:

ndarray (nawf, nawf, ncart, n1, n2, n3) complex

PAOFLOW.elphon.elph_bloch.lambda_q_dense_ws(gR, HRs, q_cryst, ng_coarse, at, zmass, freqs_thz, sigmas_ry, Nk, ispin=0, kblock=4096, nelec=None)[source]#

lambda_{q nu} with a Wigner-Seitz (EPW-style) electron interpolation.

Same as lambda_q_dense() but the vertex gR and the PAO Hamiltonian HRs are interpolated to the dense grid with explicit Wigner-Seitz real-space sums (proper zone-boundary degeneracy weights) instead of a plain zero-padding Fourier embed, and k+q is evaluated directly at (k+q) (no grid roll).

Parameters:
  • gR (ndarray (nawf, nawf, ncart, n1, n2, n3)) – Vertex real-space cells; its grid may differ from HRs (e.g. a coarse 6^3 coupling combined with a dense 18^3 electron Hamiltonian).

  • HRs (ndarray (nawf, nawf, m1, m2, m3, nspin))

  • q_cryst (ndarray (3,)) – q-point in crystal coordinates (exact, not restricted to the coarse grid).

  • ng_coarse (ignored) – Kept for backward compatibility; the H and vertex grids are read from the array shapes so the two may differ.

  • at (ndarray (3, 3)) – Real-lattice vectors (rows, alat units) for the WS construction.

  • zmass (see lambda_q_dense().)

  • freqs_thz (see lambda_q_dense().)

  • sigmas_ry (see lambda_q_dense().)

  • Nk (see lambda_q_dense().)

Returns:

{'lambda_qnu', 'gamma_ghz', 'dos_ef', 'nk_dense'}.

Return type:

dict

PAOFLOW.elphon.elph_bloch.precompute_dense_electrons(HRs, at, Nk, sigmas_ry, nelec, ng_vertex, ispin=0, kblock=4096, fs_window=8.0)[source]#

Dense-grid electron spectrum + Fermi-surface delta, shared by every q.

Diagonalises H(k) once on the regular Nk^3 grid (Wigner-Seitz interpolation of HRs). Because the electronic spectrum is q-independent, E(k+q) / V(k+q) for any commensurate q are index shifts of this array, so lambda_q_dense_ws_fast() needs no per-q re-diagonalisation (the dominant cost of lambda_q_dense_ws() when looping over many q). The Wigner-Seitz phase of the coupling grid ng_vertex is cached too, so the per-q vertex interpolation reduces to a single BLAS matmul.

Parameters:
  • HRs (ndarray (nawf, nawf, m1, m2, m3, nspin)) – PAO Hamiltonian (E_F at 0).

  • at (ndarray (3, 3)) – Real-lattice vectors (rows, alat units) for the Wigner-Seitz sums.

  • Nk (int) – Dense grid size.

  • sigmas_ry (array_like) – Fermi-surface smearing(s) (Ry).

  • nelec (float or None) – Valence electrons for the dense Fermi-level recompute (None -> 0).

  • ng_vertex (tuple(int, int, int)) – Real-space grid of the coupling vertex gR (its shape[3:6]).

  • ispin (int, optional)

  • kblock (int, optional)

  • fs_window (float, optional) – Fermi-surface window in smearings for the shell mask (default 8, exact to exp(-fs_window^2)); lower it to prune wide-band metals more aggressively.

Returns:

Cache consumed by lambda_q_dense_ws_fast() – keys Nk, nawf, E (nkd, nawf) (Ry), V (nkd, nawf, nawf), dk (nsigma, nkd, nawf), dos (nsigma,), plus the cached vertex Wigner-Seitz phase (phkg, Midxg, Wg, ng_vertex).

Return type:

dict

PAOFLOW.elphon.elph_bloch.lambda_q_dense_ws_fast(gR, electrons, q_cryst, zmass, freqs_thz, kblock=4096)[source]#

lambda_{q nu} for one q, reusing a precompute_dense_electrons() cache.

Numerically identical to lambda_q_dense_ws() (deterministic eigh), but the q-independent dense electron spectrum, Fermi level and Fermi-surface delta come from electrons; only the coupling vertex is interpolated per q, and k+q is an index shift (requires Nk commensurate with q).

Parameters:
  • gR (ndarray (nawf, nawf, ncart, n1, n2, n3)) – PAO-gauge vertex real-space cells for this q (grid == ng_vertex).

  • electrons (dict) – Output of precompute_dense_electrons().

  • q_cryst (ndarray (3,)) – q-point (crystal coordinates); q * Nk must be integer.

  • zmass (ndarray (nmode, ncart))

  • freqs_thz (ndarray (nmode,))

  • kblock (int, optional)

Returns:

{'lambda_qnu', 'gamma_ghz', 'dos_ef', 'nk_dense'}.

Return type:

dict