PAOFLOW.sparse.pdos#

Streaming projected-DOS accumulator for the fused mesh pass.

Replicates spectrum.do_pdos.do_pdos_adaptive output exactly — same energy grid (emax clipped to min(shift, emax)), same per-orbital file names via _build_orbital_prefixes, same normalization and MPI reduction — but accumulates the orbital weights |V_mn|^2 per k-point inside the mesh loop, so the (nk, nawf, nawf) eigenvector tensor the dense kernel reads is never stored.

Attributes#

Classes#

PdosConsumer

Mesh consumer accumulating the projected density of states.

Module Contents#

PAOFLOW.sparse.pdos.comm[source]#
PAOFLOW.sparse.pdos.rank[source]#
class PAOFLOW.sparse.pdos.PdosConsumer(data_controller, emin, emax, ne)[source]#

Mesh consumer accumulating the projected density of states.

Parameters:
  • data_controller (DataController) – Run state; supplies shift, smearing, nawf and nspin.

  • emin (float) – Requested energy range (eV, PAO zero of energy). emax is clipped to the PAO shift, above which the projected Hamiltonian carries no physical states.

  • emax (float) – Requested energy range (eV, PAO zero of energy). emax is clipped to the PAO shift, above which the projected Hamiltonian carries no physical states.

  • ne (int) – Number of points on the energy grid.

Variables:
  • ene (np.ndarray, shape (ne,)) – Energy grid the PDOS is tabulated on.

  • partial (np.ndarray, shape (nspin, nawf, ne)) – Running per-orbital accumulator, this rank’s share of the mesh.

Notes

The projected DOS resolves the density of states by basis orbital,

\[\rho_m(E) = \frac{1}{N_k} \sum_{\mathbf{k}, n} |V_{mn}(\mathbf{k})|^2 \, \delta(E - E_n(\mathbf{k})),\]

where \(V_{mn}\) is the weight of orbital \(m\) in band \(n\) and the delta function is replaced by a normalized smearing kernel of k- and band-dependent width (the Yates adaptive width the mesh pass computes from the band velocity).

The dense kernel evaluates that sum after the fact, from a stored (nk, nawf, nawf) eigenvector tensor. Here the sum is instead accumulated one k-point at a time, while the mesh loop still holds the eigenvector block: the weights |V_mn|^2 are contracted with the smearing kernel immediately and only the (nspin, nawf, ne) result survives the k-point. That result is independent of mesh size, so the memory cost of the PDOS does not grow with the k-mesh or with cell doubling.

Because each rank walks its own share of the mesh, partial holds a partial sum until finalize() reduces across ranks and divides by the total number of k-points.

ene[source]#
smearing[source]#
nawf[source]#
nspin[source]#
partial[source]#
on_k(ik, ispin, E, V, vel, delta)[source]#

Add one k-point’s orbital weights to the accumulator.

Parameters:
  • ik (int) – Local k-point index; unused, the contribution is a plain sum.

  • ispin (int) – Spin channel.

  • E (np.ndarray, shape (nev,)) – Eigenvalues at this k-point (eV), ascending.

  • V (np.ndarray, shape (nawf, nev)) – Eigenvector block. Read here and not retained, per the mesh consumer contract.

  • vel (np.ndarray, shape (3, nev)) – Band velocities; unused, they enter only through delta.

  • delta (np.ndarray, shape (nev,)) – Adaptive smearing width of each band at this k-point (eV).

Notes

The smearing kernel is evaluated on the outer product of the energy grid with the eigenvalues, giving an (ne, nev) matrix, and the orbital weights |V_mn|^2 are contracted against it in one (nawf, nev) @ (nev, ne) matrix product. Both smearing functions depend on ene and eig only through their difference, so the broadcast is symmetric in the two arguments.

finalize(data_controller)[source]#

Reduce across ranks, normalize, and write the PDOS files.

Parameters:

data_controller (DataController) – Run state; supplies the orbital labels used for file names and performs the (collective) file writes.

Notes

Writes one *_pdosdk_<ispin>.dat file per basis orbital plus the summed pdosdk_sum_<ispin>.dat, matching the dense kernel’s file set name for name. Every rank calls write_file_row_col for every file because that call is collective; only rank 0 passes data, the others pass None.