PAOFLOW.hamiltonian.nonlocal_velocity#

PAO orbital catalog and basis-convention helpers of the velocity operator.

Historically this module held the non-local pseudopotential velocity correction \(\Delta p = m/(i\hbar)[V_{\rm NL}, \mathbf r]\), removed in October 2026: PAOFLOW’s velocity is the commutator \(i[H, \mathbf r]\) of a Hamiltonian that already contains \(V_{\rm NL}\), so the term double counted it (Si: 0.87 of the exact plane-wave \(\varepsilon_2\) with the position dipoles, Fe anomalous Hall peak \(\times1.7\)); the missing part of the orbital-centre velocity is the position-dipole term of PAOFLOW.hamiltonian.position_dipoles. The file keeps its name and the pieces that the dipoles use: the PAO radial channels and per-site orbital mapping (PAOCatalog, load_pao_orbitals()), the orbital cutoffs and lattice search, PAOFLOW’s orbital signs (pao_orbital_signs()), the Löwdin transformation (lowdin_transform()) and the scalar-to-(j, m_j) rotation (scalar_to_jm_matrix()). The catalog needs only the atomic orbitals (the basis tables of the projection, or the UPF PP_PSWFC block), so any pseudopotential type is accepted: the norm-conserving restriction of the removed term (its Kleinman-Bylander projectors) went with it.

Classes#

PAOChannelData

One radial PAO channel from a UPF (per species, per shell).

PAOSpeciesData

Per-species PAO radial channels.

PAOOrbitalEntry

One real-spherical-harmonic PAO basis function on a given site.

PAOSiteData

Per-atom mapping into the PAO basis.

PAOCatalog

Top-level container for the loaded PAO atomic-orbital data.

Functions#

qe_m_index_to_std(qe_m, l)

Convert Quantum-ESPRESSO 1-indexed real-Y_lm m to the standard

load_pao_orbitals(data_controller)

Load PAO atomic radial functions and the per-site basis mapping.

pao_cutoff_radius(channel, r[, tol])

Return the numerical real-space cutoff of a PAO channel.

site_pao_cutoff(site[, tol])

Largest PAO radial cutoff on a given site (via pao_cutoff_radius()).

pao_orbital_signs(pao_catalog)

Sign of every PAOFLOW orbital with respect to the real-space orbitals of the tables.

lowdin_transform(matrix_k, overlap_k)

Transform an operator matrix from the atomic to the Löwdin-orthonormal PAO basis.

scalar_to_jm_matrix(matrix_k, pao_catalog)

Spin-double a scalar PAO matrix and rotate it to the relativistic (j, m_j) basis.

Module Contents#

PAOFLOW.hamiltonian.nonlocal_velocity.qe_m_index_to_std(qe_m, l)[source]#

Convert Quantum-ESPRESSO 1-indexed real-Y_lm m to the standard \(m \in \{-l, \dots, +l\}\) convention used by PAOFLOW.hamiltonian._two_center.

QE orders the \(2l+1\) real spherical harmonics as (Y_{l,0}, Y_{l,+1}, Y_{l,-1}, Y_{l,+2}, Y_{l,-2}, \\dots) indexed by qe_m = 1, 2, 3, .... The mapping is:

  • qe_m = 1 \(\\to\) m = 0

  • qe_m = 2k \(\\to\) m = +k (k = 1, \\dots, l)

  • qe_m = 2k+1 \(\\to\) m = -k (k = 1, \\dots, l)

class PAOFLOW.hamiltonian.nonlocal_velocity.PAOChannelData[source]#

One radial PAO channel from a UPF (per species, per shell).

Variables:
  • label (str) – UPF shell label (e.g. '2S', '3P', '3D').

  • l (int) – Angular momentum.

  • R_radial (np.ndarray, shape (npoints,)) – Pseudo-wavefunction radial part \(R(r) = (r\,R(r))/r\) (UPF’s r\,R divided by r with the r=0 end-point extrapolated for l=0 – see _upf_wfc_to_radial()).

  • wfc (np.ndarray, shape (npoints,)) – Original UPF array \(r\,R(r)\) (kept verbatim for callers that prefer the UPF convention, e.g. matching PAOFLOW.projection.do_atwfc_proj.radialfft_simpson()).

  • occupation (float) – UPF occupation attribute (non-negative; zero for unoccupied but available shells).

label: str[source]#
l: int[source]#
R_radial: numpy.ndarray[source]#
wfc: numpy.ndarray[source]#
occupation: float[source]#
class PAOFLOW.hamiltonian.nonlocal_velocity.PAOSpeciesData[source]#

