PAOFLOW.elphon.pao_electrons#

The electronic side of the dense electron-phonon pipeline: PAO Hamiltonians from a QE save.

The dense-q properties (phonon_assisted_absorption_dense_q(), carrier_scattering_dense_q()) take the electron-phonon vertex from the EPW save (projections A and .epb files) and the electronic Hamiltonian HRs as separate inputs. HRs may therefore come from another save of the same crystal in the same PAO basis, e.g. an eACBN0 (DFT+U+V, ortho-atomic) nscf whose PAO Hamiltonian already has the right band gap: the band energies and eigenvectors are then those of that Hamiltonian, while the coupling in the orbital basis stays that of the DFPT/EPW run. This module builds such Hamiltonians, checks that two saves share the PAO basis, and records the Hubbard provenance of a save.

Functions#

pao_hamiltonian_from_save

Projections, PAO Hamiltonian, orbital centres and lattice data of a save.

check_same_pao_basis

Raise unless two PAOFLOW runs span the same orbital basis on the same structure.

check_orbital_dimensions

Shape guard between the coupling projections and the Hamiltonian.

hubbard_info_from_save, format_hubbard_info

The Hubbard (DFT+U, DFT+U+V) parameters recorded in data-file-schema.xml.

Classes#

PAOElectrons

PAO electronic structure of one QE save.

Functions#

pao_hamiltonian_from_save(savedir[, basispath, ...])

Build the PAO projections and Hamiltonian of a QE save.

check_same_pao_basis(reference, other, *[, names, ...])

Check that two PAOFLOW runs span the same PAO basis on the same crystal.

check_orbital_dimensions(A, HRs[, orbital_positions])

Shape guard between the coupling projections and the electronic Hamiltonian.

hubbard_info_from_save(savedir)

Hubbard parameters recorded in data-file-schema.xml of a QE save.

format_hubbard_info(info[, threshold_ev])

One-line description of hubbard_info_from_save() ('PBE' for None).

Module Contents#

class PAOFLOW.elphon.pao_electrons.PAOElectrons[source]#

PAO electronic structure of one QE save.

Variables:
  • savedir (str) – The QE save directory.

  • projections (ndarray or None) – A_{ni}(k) = <phi_i|psi_nk>, shape (nbnd, nawf, nk) (None when not kept).

  • HRs (ndarray) – PAO Hamiltonian (eV), shape (nawf, nawf, n1, n2, n3, nspin).

  • nscf (dict) – read_nscf() of the save, plus 'orbital_positions' (crystal coordinates of the orbital centres).

  • data_controller (DataController) – The PAOFLOW data controller of the run (non-local velocity, basis checks).

  • expand_wedge (bool) – The symmetry expansion used by pao_hamiltonian.

  • hubbard (dict or None) – hubbard_info_from_save() of the save (None for a plain DFT run).

savedir: str[source]#
projections: numpy.typing.NDArray[numpy.complex128] | None[source]#
HRs: numpy.typing.NDArray[numpy.complex128][source]#
nscf: dict[source]#
data_controller: object[source]#
expand_wedge: bool[source]#
hubbard: dict | None[source]#
PAOFLOW.elphon.pao_electrons.pao_hamiltonian_from_save(savedir, basispath=None, configuration='standard', pthr=0.95, *, expand_wedge=None, projector='internal', keep_projections=True, workpath=None, outputdir='output', save_overlaps=False, verbose=False, unfold_kpoints=False)[source]#

Build the PAO projections and Hamiltonian of a QE save.

Parameters:
  • savedir (str) – QE save directory (data-file-schema.xml, wavefunctions, UPF files).

  • basispath (str, optional) – Directory of the radial basis tables (paoflow-genbasis-ps); only for projector='internal'.

  • configuration (str or mapping, optional) – PAO basis preset ('minimal', 'standard', 'extended') or a per-element shell dictionary (PAOFLOW.projections).

  • pthr (float, optional) – Projectability threshold.

  • expand_wedge (bool, optional) – Symmetry expansion of pao_hamiltonian: False for an explicit full k list (the EPW nscf), True for an irreducible Monkhorst-Pack set. None (default) infers it: the k-points are expanded unless they already fill the nk1 x nk2 x nk3 grid.

  • projector ({'internal', 'projwfc'}, optional) – Internal atomic projections (PAOFLOW.projections) or the projwfc.x ones of the save (read_atomic_proj_QE).

  • keep_projections (bool, optional) – Keep a copy of the full projection matrix (needed only for the save that provides the coupling).

  • workpath (optional) – Passed to PAOFLOW.PAOFLOW.

  • outputdir (optional) – Passed to PAOFLOW.PAOFLOW.

  • save_overlaps (optional) – Passed to PAOFLOW.PAOFLOW.

  • verbose (optional) – Passed to PAOFLOW.PAOFLOW.

  • unfold_kpoints (bool, optional) – The save holds the irreducible wedge of a Gamma-centred K_POINTS automatic nscf: unfold k-points, eigenvalues and wavefunctions to the full grid by symmetry (PAOFLOW.PAOFLOW unfold_kpoints), so that the projections cover every k and the Hamiltonian is built with expand_wedge=False. Required for the save that provides the coupling (source='dfpt') when its nscf was not run on the full grid.

