PAOFLOW.topology.do_find_Weyl#
Attributes#
Functions#
|
Pack one spin channel of |
|
Fourier-transform the packed |
|
Fourier-transform the packed |
|
Compute band eigenvalues for one or many k-points. |
|
Return the direct band gap at k-point |
|
Flag the search boxes that can plausibly contain a band crossing. |
|
Build the real-space R-grid corresponding to an FFT supercell. |
|
Generate a uniform 3-D search grid in fractional BZ coordinates. |
|
Locate and classify Weyl points in the Brillouin zone. |
|
Find band-gap minima across the BZ using local optimisation. |
|
Expand a set of k-points to all symmetry-equivalent images. |
Module Contents#
- PAOFLOW.topology.do_find_Weyl.pack_HR(HRaux, ispin=0)[source]#
Pack one spin channel of
H(R)into a contiguous matrix for BLAS.- Parameters:
HRaux (ndarray, shape
(nawf, nawf, nR, nspin), complex) – Real-space Hamiltonian on the R-grid in crystal coordinates.ispin (int, optional) – Spin channel to extract (default
0).
- Returns:
C-contiguous packing of the requested spin channel. For
nspin == 1this is a view and no data is copied.- Return type:
ndarray, shape
(nawf*nawf, nR), complex
Notes
In this layout the Fourier sum over
Ris a single matrix-vector (or matrix-matrix) product. Slicing the spin axis of the original(nawf, nawf, nR, nspin)array yields a strided view, which forces NumPy to copy the whole Hamiltonian on every contraction; packing once here removes that copy from the optimisation loop.
- PAOFLOW.topology.do_find_Weyl.build_Hk(HRpack, nawf, kq, R)[source]#
Fourier-transform the packed
H(R)toH(k)at a single k-point.- Parameters:
HRpack (ndarray, shape
(nawf*nawf, nR), complex) – Packed Hamiltonian frompack_HR().nawf (int) – Dimension of the Hamiltonian matrix.
kq (ndarray, shape
(3,), float) – k-point in crystal (fractional) coordinates.R (ndarray, shape
(nR, 3), float) – Real-space lattice vectors produced byget_R_grid_fft().
- Returns:
The Hamiltonian at
kq.- Return type:
ndarray, shape
(nawf, nawf), complex
Notes
\[H(\mathbf{k}) = \sum_{\mathbf{R}} H(\mathbf{R})\,e^{2\pi i\mathbf{k}\cdot\mathbf{R}}\]The dot product \(\mathbf{k}\cdot\mathbf{R}\) is accumulated in real arithmetic before exponentiation, and the R-sum is a single
ZGEMVcall with no temporaries.
- PAOFLOW.topology.do_find_Weyl.build_Hk_batch(HRpack, nawf, kq, R)[source]#
Fourier-transform the packed
H(R)toH(k)for a block of k-points.- Parameters:
- Returns:
The Hamiltonian at each k-point.
- Return type:
ndarray, shape
(nk, nawf, nawf), complex
Notes
Identical to
build_Hk()but evaluates the R-sum as a singleZGEMM. The one-k-point kernel is memory-bandwidth bound (it streams the whole Hamiltonian for \(\mathcal{O}(n_{awf}^2 n_R)\) flops), so amortising that traffic over a block of k-points is much faster per point.
- PAOFLOW.topology.do_find_Weyl.band_energies(HRpack, nawf, kq, R)[source]#
Compute band eigenvalues for one or many k-points.
- Parameters:
- Returns:
Eigenvalues in ascending order, Hermitian upper triangle.
- Return type:
ndarray, shape
(nk, nawf), float
Notes
k-points are processed in blocks sized to keep the batched Hamiltonian below roughly 16 MB.
- PAOFLOW.topology.do_find_Weyl.get_gap(HRpack, nawf, kq, R, nelec)[source]#
Return the direct band gap at k-point
kqbetween bandsnelec-1andnelec.This is the scalar objective function minimised by
find_min()to locate Weyl (band-crossing) points. A gap of zero indicates a band-touching or crossing.- Parameters:
HRpack (ndarray, shape
(nawf*nawf, nR), complex) – Packed Hamiltonian frompack_HR().nawf (int) – Dimension of the Hamiltonian matrix.
kq (ndarray, shape
(3,), float) – k-point in crystal (fractional) coordinates.R (ndarray, shape
(nR, 3), float) – Real-space lattice vectors.nelec (int) – Number of occupied bands; the gap is evaluated between band index
nelec - 1(HOMO) andnelec(LUMO).
- Returns:
Energy difference
E[nelec] - E[nelec - 1]atkq.- Return type:
Notes
Only the first spin channel is built, since the gap is defined on
ispin = 0.
- PAOFLOW.topology.do_find_Weyl.screen_boxes(HRpack, nawf, R, nelec, lo, hi, factor=2.0)[source]#
Flag the search boxes that can plausibly contain a band crossing.
- Parameters:
HRpack (ndarray, shape
(nawf*nawf, nR), complex) – Packed Hamiltonian frompack_HR().nawf (int) – Dimension of the Hamiltonian matrix.
R (ndarray, shape
(nR, 3), float) – Real-space lattice vectors.nelec (int) – Number of occupied bands.
lo (ndarray, shape
(nbox, 3), float) – Lower and upper corners of each search box, in crystal coordinates.hi (ndarray, shape
(nbox, 3), float) – Lower and upper corners of each search box, in crystal coordinates.factor (float, optional) – Safety margin on the gap-variation bound (default
2.0). Larger values keep more boxes.
- Returns:
Truefor boxes that must be handed to the optimiser.- Return type:
ndarray, shape
(nbox,), bool
Notes
The gap is sampled on a 9-point stencil (centre plus the eight corners) of every box in a single batched evaluation; adjacent boxes share corners, so the stencil is de-duplicated first. A box is discarded when its smallest sampled gap exceeds
factortimes the largest gap variation observed across the box, i.e. when a linear (Lipschitz) extrapolation of the sampled slope cannot reach zero inside the box. This is a heuristic, not a proof: it assumes the gap does not develop structure finer than the box on which it is sampled. Passfactor <= 0infind_min()to disable.
- PAOFLOW.topology.do_find_Weyl.get_R_grid_fft(nr1, nr2, nr3)[source]#
Build the real-space R-grid corresponding to an FFT supercell.
Generates all
nr1 * nr2 * nr3lattice vectors in fractional coordinates and folds them into the centred interval[-0.5, 0.5)so that the Fourier sums converge correctly with the PAOFLOW convention.- Parameters:
- Returns:
R – Lattice vectors in units of the corresponding primitive vectors, ordered as
k + j*nr3 + i*nr2*nr3.- Return type:
ndarray, shape (nr1 * nr2 * nr3, 3)
- PAOFLOW.topology.do_find_Weyl.get_search_grid(nk1, nk2, nk3, snk1_range=[-0.5, 0.5], snk2_range=[-0.5, 0.5], snk3_range=[-0.5, 0.5], endpoint=False)[source]#
Generate a uniform 3-D search grid in fractional BZ coordinates.
Creates a full-factorial mesh with
nk1 * nk2 * nk3points by taking the outer product of threenp.linspacearrays and reshaping to a flat list of k-vectors. These grid points are used as the lower bounds of the optimisation boxes infind_min().- Parameters:
nk1 (int) – Number of grid points along each reciprocal direction.
nk2 (int) – Number of grid points along each reciprocal direction.
nk3 (int) – Number of grid points along each reciprocal direction.
snk1_range (list of float, optional) –
[start, stop]range for each direction. Default is the full first Brillouin zone[-0.5, 0.5].snk2_range (list of float, optional) –
[start, stop]range for each direction. Default is the full first Brillouin zone[-0.5, 0.5].snk3_range (list of float, optional) –
[start, stop]range for each direction. Default is the full first Brillouin zone[-0.5, 0.5].endpoint (bool, optional) – If
False(default), the stop value is excluded, matching the Monkhorst–Pack convention and avoiding zone-boundary duplication.
- Returns:
grid – Cartesian product of the three 1-D grids, ordered with the first index varying slowest (
indexing='ij').- Return type:
ndarray, shape (nk1 * nk2 * nk3, 3)
- PAOFLOW.topology.do_find_Weyl.find_weyl(data_controller, test_rad, search_grid)[source]#
Locate and classify Weyl points in the Brillouin zone.
Orchestrates the full Weyl-point search workflow:
Calls
find_min()to minimise the band gap over a coarse search grid and collect band-touching candidates.If symmetry is enabled (
attr['symmetrize']), expands candidates to all symmetry-equivalent k-points viaget_equiv_k().Optionally uses
z2packto compute the Chern number on a small sphere around each candidate; points with non-zero Chern number are confirmed as Weyl points. Ifz2packis unavailable, chirality is recorded as'?'. The candidates are distributed over the MPI ranks, each of which builds its owntbmodelsmodel fromhamiltonian.dat.Writes a summary table to
weyl_points.datinattr['opath'].
- Parameters:
data_controller (DataController) – Provides
HRs,sym_rot,b_vectors,sym_TR,nelec,symmetrize,verbose,dftMAG,dftSO,alat,opath. The optional attributeweyl_screen_factor(default2.0) tunes the box screening ofscreen_boxes(); set it to0to disable.test_rad (float) – Radius (in fractional BZ units) of the
z2packChern-number sphere. Currently unused: the radius is fixed at0.005.search_grid (list of int, length 3) –
[nk1, nk2, nk3]number of cells to divide the BZ into for the initial coarse gap-minimisation search.
- Returns:
None – Writes
weyl_points.dattoattr['opath']on rank0.Output files (written to
opath)————————————
weyl_points.dat– Formatted table with columns: index, Cartesian k-coordinates in units of2π/alat, Chern number, and energy.
- PAOFLOW.topology.do_find_Weyl.find_min(HRpack, nawf, nelec, R, symf, verbose, search_grid=[8, 8, 8], screen_factor=2.0)[source]#
Find band-gap minima across the BZ using local optimisation.
Divides the first BZ into
nk1 * nk2 * nk3rectangular boxes and runs anL-BFGS-Bminimisation ofget_gap()inside each box, with the box centre as the initial guess. The BZ boxes are distributed across MPI ranks for parallelism; partial results are collected withgather_full().Boxes are first screened with
screen_boxes(), which samples the gap on a batched 9-point stencil and skips boxes that cannot reach zero; this removes the great majority of the optimiser calls.On rank 0, candidates with a gap smaller than
1e-5are retained. If symmetry is enabled (symf), they are further de-duplicated by sorting on energy and removing entries with identical energies (to4decimal places), leaving only symmetry-inequivalent Weyl points.- Parameters:
HRpack (ndarray, shape
(nawf*nawf, nR), complex) – Packed Hamiltonian frompack_HR().nawf (int) – Dimension of the Hamiltonian matrix.
nelec (int) – Number of occupied bands; gap is
E[nelec] - E[nelec-1].R (ndarray, shape (nR, 3)) – Real-space lattice vectors from
get_R_grid_fft().symf (bool) – If
True, de-duplicate candidates using energy degeneracy.verbose (bool) – Print intermediate candidate information to stdout.
search_grid (list of int, optional) –
[nk1, nk2, nk3]subdivision of the BZ. Default[8, 8, 8].screen_factor (float, optional) – Safety margin passed to
screen_boxes(). Values<= 0disable screening and optimise inside every box.
- Returns:
candidates (ndarray, shape (nc, 3) or
Noneon non-root ranks) – k-coordinates (fractional) of the band-touching candidates.ene (ndarray, shape (nc,) or
Noneon non-root ranks) – Energy at the LUMO band for each candidate.
- PAOFLOW.topology.do_find_Weyl.get_equiv_k(kp, symop, sym_TR, mag_soc)[source]#
Expand a set of k-points to all symmetry-equivalent images.
Applies each space-group rotation
symop[isym](and optionally its time-reversal partner-k) to every k-point inkp, then de-duplicates the result to return only unique images within the first BZ (folded to[-0.5, 0.5)).Time-reversal symmetry adds the set
{-k}unless the system is a magnetic SOC calculation (mag_soc = dftMAG and dftSO).- Parameters:
kp (ndarray, shape (nc, 3)) – Input k-points in crystal (fractional) coordinates.
symop (ndarray, shape (nsym, 3, 3)) – Rotation matrices of the crystal point group.
sym_TR (ndarray of bool, shape (nsym,)) –
Truefor operations that include time reversal (i.e. act ask' = -R k).mag_soc (bool) –
Truewhen bothdftMAGanddftSOare active; disables the automatic{-k}extension.
- Returns:
newk_tot – All unique symmetry-equivalent k-points, rounded to
4decimal places.- Return type:
ndarray, shape (nu, 3)