Per-species PAO radial channels.

Variables:
  • label (str) – Species label as it appears in data_arrays['species'].

  • pseudo_file (str) – UPF filename.

  • upf (UPF) – Parsed UPF object (shared with BetaSpeciesData when both catalogs are loaded for the same species).

  • r (np.ndarray, shape (npoints,)) – Radial mesh (Bohr).

  • rab (np.ndarray, shape (npoints,)) – Radial integration weights.

  • channels (list[PAOChannelData]) – Radial channels in UPF order (one per occupied PSWFC shell).

label: str[source]#
pseudo_file: str[source]#
upf: PAOFLOW.inputs.read_upf.UPF[source]#
r: numpy.ndarray[source]#
rab: numpy.ndarray[source]#
channels: list[PAOChannelData][source]#
class PAOFLOW.hamiltonian.nonlocal_velocity.PAOOrbitalEntry[source]#

One real-spherical-harmonic PAO basis function on a given site.

Variables:
basis_index: int[source]#
site_index: int[source]#
channel_index: int[source]#
l: int[source]#
m: int[source]#
qe_m: int[source]#
label: str[source]#
class PAOFLOW.hamiltonian.nonlocal_velocity.PAOSiteData[source]#

Per-atom mapping into the PAO basis.

Variables:
  • index (int) – Site index J.

  • label (str) – Species label.

  • tau (np.ndarray, shape (3,)) – Cartesian position \(\boldsymbol{\tau}_J\) (Bohr).

  • species (PAOSpeciesData) – Reference to the per-species PAO data.

  • orbitals (list[PAOOrbitalEntry]) – Real-Y_lm basis functions belonging to this site, in PAOFLOW basis order (channel-major, m sweeps inside each channel).

  • basis_offset (int) – Index in the global PAO basis where this site’s block starts.

index: int[source]#
label: str[source]#
tau: numpy.ndarray[source]#
species: PAOSpeciesData[source]#
orbitals: list[PAOOrbitalEntry][source]#
basis_offset: int[source]#
class PAOFLOW.hamiltonian.nonlocal_velocity.PAOCatalog[source]#

Top-level container for the loaded PAO atomic-orbital data.

Variables:
  • species (dict[str, PAOSpeciesData]) – Per-species data, keyed by species label.

  • sites (list[PAOSiteData]) – Per-atom entries (length natoms).

  • basis (list[PAOOrbitalEntry]) – Flat PAO basis in PAOFLOW order; len(basis) == nawf.

  • total_nlm (int) – \(\sum_J \sum_\text{channels} (2l+1)\) – the dimension of the PAO basis.

species: dict[str, PAOSpeciesData][source]#
sites: list[PAOSiteData] = [][source]#
basis: list[PAOOrbitalEntry] = [][source]#
total_nlm: int = 0[source]#
PAOFLOW.hamiltonian.nonlocal_velocity.load_pao_orbitals(data_controller)[source]#

Load PAO atomic radial functions and the per-site basis mapping.

The orbital catalog of the position dipoles (PAOFLOW.hamiltonian.position_dipoles); any pseudopotential type (norm-conserving, ultrasoft, PAW), since only the atomic orbitals are read.

