PAOFLOW.elphon.do_pao_eph_dense_q#
SKETCH – double real-space PAO el-ph vertex g(R_e, R_p) and dense-q Eliashberg.
Prototype extension of the PAO route (PAOFLOW.elphon.do_pao_eph) that
Wigner-Seitz interpolates the phonons and the electron-phonon vertex to a dense
q-grid, instead of summing only the coarse DFPT q-points. The electron side is
unchanged – it reuses precompute_dense_electrons()
and lambda_q_dense_ws_fast() verbatim.
Idea (EPW / Wannier-Fourier, but in the deterministic PAO gauge)#
The current route builds, for one coarse q, the half-transformed vertex
g_q(R_e)_{ij,c} # electron in R_e, phonon still Bloch-q, Cartesian c
with vertex_from_qe_elphmat(). Collecting this
for every q on the full coarse q-grid and Fourier-transforming q -> R_p gives
the double real-space object
g(R_e, R_p)_{ij,c} = (1/N_q) sum_q e^{-2 pi i q . R_p} g_q(R_e)_{ij,c} .
For any dense q we recover the half-transformed vertex by a Wigner-Seitz sum over the phonon cells R_p,
g_q(R_e)_{ij,c} = sum_{R_p} W_p e^{+2 pi i q . R_p} g(R_e, R_p)_{ij,c} ,
which is exactly the input lambda_q_dense_ws_fast() already consumes, so the
dense-k Fermi-surface double delta is untouched. The phonon frequencies /
eigenvectors at the same dense q come from the standard q2r/matdyn Wigner-Seitz
interpolation of the dynamical matrix (PAOFLOW.elphon.qe_matdyn).
Working in the Cartesian displacement basis (index c = 3*kappa + alpha)
is deliberate: it is smooth in q (the per-q phonon eigenvectors z(q) are applied
later at the dense q), so it is the right representation to Fourier-interpolate.
Deferred / to validate#
Symmetry unfolding: g(R_e, R_p) needs g_q(R_e) on the full coarse q-grid. Either dump all q from ph.x, or unfold the irreducible set by the star operations (rotate R_e, the orbital pair and the Cartesian/atom index). The prototype assumes the full grid is supplied (
TODO: unfold_star).q-phase convention: the e^{i q . tau_kappa} atom-position phase of QE’s
el_ph_matmust match the convention used byqe_matdynwhen it builds D(q)/z(q); otherwise the q -> R_p transform mixes cells (TODO: verify_phase).Eigenvector normalisation:
_phonon_modes_at_qmust return z in the SAME convention asread_qe_dyn()so thatzmass = z / sqrt(M)matches the coarse-q driver (TODO: verify_evec).Polar (Frohlich) long-range part is intentionally NOT handled here; add the dipole/quadrupole subtract-before / add-back-after step for polar materials. For now
check_long_range_terms()refuses polar EPW couplings (and warns for non-polar insulators); the plan is the wiki page Long-range electron-phonon interpolation (plan).
Functions#
|
Fourier-transform the coarse-q half-vertex |
|
Wigner-Seitz sum over |
|
Pair-resolved Wigner-Seitz images of the phonon cells |
|
Dense-q phonon interpolator built from the coarse |
|
Dense-q phonon interpolator from EPW's coarse force constants. |
|
Fold a Gamma-centred |
|
Stars of a Gamma-centred |
|
SKETCH: Eliashberg properties with BOTH k and q interpolated. |
|
Coarse couplings -> shared |
Module Contents#
- PAOFLOW.elphon.do_pao_eph_dense_q.build_g_ReRp(g_qRe, q_cryst, qgrid)[source]#
Fourier-transform the coarse-q half-vertex
g_q(R_e)tog(R_e, R_p).- Parameters:
g_qRe (ndarray
(nq, nawf, nawf, ncart, n1e, n2e, n3e)) – The per-q PAO-gauge vertexg_q(R_e)(Cartesian displacement basis), one slice per coarse q-point – e.g. stacked outputs ofvertex_from_qe_elphmat().q_cryst (ndarray
(nq, 3)) – The coarse q-points in crystal coordinates (must tile the fullqgrid).qgrid (tuple(int, int, int)) – The coarse phonon q-grid
(nq1, nq2, nq3)(nq == prod(qgrid)).
- Returns:
g_ReRp – The double real-space vertex; the trailing three axes are the phonon cells
R_p(grid ==qgrid).- Return type:
ndarray
(nawf, nawf, ncart, n1e, n2e, n3e, nq1, nq2, nq3)
- PAOFLOW.elphon.do_pao_eph_dense_q.g_Re_at_q(g_ReRp, q_cryst, Nint_p, W_p, Midx_p)[source]#
Wigner-Seitz sum over
R_p-> the half-vertexg_q(R_e)at one q.(Nint_p, W_p, Midx_p)is_ws_lattice()applied to the phonon q-grid:Nint_pare the integer phonon cells (Bloch phaseexp(2 pi i q . n_p)),W_pthe WS degeneracy weights andMidx_p = n_p mod qgridthe indices into the trailing axes ofg_ReRp.W_pmay also be pair-resolved, shape(nws_p, nawf, nawf, ncart)(vertex_phonon_ws_weights()).- Returns:
gR – The half-vertex for this q – the exact input shape expected by
lambda_q_dense_ws_fast().- Return type:
ndarray
(nawf, nawf, ncart, n1e, n2e, n3e)
- PAOFLOW.elphon.do_pao_eph_dense_q.vertex_phonon_ws_weights(qgrid, at, orbital_positions, atom_positions)[source]#
Pair-resolved Wigner-Seitz images of the phonon cells
R_pof the vertex.- Parameters:
qgrid (sequence of int) – Coarse phonon q-grid.
at (ndarray, shape
(3, 3)) – Direct lattice vectors (rows, alat units).orbital_positions (ndarray, shape
(nawf, 3)) – PAO orbital centres (crystal coordinates).atom_positions (ndarray, shape
(nat, 3)) – Atomic positions (crystal coordinates).
- Returns:
Nint_p (ndarray, shape
(nws_p, 3), int) – Phonon cells.W_p (ndarray, shape
(nws_p, nawf, nawf, 3 nat)) – Weight of each cell for each vertex element(i, j, c), input ofg_Re_at_q().Midx_p (ndarray, shape
(nws_p, 3), int) – Grid indicesR_p mod qgrid.
Notes
The cell
R_pofg_{ij, c}is kept when the displaced atomkappa(c)atR_plies in the Wigner-Seitz cell of the supercell around orbitali, as EPW does forg(R_e, R_p)(electron Wannier centre to atom). Of the four choices of orbital (iorj) and sign, this one makeslambda_qof MgB2 the most symmetric within a q-star (spread below 1%, against up to 33% with single-site images).
- PAOFLOW.elphon.do_pao_eph_dense_q.phonon_interp_from_dyn(dyn_paths, qgrid, bg, at, atom_positions=None, long_range=None)[source]#
Dense-q phonon interpolator built from the coarse
*.dynfiles.Reconstructs the mass-weighted dynamical matrix
D(q)on the full coarse q-grid from each dyn file’s(freq, eigenvector)spectral pair (D = sum_nu omega_nu^2 e_nu e_nu^dagger, exact since the QE eigenvectors are mass-weighted and orthonormal), Fourier-transformsq -> R_pand returnsphonon_at_q(q_cryst) -> (freq_thz, z)that Wigner-Seitz interpolatesDto any q and re-diagonalises it.zare the mass-weighted Cartesian eigenvectors(nmode, ncart)– the same convention asread_qe_dyn(), so the driver’szmass = z / sqrt(M)matches the coarse-q route.This avoids
q2r.x(whose star bookkeeping is incompatible with the EPW/AHC full-grid dyn dumps) and mirrors the vertexq -> R_ptransform.- Parameters:
dyn_paths (sequence of str) –
*.dynfiles whose q-points, including every star member listed in each file, cover the full coarse grid: either one file per q of a full-grid (nosym) run, or the irreducible-q files of a symmetricph.xrun.bg (ndarray
(3, 3)) – Reciprocal- and real-lattice vectors (rows).at (ndarray
(3, 3)) – Reciprocal- and real-lattice vectors (rows).atom_positions (ndarray
(nat, 3), optional) – Atomic positions (crystal coordinates) for atom-pair Wigner-Seitz images (asmatdyn.x; recommended with several atoms per cell).Nonekeeps the single-site images.long_range (LongRangeModel, optional) – Polar crystals: the dipole (and quadrupole) force constants (
dynamical_matrix()) are subtracted from the coarseC(q)before theq -> R_ptransform and added back at every dense q (LO-TO splitting); the returned callable records it asphonon_at_q.long_range.
- Returns:
phonon_at_q(q_cryst) -> (freq_thz (nmode,), z (nmode, ncart)).- Return type:
callable
- Raises:
ValueError – If the files do not cover every q of the grid.
- PAOFLOW.elphon.do_pao_eph_dense_q.phonon_interp_from_epw(dynq, q_cryst, masses_amu, qgrid, at, atom_positions=None, long_range=None)[source]#
Dense-q phonon interpolator from EPW’s coarse force constants.
- Parameters:
dynq (NDArray[np.complex128], shape
(3 nat, 3 nat, nq)) – Force-constant matrices on the full coarse q-grid (read_epw_epb()['dynq']; Ry/bohr^2, not divided by the masses).q_cryst (NDArray[np.float64], shape
(nq, 3)) – The matching q-points in crystal coordinates (any order).masses_amu (NDArray[np.float64], shape
(nat,)) – Atomic masses (amu).at (NDArray[np.float64], shape
(3, 3)) – Real-lattice vectors (rows, alat).atom_positions (NDArray[np.float64], shape
(nat, 3), optional) – Atomic positions (crystal coordinates). When given, the force constants are interpolated with atom-pair Wigner-Seitz images (as QEmatdyn), which keeps the dense phonons symmetric in cells with several atoms.
- Returns:
phonon_at_q(q_cryst) -> (freq_thz (nmode,), z (nmode, ncart)), the same convention asphonon_interp_from_dyn().- Return type:
callable
- Raises:
ValueError – If the q-points do not cover the full grid.
- PAOFLOW.elphon.do_pao_eph_dense_q.irreducible_qmesh(nq, rots_cryst, at, bg, include_tr=True)[source]#
Fold a Gamma-centred
nq^3q-grid into the irreducible wedge.The rotations (integer crystal-axis matrices) are applied in Cartesian (
R = at^T S at^-T); because they form an orthogonal group, the orbit is independent of theSvsS^Tconvention. Time reversal (q -> -q) is added by default (lambda_q = lambda_{-q}).- Returns:
q_reps (ndarray
(nir, 3)) – One representative q per star (crystal coordinates).weights (ndarray
(nir,)) – Star multiplicities (sum tonq^3).
- PAOFLOW.elphon.do_pao_eph_dense_q.irreducible_mesh(n, rots_cryst, at, bg, include_tr=True)[source]#
Stars of a Gamma-centred
n^3grid under a point group.- Parameters:
n (int) – Grid size along each reciprocal axis.
rots_cryst (sequence of ndarray, shape
(3, 3)) – Point-group rotations (integer, crystal axes), e.g. the output of_crystal_point_group().at (ndarray, shape
(3, 3)) – Direct and reciprocal lattice vectors (rows, alat and 2 pi / alat units).bg (ndarray, shape
(3, 3)) – Direct and reciprocal lattice vectors (rows, alat and 2 pi / alat units).include_tr (bool, optional) – Add time reversal (
k -> -k) to the group (defaultTrue).
- Returns:
mesh (ndarray, shape
(n^3, 3)) – The full grid in crystal coordinates, flat index(i1 n + i2) n + i3.representatives (ndarray, shape
(nir,)) – Flat index of one representative point per star.weights (ndarray, shape
(nir,)) – Star multiplicities (sum ton^3).star_index (ndarray, shape
(n^3,)) – Star of every grid point (index intorepresentatives).
Notes
The rotations act on Cartesian vectors as \(R = A S A^{-1}\), with \(A\) the matrix of direct lattice vectors as columns.
- PAOFLOW.elphon.do_pao_eph_dense_q.eliashberg_dense_q(A, HRs, kpts_cryst, bg, at, coupling_dir, qgrid_coarse, q_cryst_coarse, dyn_paths_full, ng, phonon_at_q, nq_dense=None, source='elphmat', masses_amu=None, nk_dense=18, sigmas_ry=(0.02,), nelec=None, mu_star=0.1, ispin=0, isig=0, sigma_w_frac=0.02, fs_window=8.0, min_freq_thz=0.0, sym_rots=None, tau_cryst=None, species=None, comm=None, fs_coupling=False, fsthick_ev=None, n_freq_fs=100, orbital_positions=None, allow_missing_long_range=False, transport=False, alat=None, cell_volume=None, spin_degeneracy=2.0, adaptive_smearing=None, save_dir=None, pseudo_dir=None, prefix=None, basis='auto', unfold='full', basis_shells=None, unfold_tol=1e-06, cache_dir=None, cache_tag=None, long_range=None)[source]#
SKETCH: Eliashberg properties with BOTH k and q interpolated.
- adaptive_smearingfloat, optional
Adaptive Fermi-surface smearing (Yates et al., 0.7 for Gaussians): the delta of every dense state gets the width
adaptive_smearing * |v_nk| * dk, floored atsigmas_ry(one series entry per floor); needsalat(the group velocities are computed).Nonekeeps the fixedsigmas_ry.
Mirrors
eliashberg_from_qe_coupling(), but replaces the coarse-q loop by (a) one build ofg(R_e, R_p)from the full coarse-q couplings and (b) a loop over a densenq_dense^3q-grid, WS- interpolating both the vertex (g_Re_at_q()) and the phonons (phonon_at_q) to each dense q.- Parameters:
q_cryst_coarse (ndarray
(nq_coarse, 3)or None) – FULL coarse q-grid in crystal coordinates (TODO: unfold_starif only the irreducible set is available). Forsource='epw',Nonetakes EPW’s q-points, which already cover the full grid.dyn_paths_full (sequence of str or None) – One
*.dynper full coarse q (used only forsource='ahc'to supply the q-point of each dump).phonon_at_q (callable or None) –
q_cryst -> (freq_thz, z); see_phonon_modes_at_q(). Forsource='epw',Nonebuilds it from EPW’s force constants (phonon_interp_from_epw()).source ({'elphmat', 'ahc', 'epw', 'dfpt'}, optional) – Coarse coupling input (see
eliashberg_from_qe_coupling()). Only'epw'and'dfpt'give vertices whose band phases matchAfor every q, which theq -> R_pinterpolation requires;'dfpt'needssave_dir(andcoupling_dir= theph.xoutputs).nq_dense (int, optional) – Dense q-grid size (defaults to
nk_denseso k+q stays commensurate).min_freq_thz (float, optional) – Soft-mode guard: modes with
freq_thz < min_freq_thzare dropped fromlambda(default 0.0 -> only imaginaryomega^2 < 0modes). Coarse DFPT-grid Fourier interpolation can overshoot the acoustic branch into spurious soft/imaginary modes whose1/omega^2blows uplambda; genuine near-Gamma acoustic modes contribute negligibly (their coupling vanishes), so raising this to a few kelvin (~0.05-0.1 THz) is safe.sym_rots (ndarray
(nrot, 3, 3), optional) – Lattice point-group rotations (crystal axes, integer), e.g.read_nscf's_cryst'. When given, the dense q-grid is folded to its irreducible wedge (with star-multiplicity weights), evaluating only the inequivalent q – an up-to-48x (cubic) speedup with an identical result.tau_crystandspeciesfilter the holohedry down to the true crystal point group.tau_cryst (ndarray
(natom, 3), optional) – Atomic positions (crystal coords) for the point-group basis filter.species (sequence, optional) – Per-atom species labels for the basis filter.
comm (mpi4py communicator, optional) – Distributes the dense-q loop across ranks (
MPI.COMM_WORLDby default); runmpirun -np N python ...for an up-to-nq_dense^3-fold speedup. The coarseg(R_e,R_p)build and the dense-electron cache are computed redundantly on every rank; only the per-q interpolation is parallelised.fs_coupling (bool, optional) – Also accumulate the state-resolved Fermi-surface coupling of the anisotropic Migdal-Eliashberg equations (
fermi_surface_coupling), returned under the key'fs_coupling'. Requiressym_rots: the states are folded to the irreducible wedge of the dense k-grid. Usenq_dense = nk_dense: with a coarser q-grid,k+qreaches only a sublattice of the k-grid and the anisotropic equations split into independent sublattice problems, each with its ownTc.fsthick_ev (float, optional) – Half-width (eV) of the Fermi window of the anisotropic states (EPW
fsthick); defaults tofs_windowsmearings.n_freq_fs (int, optional) – Number of phonon-frequency points of the Fermi-surface coupling (default 100).
orbital_positions (ndarray
(nawf, 3), optional) – PAO orbital centres in crystal coordinates (pao_orbital_positions()). When given, every Wigner-Seitz sum is pair-resolved: electrons and the vertexR_eover orbital pairs, the vertexR_pover (orbital, displaced atom) pairs and the EPW force constants over atom pairs (tau_crystrequired). This keeps the dense interpolation symmetric in cells with several atoms;Nonekeeps the single-site images.allow_missing_long_range (bool, optional) – For
source='epw', run a polar material without the long-range dipole term instead of raising (check_long_range_terms()).transport (bool, optional) – Also compute the transport Eliashberg function (
a2F_tr,lambda_tr,lambda_tr_qv), the Fermi-surface plasma-frequency tensoromega_plasma2_ev2(3x3, eV^2) and its isotropicomega_plasma_ev(\(\sqrt{\mathrm{Tr}/3}\), eV), the inputs of metal transport and optics (TransportSpectralChannel,PAOFLOW.response.drude). Needsalatandcell_volume.alat (float, optional) – Lattice parameter (bohr), for the band velocities.
cell_volume (float, optional) – Unit-cell volume (bohr^3), for the plasma frequency.
spin_degeneracy (float, optional) – 2 without spin-orbit coupling, 1 with it. The band velocities are the group velocities of the PAO Hamiltonian (no non-local correction, which belongs to interband dipoles only).
save_dir –
source='dfpt'and cache options ofprepare_dense_vertex().pseudo_dir –
source='dfpt'and cache options ofprepare_dense_vertex().prefix –
source='dfpt'and cache options ofprepare_dense_vertex().basis –
source='dfpt'and cache options ofprepare_dense_vertex().unfold –
source='dfpt'and cache options ofprepare_dense_vertex().basis_shells –
source='dfpt'and cache options ofprepare_dense_vertex().unfold_tol –
source='dfpt'and cache options ofprepare_dense_vertex().cache_dir –
source='dfpt'and cache options ofprepare_dense_vertex().cache_tag –
source='dfpt'and cache options ofprepare_dense_vertex().
Notes
Deferred: q-phase validation and the polar Frohlich term.
- PAOFLOW.elphon.do_pao_eph_dense_q.prepare_dense_vertex(A, kpts_cryst, bg, at, coupling_dir, qgrid_coarse, q_cryst_coarse, ng, phonon_at_q, *, source='epw', masses_amu, tau_cryst=None, orbital_positions=None, comm=None, allow_missing_long_range=False, save_dir=None, pseudo_dir=None, prefix=None, basis='auto', unfold='full', basis_shells=None, unfold_tol=1e-06, cache_dir=None, cache_tag=None, bands=None, long_range=None)[source]#
Coarse couplings -> shared
g(R_e, R_p)and the phonon interpolator.Common setup of every dense-q electron-phonon property (
eliashberg_dense_q(), the phonon-assisted absorption ofphonon_assisted_absorption): read the coarse couplings, guard against missing long-range terms, build the phonon interpolator and the doubly real-space vertex, and the Wigner-Seitz images of its phonon cells.- Parameters:
A (ndarray, shape
(nbnd, nawf, nk), complex) – PAO projections on the coarse k-grid.kpts_cryst (ndarray, shape
(nk, 3)) – Coarse k-points (crystal coordinates).bg (ndarray, shape
(3, 3)) – Reciprocal (rows, 2 pi/alat) and direct (rows, alat) lattice vectors.at (ndarray, shape
(3, 3)) – Reciprocal (rows, 2 pi/alat) and direct (rows, alat) lattice vectors.coupling_dir (str) – EPW directory (
source='epw'),ph.xoutputs (source='dfpt': thepp.pysave/directory or the run directory holding_ph0/) or QE coupling directory.qgrid_coarse (sequence of int) – Coarse q-grid.
q_cryst_coarse (ndarray, shape
(nq_coarse, 3)or None) – Full coarse q-grid;Nonetakes EPW’s q-points, or the star-unfolded grid of theph.xrun.ng (sequence of int) – Coarse k-grid (real-space electron cells of the vertex).
phonon_at_q (callable or None) –
q_cryst -> (freq_thz, z);Nonebuilds it from EPW’s force constants or from theph.xdyn files.source ({'epw', 'dfpt', 'ahc', 'elphmat'}, optional) – Coarse coupling input (see
eliashberg_dense_q()).'dfpt'computes the vertex natively fromdvscfand the nscf wavefunctions (CoarseVertexSetup), without EPW.masses_amu (ndarray, shape
(nat,)) – Atomic masses (amu), one per atom.tau_cryst (ndarray, shape
(nat, 3), optional) – Atomic positions; required withorbital_positions.orbital_positions (ndarray, shape
(nawf, 3), optional) – PAO orbital centres for the pair-resolved Wigner-Seitz sums.comm (mpi4py communicator, optional) –
MPI.COMM_WORLDby default.allow_missing_long_range (bool, optional) – Run a polar material without the long-range dipole term instead of raising.
save_dir (str, optional) –
source='dfpt': the nscf save directory of the projectionsA(wavefunctions).pseudo_dir (str, optional) –
source='dfpt': directory of the UPF files (default:save_dir).prefix (str, optional) –
source='dfpt': QE prefix (inferred from thedvscffile names by default).basis ({'auto', 'pao', 'band'}, optional) –
source='dfpt': apply the perturbation to the projected PAO functions or to the bands (pao_vertex_at_q()).unfold ({'full', 'irreducible'}, optional) –
source='dfpt': compute the vertex at every coarse q ('full'), or only at the irreducible q ofph.xand rotate it to the stars in the PAO basis (unfolded_pao_vertices(),|star|times cheaper; exact when the nscf band set does not cut a degenerate multiplet, which a self-check verifies on one member).basis_shells (DataController or tuple, optional) –
unfold='irreducible': the PAO basis (data_controllerafterprojections, or(shells_per_atom, atom_labels)oforbital_shells()).unfold_tol (float, optional) – Tolerance of the unfolding self-check.
cache_dir (str, optional) – Directory of the
g(R_e, R_p)disk cache (PAOFLOW.elphon.coupling_cache); the array is read from there when an entry with the same key exists, and written after the build otherwise.long_range (LongRangeModel, optional) – Polar crystals: subtract the analytic dipole/quadrupole coupling on the coarse grid and restore it at every dense q (
LongRangeModel); the phonons must be built with the same model (phonon_at_q=Noneorphonon_interp_from_dyn()withlong_range).cache_tag (str, optional) – Identity of the PAO basis for the cache key (
basis_tag()).bands (sequence of int, optional) –
source='dfpt': restrict the band projector of the vertex to these nscf bands (EPW’sexclude_bands; default all bands, the consistent choice for the PAO Hamiltonian).
- Returns:
g_ReRp(nawf, nawf, ncart, n1e, n2e, n3e, nq1, nq2, nq3)(one copy per node in MPI shared memory),window(theMPI.WintoFreeonce all reads are done),phonon_ws(Nint_p, W_p, Midx_p),phonon_at_q, and theepsi(3, 3)andzstar(nat, 3, 3)stored with EPW couplings (Nonefor the other sources).- Return type: