PAOFLOW.elphon.do_pao_eph#
Pseudo-atomic-orbital (Agapito-Bernardi) electron-phonon coupling driver.
This is the interpolation route of PAOFLOW.elphon: instead of
reconstructing the DFPT perturbation from dvscf (bare local + nonlocal +
induced), it reads Quantum ESPRESSO’s full coarse-grid coupling
el_ph_mat – which already contains every contribution (including NLCC and
ultrasoft augmentation) that ph.x computes – rotates it into the PAOFLOW
pseudo-atomic-orbital (PAO) gauge, and Wigner-Seitz interpolates the electrons
and the vertex to a dense grid to evaluate the isotropic Eliashberg properties.
Reference: L. A. Agapito and M. Bernardi, “Ab initio electron-phonon interactions using atomic orbital wave functions”, Phys. Rev. B 97, 235146 (2018).
The heavy lifting reuses the existing, validated primitives:
vertex_pao_R() (PAO gauge + electron Fourier
transform), lambda_q_dense_ws() (Wigner-Seitz
dense interpolation + Fermi-surface double delta) and
eliashberg_from_modes() (alpha^2F / lambda / Tc).
Functions#
|
PAO-gauge real-space vertex |
|
PAO-gauge real-space vertex |
|
PAO-gauge real-space vertex |
|
Load EPW's coarse Bloch coupling ( |
|
Refuse couplings whose long-range part the interpolation does not treat. |
|
Phonon frequencies and mass-weighted eigenvectors at one q. |
|
Isotropic Eliashberg properties from QE's coarse |
Module Contents#
- PAOFLOW.elphon.do_pao_eph.vertex_from_qe_elphmat(elphmat_path, A, kpts_cryst, bg, ng, long_range=None)[source]#
PAO-gauge real-space vertex
g(R_e)from one QEel_ph_matdump.- Parameters:
elphmat_path (str) – Path to
elphmat.<iq>.dat(patched-QE dump).A (ndarray
(nbnd, nawf, nk)) – PAO projection matricesA_{ni}(k) = <phi_i|psi_nk>(arry['U'][..., ispin]), grabbed afterprojectabilityand beforepao_hamiltonian.kpts_cryst (ndarray
(nk, 3)) – PAOFLOW coarse-grid k-points (crystal coordinates).bg (ndarray
(3, 3)) – Reciprocal-lattice vectors (rows), for thexq/xk-> crystal map.ng (tuple(int, int, int)) – Coarse k-grid dimensions (== the
pw.xSCF grid).
- Returns:
gR (ndarray
(nawf, nawf, ncart, n1, n2, n3))q_cryst (ndarray
(3,)) – The q-point of this dump in crystal coordinates.
- PAOFLOW.elphon.do_pao_eph.vertex_from_qe_ahc(ahc_dir, iq, A, kpts_cryst, q_cryst, ng, nbnd, nmodes, nk, long_range=None)[source]#
PAO-gauge real-space vertex
g(R_e)from one unpatched QE AHC dump.Like
vertex_from_qe_elphmat(), but reads the Cartesianahc_gkk(read_qe_ahc_gkk()): no pattern rotation and no k-permutation – the AHC records are already in the nscf k-order, the same order asAandkpts_crystfor the samelead.save.- Parameters:
ahc_dir (str) – Directory with the
ahc_gkk_iq<iq>.binfiles.iq (int) – 1-based q index (matches
<prefix>.dyn<iq>).A (ndarray
(nbnd, nawf, nk)) – PAO projectionsA_{ni}(k) = <phi_i|psi_nk>.kpts_cryst (ndarray
(nk, 3)) – Coarse-grid k-points (crystal), nscf order.q_cryst (ndarray
(3,)) – q-point (crystal coordinates), from the.dynfile.nbnd (int) – AHC array dimensions.
nmodes (int) – AHC array dimensions.
nk (int) – AHC array dimensions.
- Return type:
ndarray
(nawf, nawf, ncart, n1, n2, n3)
- PAOFLOW.elphon.do_pao_eph.vertex_from_epw(epmatq_q, A, kpts_cryst, q_cryst, ng, ibndkept, long_range=None)[source]#
PAO-gauge real-space vertex
g(R_e)for one q from EPW’s coarse coupling.- Parameters:
epmatq_q (NDArray[np.complex128], shape
(nbndep, nbndep, nk, 3 nat)) – One q slice ofread_epw_epb()['epmatq']:<psi_{m,k+q}| dV/du_c |psi_{n,k}>over the bands kept by EPW, Cartesian displacement basis, nscf k order.A (NDArray[np.complex128], shape
(nbnd, nawf, nk)) – PAO projectionsA_{ni}(k) = <phi_i|psi_nk>on the same nscf save that EPW read (allnbndbands).kpts_cryst (NDArray[np.float64], shape
(nk, 3)) – Coarse k-points (crystal coordinates), nscf order.q_cryst (NDArray[np.float64], shape
(3,)) – The q-point of the slice (crystal coordinates).ibndkept (NDArray[np.integer], shape
(nbndep,)) – 0-based nscf index of each band kept by EPW (read_epw_ukk()['ibndkept']).long_range (NDArray[np.complex128], shape
(nawf, nawf, 3 nat), optional) – Long-range vertex of this q to subtract in the PAO gauge (vertex_pao_R()).
- Returns:
The PAO-gauge vertex in the electron real-space cells.
- Return type:
NDArray[np.complex128], shape
(nawf, nawf, 3 nat, n1, n2, n3)- Raises:
ValueError – If
k + qdoes not fall on the coarse k-grid.
Notes
EPW evaluates both
psi_{k+q}(the stored grid pointk + q - G) andpsi_kfrom the nscf wavefunctions, so the band phases match those ofAand the rotationvertex_pao_R()is consistent for every q. The vertex is restricted to the kept bands,g = A_{k+q}[kept]^T d A_k[kept]^*.
- PAOFLOW.elphon.do_pao_eph.load_epw_coupling(epw_dir, nbnd, nk, nat, bg, prefix=None, ukk_path=None)[source]#
Load EPW’s coarse Bloch coupling (
epbwrite) with its band bookkeeping.- Parameters:
epw_dir (str) – EPW
outdirholdingprefix.epb1 ... prefix.epbN.nbnd (int) – Number of bands of the nscf run (rows of the PAO projections
A).nk (int) – Number of coarse k-points.
nat (int) – Number of atoms.
bg (NDArray[np.float64], shape
(3, 3)) – Reciprocal-lattice vectors (rows,2 pi / alat).prefix (str, optional) – Calculation prefix; inferred from the single
*.epb1file if omitted.ukk_path (str, optional) – Path to
prefix.ukk(default:epw_dir/prefix.ukk).
- Returns:
epmatq(nbndep, nbndep, nk, 3 nat, nq),q_cryst(nq, 3),dynq(3 nat, 3 nat, nq),ibndkept(nbndep,),nq, and the Born chargeszstar(nat, 3, 3)and dielectric tensorepsi(3, 3)(zero unless ph.x ran withepsil = .true.).- Return type:
- Raises:
FileNotFoundError – If the prefix cannot be inferred or the files are missing.
NotImplementedError – If EPW packed the bands by a disentanglement window (some
lwinfalse).
- PAOFLOW.elphon.do_pao_eph.check_long_range_terms(zstar, epsi, allow_missing_long_range=False, zstar_tol=0.1, long_range=None)[source]#
Refuse couplings whose long-range part the interpolation does not treat.
The PAO interpolation Fourier-interpolates the full coupling and force constants; it has no dipole (Frohlich) or quadrupole subtract-and-restore step (EPW
lpolar). That is exact for metals, whose free carriers screen the long-range fields, but not for insulators and semiconductors.- Parameters:
zstar (NDArray[np.float64], shape
(nat, 3, 3)) – Born effective charges (load_epw_coupling()).epsi (NDArray[np.float64], shape
(3, 3)) – High-frequency dielectric tensor; zero when ph.x did not compute it.allow_missing_long_range (bool, optional) – Only warn instead of raising for polar materials (default
False).zstar_tol (float, optional) – Born charges below this magnitude are DFPT noise (default 0.1).
long_range (LongRangeModel, optional) – The analytic model that the drivers subtract and restore (
LongRangeModel): with it a polar material is accepted, and only a non-polar insulator without quadrupoles still warns.
- Raises:
NotImplementedError – For a polar material (
max |Z*| > zstar_tol) unlessallow_missing_long_range: the dipole term diverges as1/|q|and cannot be Fourier-interpolated.- Warns:
UserWarning – For a non-polar insulator or semiconductor (
epsipresent,Z* = 0, e.g. Si): the dynamical-quadrupole term is not included.
Notes
See
docs/internals/long-range-elphon-plan.mdfor the planned dipole and quadrupole treatment. Under MPI the warnings are issued by rank 0 only (every rank still raises).
- PAOFLOW.elphon.do_pao_eph.phonon_modes_from_force_constants(force_constants, masses_ry)[source]#
Phonon frequencies and mass-weighted eigenvectors at one q.
- Parameters:
force_constants (NDArray[np.complex128], shape
(3 nat, 3 nat)) – Force-constant matrixC(q)(Ry/bohr^2, not divided by the masses).masses_ry (NDArray[np.float64], shape
(3 nat,)) – Mass of the atom of each Cartesian component (QE Rydberg units).
- Returns:
freq_thz (NDArray[np.float64], shape
(3 nat,)) – Signed frequencies (THz; negative for imaginary modes).z (NDArray[np.complex128], shape
(3 nat, 3 nat)) – Orthonormal eigenvectors ofD = C / sqrt(M_a M_b), one per row (the convention ofread_qe_dyn()).
- PAOFLOW.elphon.do_pao_eph.eliashberg_from_qe_coupling(A, HRs, kpts_cryst, bg, at, coupling_dir, q_weights, ng, dyn_paths, elphmat_fmt='elphmat.%d.dat', source='elphmat', masses_amu=None, nk_dense=18, sigmas_ry=(0.02,), nelec=None, spin_degeneracy=2.0, mu_star=0.1, ispin=0, isig=0, sigma_w_frac=0.02, fs_window=8.0, comm=None, orbital_positions=None, allow_missing_long_range=False, save_dir=None, pseudo_dir=None, prefix=None, basis='auto')[source]#
Isotropic Eliashberg properties from QE’s coarse
el_ph_mat(PAO route).For every irreducible q the coupling dump is rotated into the PAO gauge, Wigner-Seitz interpolated to a dense grid and reduced to
lambda_{q nu}; the modes are combined with their star weights and fed to the validated property engine. Theq = Gammaacoustic modes (omega -> 0) are zeroed, matching QE.- Parameters:
A (ndarray
(nbnd, nawf, nk)) – PAO projectionsA_{ni}(k) = <phi_i|psi_nk>(grabarry['U'][..., ispin]beforepao_hamiltonian).HRs (ndarray
(nawf, nawf, m1, m2, m3, nspin)) – PAO Hamiltonian (E_Fat 0), frompao_hamiltonian.kpts_cryst (ndarray
(nk, 3)) – Coarse-grid k-points (crystal coordinates), e.g.read_nscfoutput.bg (ndarray
(3, 3)) – Reciprocal- and real-lattice vectors (rows).at (ndarray
(3, 3)) – Reciprocal- and real-lattice vectors (rows).coupling_dir (str) – Directory holding the coupling files (
elphmat.<iq>.datforsource='elphmat',ahc_gkk_iq<iq>.binforsource='ahc', or EPW’sprefix.epb*andprefix.ukkforsource='epw').q_weights (array_like
(nq,)or None) – Star sizes of the irreducible q-points (need not be normalised). For a full un-reduced q-grid (e.g. the 27-point AHC output) use all ones. Forsource='epw',Noneselects unit weights over EPW’s full grid.ng (tuple(int, int, int)) – Coarse coupling k-grid (== SCF grid).
dyn_paths (sequence of str or None) – One QE
*.dynfile per q (for frequencies/eigenvectors; also supplies the q-point forsource='ahc'). Unused forsource='epw', whose q-points and force constants come from the.epbfiles.elphmat_fmt (str, optional) – Filename template for the patched dumps (
%dis the 1-based q index).source ({'elphmat', 'ahc', 'epw', 'dfpt'}, optional) – Coupling input: the patched
el_ph_matdump (any pseudo), the unpatched QE AHCahc_gkkbinaries (norm-conserving only), EPW’s coarse Bloch coupling (epbwrite; any pseudo), or the native vertex computed from theph.xoutputs incoupling_dirand the nscf wavefunctions ofsave_dir('dfpt', norm-conserving;CoarseVertexSetup). Only'epw'and'dfpt'evaluatepsi_{k+q}from the same nscf save asA; the other ph.x sources recompute it with arbitrary band phases, which breaks the k-interpolation for q != 0.masses_amu (array_like
(natom,), optional) – Atomic masses (amu); required to mass-weight the phonon eigenvectors.nk_dense (int, optional) – Dense interpolation grid size.
sigmas_ry (array_like, optional) – Fermi-surface smearing(s) (Ry);
isigselects which one is reported.nelec (float, optional) – Valence electrons for the dense-grid Fermi-level recompute.
spin_degeneracy (float, optional) – 2 for scalar bands, 1 for spinors (spin-orbit coupling): sets the Fermi level of
nelecelectrons on the dense grid.mu_star (float, optional) – Coulomb pseudopotential for
Tc.ispin (int, optional)
isig (int, optional)
sigma_w_frac (float, optional) – Gaussian width (fraction of max frequency) for the
alpha^2Fhistogram.fs_window (float, optional) – Fermi-surface window (in smearings) used to prune the dense-grid double delta: only k with a band within
fs_window*sigmaof E_F are kept. The default (8) is exact toexp(-fs_window^2); lower it (e.g. 4-5) to speed up metals with wide bands at a controlled tolerance.comm (mpi4py communicator, optional) – MPI communicator used to distribute the per-q loop (each q is an independent unit of work reusing the shared dense-electron cache). Defaults to
MPI.COMM_WORLD; runmpirun -np N python ...for an (up to)N-fold speedup, capped atnqranks. The dense electron diagonalisation is computed redundantly on every rank (the cache is needed by all q and is too large to broadcast cheaply); only the per-q vertex interpolation is parallelised.orbital_positions (ndarray
(nawf, 3), optional) – PAO orbital centres in crystal coordinates (pao_orbital_positions()). When given, the electrons and the vertex are interpolated with orbital-pair Wigner-Seitz images, required for symmetric interpolation in cells with several atoms;Nonekeeps the single-site images.allow_missing_long_range (bool, optional) – For
source='epw'and'dfpt', run a polar material without the long-range dipole term instead of raising (check_long_range_terms()).save_dir –
source='dfpt'options (seeprepare_dense_vertex()).pseudo_dir –
source='dfpt'options (seeprepare_dense_vertex()).prefix –
source='dfpt'options (seeprepare_dense_vertex()).basis –
source='dfpt'options (seeprepare_dense_vertex()).
- Returns:
The
eliashberg_from_modes()result, with the extra keys'lambda_qv','omega_qv_thz'(both(nq, nmode)) and'dos_ef'((nq,), states/spin/Ry per q).- Return type: