PAOFLOW.models.band_unfold#

band_unfold.py — General band-unfolding from supercell to primitive cell.

Works with any crystal symmetry. Given the primitive-cell (PC) and supercell (SC) lattice vectors and atomic positions, the module:

  1. Finds the integer transformation matrix M such that A_SC = M · A_PC.

  2. Enumerates the N = \(|\det M|\) primitive-lattice translations inside the supercell.

  3. Builds the atom mapping I(α, ℓ) (SC atom ← PC atom α + translation ℓ).

  4. Extracts the real-space Hamiltonian from a PAOFLOW DataController, Fourier-transforms along an arbitrary k-path in the PC Brillouin zone, and computes the spectral weight w_n(k) for every SC eigenstate.

Public API#

unfold_bands(pc_model_dict, sc_model_dict, kpath_frac, *,

nk_per_seg=80, verbose=True)

paoflow_to_model_dict(data_controller) — model dict of a DFT (projection)

run, for the pc_model_dict / sc_model_dict arguments

UnfoldResult — dataclass returned by unfold_bands() plot_unfolded — convenience plotting function

Real-space Hamiltonian conventions#

The unfolding Fourier-transforms the real-space Hamiltonian with the Bloch phase \(e^{+2\pi i \mathbf{k}\cdot\mathbf{R}}\), which presumes that HRs[:, :, R] holds the hopping from an orbital in the home cell to an orbital at \(\boldsymbol{\tau}_B + \mathbf{R}\). Model Hamiltonians built by PAOFLOW.models.models (Slater–Koster, EDTB) follow this convention. The projected DFT Hamiltonian of a PAOFLOW run does not: it is obtained as HRs = ifftn(Hks), so that \(H(\mathbf{k}) = \sum_R H(\mathbf{R})\, e^{-2\pi i \mathbf{k}\cdot\mathbf{R}}\) and the hopping is stored at \(-\mathbf{R}\). Band energies cannot tell the two apart (with time reversal they give \(H(\mathbf{k})\) and \(H(-\mathbf{k})\)), but the spectral weights can: the eigenvectors of \(H(-\mathbf{k})\) projected on the primitive-cell momentum \(\mathbf{k}\) select the folded branches of the mirror point. _extract_hamiltonian() therefore brings every Hamiltonian to the +R convention before the transform, using the fourier_sign entry of a _paoflow dict when present and _detect_fourier_sign() otherwise.

References

V. Popescu and A. Zunger, Phys. Rev. B 85, 085201 (2012). P. B. Allen et al., Phys. Rev. B 87, 085322 (2013).

Attributes#

Classes#

UnfoldResult

Container for band-unfolding results.

Functions#

make_kpath(sym_points, path_str, a_pc[, nk_per_seg])

Generate a k-path from a string specification.

paoflow_to_model_dict(data_controller[, label])

Model dict of a DFT (projection) PAOFLOW run for unfold_bands().

unfold_bands(pc_model_dict, sc_model_dict, sym_points, ...)

Unfold supercell bands onto the primitive-cell Brillouin zone.

unfold_from_models(pc_model, sc_model, sym_points, ...)

Unfold bands using EDTBModel objects directly.

unfold_bands_sparse(pc_model_dict, sc_model_dict, ...)

Unfold supercell bands using sparse Lanczos for the SC eigenpairs.

plot_unfolded(result, *[, y_lim, w_thresh, cmap, ...])

Plot unfolded band structure.

Module Contents#

class PAOFLOW.models.band_unfold.UnfoldResult[source]#

Container for band-unfolding results.

Variables:
  • kpath_cart ((nk, 3) Cartesian k-points (units of 1/alat).)

  • kdist ((nk,) cumulative k-distance along the path.)

  • sym_ticks (list of (distance, label) for symmetry-point ticks.)

  • E_pc ((nk, nawf_pc) PC reference eigenvalues.)

  • E_sc ((nk, nawf_sc) SC eigenvalues.)

  • W ((nk, nawf_sc) spectral weights w_n(k).)

  • nawf_pc (int — number of orbitals in the PC.)

  • nawf_sc (int — number of orbitals in the SC.)

  • N (int — volume ratio (= \(|\det M|\)).)

  • R_translations ((N, 3) PC lattice translations inside the SC.)

  • atom_map ((n_at_pc, N) SC atom index for each (α, ℓ).)

kpath_cart: numpy.ndarray[source]#
kdist: numpy.ndarray[source]#
sym_ticks: list[source]#
E_pc: numpy.ndarray[source]#
E_sc: numpy.ndarray[source]#
W: numpy.ndarray[source]#
nawf_pc: int[source]#
nawf_sc: int[source]#
N: int[source]#
R_translations: numpy.ndarray[source]#
atom_map: numpy.ndarray[source]#
a_pc: numpy.ndarray[source]#
a_sc: numpy.ndarray[source]#
M: numpy.ndarray[source]#
sum_rule_check()[source]#

Return Σ_n W_n(k) per k-point (should ≈ nawf_pc).

Notes

The unfolded spectral weights obey the completeness (sum) rule

\[\sum_{n} w_n(\mathbf{k}) \approx n_{\mathrm{awf}}^{PC},\]

i.e. at every k-point the SC spectral weights add up to the number of orbitals in the primitive cell.

PAOFLOW.models.band_unfold.make_kpath(sym_points, path_str, a_pc, nk_per_seg=80)[source]#

Generate a k-path from a string specification.

Parameters:
  • sym_points (dict mapping label → (3,) fractional coords in PC basis.)

  • path_str (e.g. 'Γ-X-W-K-Γ-L|U-X'. Use '-' to connect, '|' for breaks.)

  • a_pc ((3, 3) PC lattice vectors (rows), Cartesian/alat.)

  • nk_per_seg (number of k-points per linear segment.)

Returns:

  • kpath_cart ((nk, 3) Cartesian k-points.)

  • kdist ((nk,) cumulative distance.)

  • sym_ticks (list of (distance, label).)

Notes

The PC reciprocal lattice vectors are defined by

\[\mathbf{b}_i \cdot \mathbf{a}_j = \delta_{ij}, \qquad \mathbf{B}_{PC} = \mathbf{A}_{PC}^{-T},\]

so a fractional point frac maps to Cartesian coordinates as frac @ b_pc. Each segment between two symmetry points is sampled by linear interpolation

\[\mathbf{k}(t) = \mathbf{k}_0 + t\,(\mathbf{k}_1 - \mathbf{k}_0), \qquad t = 0, \tfrac{1}{n_{\rm seg}}, \dots, \tfrac{n_{\rm seg}-1}{n_{\rm seg}}.\]
PAOFLOW.models.band_unfold.paoflow_to_model_dict(data_controller, label='PAOFLOW')[source]#

Model dict of a DFT (projection) PAOFLOW run for unfold_bands().

Parameters:
  • data_controller (PAOFLOW.DataController.DataController) – Data controller of a run that has built the PAO Hamiltonian (after projections / projectability / pao_hamiltonian, or read_atomic_proj_QE + pao_hamiltonian).

  • label (str) – Label stored in the dict.

Returns:

{'label', 'alat', 'model': {'a_vectors', 'atoms'}, '_paoflow': {...}} with the real-space Hamiltonian HRs (shape (nawf, nawf, nR, nspin)), its lattice grid R (Cartesian, units of alat), nawf, nspin, the orbital count per atom norbitals and fourier_sign = -1.

Return type:

dict

Notes

PAOFLOW stores a_vectors in units of alat and tau in Bohr; the positions are returned in units of alat,

\[\boldsymbol{\tau}_{\mathrm{alat}} = \boldsymbol{\tau}_{\mathrm{Bohr}} / a_{\mathrm{lat}} .\]

The lattice grid R is the FFT grid of HRs (built with PAOFLOW.utils.get_R_grid_fft.get_R_grid_fft() if the run has not built it yet). The projected Hamiltonian is HRs = ifftn(Hks), i.e.

\[H(\mathbf{k}) = \sum_{\mathbf{R}} H(\mathbf{R})\, e^{-2\pi i \mathbf{k}\cdot\mathbf{R}},\]

which _extract_hamiltonian() converts to the +R convention of the unfolding (fourier_sign = -1). The orbital counts per atom are taken from naw when the run provides them and are otherwise assumed uniform (nawf / natoms).

PAOFLOW.models.band_unfold.unfold_bands(pc_model_dict, sc_model_dict, sym_points, path_str, *, nk_per_seg=80, verbose=True)[source]#

Unfold supercell bands onto the primitive-cell Brillouin zone.

Parameters:
  • pc_model_dict (PAOFLOW model dict for the primitive cell.)

  • sc_model_dict (PAOFLOW model dict for the supercell.)

  • sym_points (dict of high-symmetry point labels → fractional coords) – in the PC reciprocal basis. Example: {'Γ': [0,0,0], 'X': [0.5, 0, 0.5], ...}

  • path_str (band-path string, e.g. 'Γ-X-W-K-Γ-L|U-X'.)

  • nk_per_seg (k-points per linear sub-segment.)

  • verbose (print progress information.)

Return type:

UnfoldResult dataclass with eigenvalues, spectral weights, and metadata.

Notes

Both model dicts must use the same alat. The PC and SC lattice vectors (a_vectors) must be given in Cartesian units of alat (the PAOFLOW / EDTB convention). A model dict may come from EDTBModel.to_model_dict() (tight-binding route) or from paoflow_to_model_dict() (projected DFT route); the two store the real-space Hamiltonian in opposite Fourier conventions, which _extract_hamiltonian() reconciles (see the module docstring).

At every k-point along the path, the PC and SC Bloch Hamiltonians are built from the real-space Hamiltonians by Fourier transform,

\[H(\mathbf{k}) = \sum_{\mathbf{R}} H(\mathbf{R})\, e^{2\pi i \mathbf{k}\cdot\mathbf{R}},\]

