B vector
The $\bm{b}$-vectors connect kpoint $\bm{k}$ to its neighboring kpoints $\bm{k}+\bm{b}$, for calculating WF centers, spreads in reciprocal space.
The bvectors are first arranged in layers of shells, which contain bvectors having same norm. Then parallel shells are deleted, and the shells satisfying B1 condition are the final bvectors. At last, the bvectors are sorted at each kpoint, to reproduce exactly the same order as Wannier90. This ensures that we have the same order as mmn file.
To reproduce the same order as Wannier90, we need to be careful with some floating point comparison, i.e., the atol keyword arguments in the following functions. Their default value reproduce the Wannier90 order. Note the kmesh_tol in the win file also influence the search of bvectors.
In most cases, the user only need to call get_bvectors to generate bvectors having the same order as Wannier90. Other functions are intermediate steps that are called inside get_bvectors.
Contents
Index
Wannier.BVectorShellsWannier.BVectorShellsWannier.BVectorsWannier._bvec_to_kbWannier._sort_kbWannier.are_parallelWannier.check_b1Wannier.compute_weightsWannier.compute_weightsWannier.delete_parallelWannier.delete_parallelWannier.flatten_shellsWannier.get_bvectorsWannier.get_bvectors_nearestWannier.index_bvectorWannier.search_shellsWannier.sort_bvectorsWannier.sort_supercell
B vector shells and B vectors
Wannier.BVectorShells — TypeBVectorShellsShells of bvectors.
The bvectors are sorted by norm such that equal-norm bvectors are grouped into one shell.
Fields
recip_lattice:3 * 3, each column is a reciprocal lattice vectorkpoints:3 * n_kpts, in fractional coordinatesbvectors: vectors of3 * n_bvecs_per_shell, in cartesian coordinatesweights: vector of float, weights of each shellmultiplicities: number of bvectors in each shelln_bvecs: total number of bvectors
Wannier.BVectorShells — MethodBVectorShells(recip_lattice, kpoints, bvectors, weights)Constructor of BVectorShells.
Only essential arguments are required, remaing fields of BVectorShells are initialized accordingly. This should be used instead of directly constructing BVectorShells.
Arguments
recip_lattice:3 * 3, each column is a reciprocal lattice vectorkpoints:3 * n_kpts, in fractional coordinatesbvectors: vectors of3 * n_bvecs_per_shell, in cartesian coordinatesweights: vector of float, weights of each shell
Wannier.BVectors — TypeBVectorsThe bvectors for each kpoint.
Fields
recip_lattice:3 * 3, each column is a reciprocal lattice vectorkpoints:3 * n_kpts, in fractional coordinatesbvectors:3 * n_bvecs, in cartesian coordinatesweights:n_bvecs, weights of each bvectorkpb_k: k+b vectors at kpointk,k->k + b(index of periodically equivalent kpoint insiderecip_lattice)kpb_b:3 * n_bvecs * n_kpts, displacements between k + b and its periodic image insiderecip_lattice, such that k+b =kpoints[:, kpb_k[ib, ik]] + kpb_b[:, ib, ik](in fractional)n_kpts: number of kpointsn_bvecs: total number of bvectors
In principle, we don't need to sort the bvectors for each kpoint, so that the bvectors have the same order as each kpoint. However, since Wannier90 sort the bvectors, and the mmn file is written in that order, so we also sort in the same order as Wannier90.
Wannier._bvec_to_kb — MethodFind equivalent kpoint and displacement vector of bvectors bvecs at kpoint k.
all inputs in fractional coordinates.
Wannier._sort_kb — MethodSort bvectors specified by equivalent kpoint indices k and cell displacements b.
Sorting order:
- length of bvectors: nearest k+b goes first, this is achieved by comparing the norm
bvecs_norm. - supercell index: the supercell are already sorted by
sort_supercell, which generates our inputtranslations. - index of kpoint: the smaller index goes first, dictated by the input
kpoints.
bvecs_norm: length of bvectors, cartesian norm. k: index in kpoints for equivalent kpoint of bvectors b: cell displacements of bvectors, fractional coordinates translations: of supercell, fractional coordinates
Wannier.are_parallel — Methodare_parallel(A, B; atol=1e-6)Check if the columns of matrix A and columns of matrix B are parallel.
Arguments
A: matrixB: matrix
Keyword Arguments
atol: tolerance to check parallelism
Wannier.check_b1 — Methodcheck_b1(shells::BVectorShells; atol=1e-6)Check completeness (B1 condition) of BVectorShells.
Arguments
shells:BVectorShellscontaining bvectors in each shell
Keyword Arguments
atol: tolerance, equivalent toWannier90input parameterkmesh_tol
Wannier.compute_weights — Methodcompute_weights(bvectors::Vector{Matrix{T}}; atol=1e-6)Try to guess bvector weights from MV1997 Eq. (B1).
The input bvectors are overcomplete vectors found during shell search, i.e. from search_shells. This function tries to find the minimum number of bvector shells that satisfy the B1 condition, and return the new BVectorShells and weights.
Arguments
bvectors: vector of bvectors in each shell
Keyword Arguments
atol: tolerance to satisfy B1 condition, equivalent toWannier90input parameterkmesh_tol
Wannier.compute_weights — Methodcompute_weights(shells::BVectorShells; atol=1e-6)Try to guess bvector weights from MV1997 Eq. (B1).
Arguments
shells:BVectorShellscontaining bvectors in each shell
Keyword Arguments
atol: tolerance to satisfy B1 condition, equivalent toWannier90input parameterkmesh_tol
Wannier.delete_parallel — Methoddelete_parallel(shells::BVectorShells)Remove shells having parallel bvectors.
Arguments
shells:BVectorShellscontaining bvectors in each shell
Wannier.delete_parallel — Methoddelete_parallel(bvectors::Vector{Matrix{T}})Remove shells having parallel bvectors.
Arguments
bvectors: vector of bvectors in each shell
Wannier.flatten_shells — Methodflatten_shells(shells::BVectorShells)Flatten shell vectors into a matrix.
Return a tuple of (bvecs, bvecs_weight), where
bvecs:3 * n_bvecsbvecs_weight:n_bvecs
Wannier.get_bvectors — Methodget_bvectors(kpoints, recip_lattice; kmesh_tol=1e-6)Generate and sort bvectors for all the kpoints.
Arguments
kpoints:3 * n_kpts, kpoints in fractional coordinatesrecip_lattice:3 * 3, columns are reciprocal lattice vectors
Keyword Arguments
kmesh_tol: equivalent toWannier90input parameterkmesh_tol
Wannier.get_bvectors_nearest — Methodget_bvectors_nearest(kpoints, recip_lattice; kmesh_tol=1e-6)Generate and sort bvectors for all the kpoints.
Arguments
kpoints:3 * n_kpts, kpoints in fractional coordinatesrecip_lattice:3 * 3, columns are reciprocal lattice vectors
Keyword Arguments
kmesh_tol: equivalent toWannier90input parameterkmesh_tol
Wannier.index_bvector — Methodindex_bvector(kpb_k, kpb_b, k1, k2, b)Given bvector b connecting kpoints k1 and k2, return the index of the bvector ib.
This is a reverse search of bvector index if you only know the two kpoints k1 and k2, and the connecting displacement vector b.
Arguments
kpb_k:n_bvecs * n_kpts, k+b kpoints atk1kpb_b:3 * n_bvecs * n_kpts, displacement vector for k+b bvectors atk1k1: integer, index of kpointk1k2: integer, index of kpointk2b: vector of 3 integer, displacement vector fromk1tok2
Wannier.search_shells — Methodsearch_shells(kpoints, recip_lattice; atol=1e-6, max_shells=36)Search bvector shells satisfing B1 condition.
Arguments
kpoints: fractional coordinatesrecip_lattice: each column is a reciprocal lattice vector
Keyword Arguments
atol: tolerance to select a shell (points having equal distances), equivalent toWannier90input parameterkmesh_tol.max_shells: max number of nearest-neighbor shells, equivalent toWannier90input parametersearch_shells.
Wannier.sort_bvectors — Methodsort_bvectors(shells::BVectorShells; atol=1e-6)Sort bvectors in shells at each kpoints, to be consistent with Wannier90.
Wannier90 use different order of bvectors at each kpoint, in principle, this is not needed. However, the mmn file is written in such order, so we need to sort bvectors and calculate weights, since nnkp file has no section of weights.
Arguments
shells:BVectorShells
Keyword Arguments
atol: equivalent toWannier90input parameterkmesh_tol
Wannier.sort_supercell — Methodsort_supercell(translations, recip_lattice; atol=1e-8)Sort supercell to fix the order of bvectors.
Both input and output translations are in fractional coordinates.
Arguments
translations:3 * n_supercellmatrix, in fractional coordinatesrecip_lattice: each column is a reciprocal lattice vector
Keyword Arguments
atol: tolerance to compare bvectors, this is the same as what is hardcoded inWannier90
This is used to reproduce Wannier90 bvector order.