When data_arrays['atomic_basis'] is present (PAOFLOW stashes it inside PAOFLOW.projections() after the projector basis has been built), the catalog is reconstructed from those records so that the dipoles are those of exactly the orbitals that produced dHksp. This is required when the production run uses an AE / extended basis (BASIS/<elem>/*.dat) whose orbital count and radial mesh do not match the UPF pswfc set.

Falls back to parsing upf.pswfc directly when atomic_basis is not present (legacy / unit-test path).

Parameters:

data_controller (DataController) –

Required:

  • arrays['species']: list of (label, pseudo_file) ((label, title) for VASP).

  • arrays['atoms']: per-site list of species labels.

  • arrays['tau']: (natoms, 3) Cartesian positions (Bohr).

  • attributes['fpath']: directory containing the UPF files (QE), or the run folder whose POTCAR datasets PAOFLOW.inputs.pseudopotentials locates (VASP).

Optional:

Returns:

Loaded species data, per-site mapping, and flat PAO basis.

Return type:

PAOCatalog

Raises:

RuntimeError – On missing species, a tau/atoms shape mismatch, or when atomic_basis records for the same species disagree on the radial mesh.

PAOFLOW.hamiltonian.nonlocal_velocity.pao_cutoff_radius(channel, r, tol=0.0001)[source]#

Return the numerical real-space cutoff of a PAO channel.

The pseudo-wavefunction \(r\,R(r)\) (stored as PAOChannelData.wfc) decays smoothly to zero outside the core. This helper returns the smallest r_c such that \(|r R(r)| < \mathrm{tol} \times \max_r |r R(r)|\) for every grid point \(r > r_c\).

Parameters:
  • channel (PAOChannelData) – PAO radial channel.

  • r (np.ndarray, shape (npoints,)) – Radial mesh from PAOSpeciesData.r.

  • tol (float, optional) – Relative threshold (default 1e-4).

Returns:

Cutoff radius in Bohr. r[-1] is returned if the tail never drops below tol × peak.

Return type:

float

PAOFLOW.hamiltonian.nonlocal_velocity.site_pao_cutoff(site, tol=0.0001)[source]#

Largest PAO radial cutoff on a given site (via pao_cutoff_radius()).

PAOFLOW.hamiltonian.nonlocal_velocity.pao_orbital_signs(pao_catalog)[source]#

Sign of every PAOFLOW orbital with respect to the real-space orbitals of the tables.

PAOFLOW’s atomic Bloch orbitals (calc_atwfc_k) are built in reciprocal space with the phase \(i^l\) and the calc_ylmg harmonics, which carry an extra -1 on odd |m|; transformed back to real space they are \((-1)^l (-1)^{|m| \bmod 2}\) times \(R(r) Y_{lm}(\hat r)\) with the tesseral harmonics of PAOFLOW.hamiltonian._two_center. A matrix with two PAO indices built from the tables therefore transforms with the product of the two signs. Measured on the Si basis (3S 3P 3D 4S 4P) against the plane-wave overlaps and Berry connection of the PAOFLOW orbitals (agreement to \(10^{-3}\) and 2 %); the odd-|m| factor alone flips every \(s\)–\(p\) and \(p\)–\(d\) element.

Parameters:

pao_catalog (PAOCatalog)

Returns:

+1 or -1 per orbital in PAOFLOW basis order.

Return type:

np.ndarray, shape (nawf,)

PAOFLOW.hamiltonian.nonlocal_velocity.lowdin_transform(matrix_k, overlap_k)[source]#

Transform an operator matrix from the atomic to the Löwdin-orthonormal PAO basis.

PAOFLOW’s Hamiltonian, dHksp and band velocities are expressed in the symmetrically orthogonalised orbitals \(\omega = \varphi S^{-1/2}\); a matrix computed between the raw atomic orbitals \(\varphi\) (such as the two-centre \(\Delta p\)) must be transformed as

\[M^{\omega}(\mathbf k) = S^{-1/2}(\mathbf k)\, M^{\varphi}(\mathbf k)\, S^{-1/2}(\mathbf k)\]

before it is added to them. For a diffuse basis this is not a small correction: on the standard Si set (Bloch-overlap eigenvalues \(5\cdot10^{-4}\) to 20) the untransformed \(\Delta p\) has its largest elements 4–5 times too small.

Parameters:
  • matrix_k (np.ndarray, shape (nk, 3, n, n) or (nk, n, n), complex) – Operator in the atomic-orbital Bloch basis.

  • overlap_k (np.ndarray, shape (nk, n, n), complex) – Hermitian positive-definite Bloch overlap \(S(\mathbf k)\) of the same orbitals, in the same phase convention.

Returns:

The transformed operator, same shape as matrix_k.

Return type:

np.ndarray

Raises:

ValueError – If \(S(\mathbf k)\) is not positive definite (linearly dependent orbitals).

PAOFLOW.hamiltonian.nonlocal_velocity.scalar_to_jm_matrix(matrix_k, pao_catalog)[source]#

Spin-double a scalar PAO matrix and rotate it to the relativistic (j, m_j) basis.

Uses the same per-shell unitaries (_jm_shell_transform()) and channel layout as the PAO index of assemble_beta_projections_jm(), so that e.g. the Bloch overlap \(S(\mathbf k)\) of the scalar orbitals becomes the overlap of the (j, m_j) basis in which the relativistic dHksp is expressed.

Parameters:
  • matrix_k (np.ndarray, shape (nk, nawf, nawf), complex) – Spin-independent matrix in the scalar (tesseral) PAO basis.

  • pao_catalog (PAOCatalog)

Return type:

np.ndarray, shape (nk, 2 nawf, 2 nawf), complex