Returns:

Projections, HRs, lattice data with orbital centres, the data controller and the Hubbard provenance.

Return type:

PAOElectrons

Raises:

ValueError – For an unknown projector.

Notes

The call sequence is the one of the generated electron-phonon drivers (projections -> projectability -> full_projections -> pao_hamiltonian -> read_nscf -> pao_orbital_positions), so a driver that switches to this function reproduces its previous numbers. HRs is on the energy scale of this save (its Fermi level or highest occupied level at zero). savedir is resolved against the current directory (not workpath).

PAOFLOW.elphon.pao_electrons.check_same_pao_basis(reference, other, *, names=('coupling save', 'electrons save'), tau_tol_bohr=1e-05)[source]#

Check that two PAOFLOW runs span the same PAO basis on the same crystal.

Parameters:
  • reference (DataController or (arrays, attributes)) – The two runs after projections/projectability (and optionally pao_hamiltonian).

  • other (DataController or (arrays, attributes)) – The two runs after projections/projectability (and optionally pao_hamiltonian).

  • names (tuple of str, optional) – How the two runs are called in the error message.

  • tau_tol_bohr (float, optional) – Tolerance on the atomic and orbital positions (bohr).

Returns:

Per-run summary of the quantities that may legitimately differ: nbnds, nkpnts, kgrid, bnd (bands with good projectability), shift, Efermi and pthr (each a pair).

Return type:

dict

Raises:

ValueError – Listing every mismatch of the orbital count, spin, species and pseudopotentials, atoms, positions, lattice vectors, orbital identities and basis configuration.

Notes

The Hamiltonian of other is used with the coupling of reference only if both are expressed in the same orthonormal orbital basis: the same pseudopotentials, radial tables and shells, on the same atoms in the same order. The projectability outcome (bnd, shift) depends on the Kohn-Sham states and differs between functionals; it is reported, not enforced.

PAOFLOW.elphon.pao_electrons.check_orbital_dimensions(A, HRs, orbital_positions=None)[source]#

Shape guard between the coupling projections and the electronic Hamiltonian.

Parameters:
  • A (ndarray, shape (nbnd, nawf, nk)) – PAO projections of the coupling save.

  • HRs (ndarray, shape (nawf, nawf, n1, n2, n3, nspin)) – PAO Hamiltonian (possibly of another save).

  • orbital_positions (ndarray, shape (nawf, 3), optional) – Orbital centres.

Raises:

ValueError – If the orbital counts disagree.

PAOFLOW.elphon.pao_electrons.hubbard_info_from_save(savedir)[source]#

Hubbard parameters recorded in data-file-schema.xml of a QE save.

Parameters:

savedir (str) – QE save directory.

Returns:

None for a plain DFT run. Otherwise kind ('DFT+U', 'DFT+U+J', 'DFT+U+V' from lda_plus_u_kind), projectors (U_projection_type or Hubbard_projectors), and terms: a list of (tag, attributes, value_eV) for every scalar Hubbard_* child (Hubbard_U, Hubbard_V, Hubbard_J0, …), in file order. Occupation matrices are skipped.

Return type:

dict or None

Notes

The element layout of <dftU> changed across QE versions; every scalar child whose tag starts with Hubbard_ is kept with its attributes (specie, label, spec1, index …) so that nothing is lost. Values are in Hartree in the XML and converted to eV.

PAOFLOW.elphon.pao_electrons.format_hubbard_info(info, threshold_ev=1e-06)[source]#

One-line description of hubbard_info_from_save() ('PBE' for None).

Parameters:
Returns:

E.g. 'DFT+U+V (ortho-atomic): Hubbard_U Si 3p 3.00 eV; Hubbard_V ... 1.66 eV'.

Return type:

str