Hermitized as \(H(\mathbf{k}) \to \tfrac{1}{2}\left(H(\mathbf{k}) + H(\mathbf{k})^\dagger\right)\) to remove round-off asymmetry, and diagonalized,

\[H(\mathbf{k})\, C_n(\mathbf{k}) = E_n(\mathbf{k})\, C_n(\mathbf{k}),\]

giving the PC reference eigenvalues E_pc and the SC eigenvalues E_sc/eigenvectors used by _compute_spectral_weights() to obtain the spectral weights W (see that function’s Notes for the unfolding formula). The completeness sum rule \(\sum_n W_n(\mathbf{k}) \approx n_{\mathrm{awf}}^{PC}\) is checked at every k-point and a warning is issued if the deviation exceeds 0.01.

PAOFLOW.models.band_unfold.unfold_from_models(pc_model, sc_model, sym_points, path_str, *, nk_per_seg=80, verbose=True)[source]#

Unfold bands using EDTBModel objects directly.

Parameters:
  • pc_model (EDTBModel for the primitive cell.)

  • sc_model (EDTBModel for the supercell.)

  • sym_points (high-symmetry points in PC fractional coords.)

  • path_str (band-path string.)

  • nk_per_seg (k-points per segment.)

  • verbose (print progress.)

Return type:

UnfoldResult

PAOFLOW.models.band_unfold.unfold_bands_sparse(pc_model_dict, sc_model_dict, sym_points, path_str, *, n_eigs=100, sigma=0.0, nk_per_seg=80, n_workers=1, backend='loky', verbose=True, **eigsh_kwargs)[source]#

Unfold supercell bands using sparse Lanczos for the SC eigenpairs.

Same physics as unfold_bands(), but the supercell eigenvalues and eigenvectors are obtained with shift-invert Lanczos (PAOFLOW.spectrum.sparse_bands.SparseEDTB.eigh_at_k()) for the n_eigs bands nearest sigma. Only that energy window is diagonalised and H(k) is never densified, so the routine scales to large moiré supercells where the dense eigh path is intractable. The primitive-cell reference bands are still built densely (the PC is small).

Parameters:
  • pc_model_dict (PAOFLOW model dict for the primitive cell.)

  • sc_model_dict (PAOFLOW model dict for the supercell (must be a) – distance-dependent EDTB model, as required by SparseEDTB).

  • sym_points (high-symmetry labels → fractional coords in the PC) – reciprocal basis.

  • path_str (band-path string, e.g. 'G-M-K-G'.)

  • n_eigs (number of SC bands nearest sigma to unfold.)

  • sigma (shift-invert target energy (eV).)

  • nk_per_seg (k-points per linear sub-segment.)

  • n_workers (parallel workers for the k-point loop (1 = serial,) – -1 = all cores). Uses processes (backend), since ARPACK’s shift-invert solve is GIL-bound and does not parallelize under threads. Capped at this process’ core budget (its share of the node under mpirun; see PAOFLOW.utils.parallel_resources).

  • backend (joblib backend for the k-point loop (default 'loky').)

  • verbose (print progress.)

  • **eigsh_kwargs (extra arguments forwarded to eigsh (e.g. tol).)

Returns:

E_sc and W have shape (nk, n_eigs) and nawf_sc is set to n_eigs. Because only a window of bands is computed the completeness sum rule Σ_n W_n(k) = nawf_pc no longer holds globally, but each returned band’s weight is exact.

Return type:

UnfoldResult

PAOFLOW.models.band_unfold.plot_unfolded(result, *, y_lim=(-12, 6), w_thresh=0.02, cmap='Reds', figsize=(10, 6), title=None, show=True, ax=None)[source]#

Plot unfolded band structure.

Parameters:
  • result (UnfoldResult from unfold_bands().)

  • y_lim (energy window.)

  • w_thresh (minimum spectral weight to display.)

  • cmap (matplotlib colormap for scatter points.)

  • figsize (figure size if creating a new figure.)

  • title (plot title.)

  • show (call plt.show().)

  • ax (existing matplotlib Axes (optional).)

Return type:

fig, ax

PAOFLOW.models.band_unfold.FCC_SYM_POINTS[source]#
PAOFLOW.models.band_unfold.FCC_PATH = 'Γ-X-W-K-Γ-L-U-W-L-K|U-X'[source]#
PAOFLOW.models.band_unfold.BCC_SYM_POINTS[source]#
PAOFLOW.models.band_unfold.BCC_PATH = 'Γ-H-N-Γ-P-H|P-N'[source]#
PAOFLOW.models.band_unfold.HEX_SYM_POINTS[source]#
PAOFLOW.models.band_unfold.HEX_PATH = 'Γ-M-K-Γ-A-L-H-A|L-M|K-H'[source]#
PAOFLOW.models.band_unfold.CUB_SYM_POINTS[source]#
PAOFLOW.models.band_unfold.CUB_PATH = 'Γ-X-M-Γ-R-X|M-R'[source]#