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.

Note

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.

Tip

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

B vector shells and B vectors

Wannier.BVectorShellsType
BVectorShells

Shells 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 vector
  • kpoints: 3 * n_kpts, in fractional coordinates
  • bvectors: vectors of 3 * n_bvecs_per_shell, in cartesian coordinates
  • weights: vector of float, weights of each shell
  • multiplicities: number of bvectors in each shell
  • n_bvecs: total number of bvectors
source
Wannier.BVectorShellsMethod
BVectorShells(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 vector
  • kpoints: 3 * n_kpts, in fractional coordinates
  • bvectors: vectors of 3 * n_bvecs_per_shell, in cartesian coordinates
  • weights: vector of float, weights of each shell
source
Wannier.BVectorsType
BVectors

The bvectors for each kpoint.

Fields

  • recip_lattice: 3 * 3, each column is a reciprocal lattice vector
  • kpoints: 3 * n_kpts, in fractional coordinates
  • bvectors: 3 * n_bvecs, in cartesian coordinates
  • weights: n_bvecs, weights of each bvector
  • kpb_k: k+b vectors at kpoint k, k -> k + b (index of periodically equivalent kpoint inside recip_lattice)
  • kpb_b: 3 * n_bvecs * n_kpts, displacements between k + b and its periodic image inside recip_lattice, such that k+b = kpoints[:, kpb_k[ib, ik]] + kpb_b[:, ib, ik] (in fractional)
  • n_kpts: number of kpoints
  • n_bvecs: total number of bvectors
Note

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.

source
Wannier._bvec_to_kbMethod

Find equivalent kpoint and displacement vector of bvectors bvecs at kpoint k.

all inputs in fractional coordinates.

source
Wannier._sort_kbMethod

Sort bvectors specified by equivalent kpoint indices k and cell displacements b.

Sorting order:

  1. length of bvectors: nearest k+b goes first, this is achieved by comparing the norm bvecs_norm.
  2. supercell index: the supercell are already sorted by sort_supercell, which generates our input translations.
  3. 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

source
Wannier.are_parallelMethod
are_parallel(A, B; atol=1e-6)

Check if the columns of matrix A and columns of matrix B are parallel.

Arguments

  • A: matrix
  • B: matrix

Keyword Arguments

  • atol: tolerance to check parallelism
source
Wannier.check_b1Method
check_b1(shells::BVectorShells; atol=1e-6)

Check completeness (B1 condition) of BVectorShells.

Arguments

  • shells: BVectorShells containing bvectors in each shell

Keyword Arguments

  • atol: tolerance, equivalent to Wannier90 input parameter kmesh_tol
source
Wannier.compute_weightsMethod
compute_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 to Wannier90 input parameter kmesh_tol
source
Wannier.compute_weightsMethod
compute_weights(shells::BVectorShells; atol=1e-6)

Try to guess bvector weights from MV1997 Eq. (B1).

Arguments

  • shells: BVectorShells containing bvectors in each shell

Keyword Arguments

  • atol: tolerance to satisfy B1 condition, equivalent to Wannier90 input parameter kmesh_tol
source
Wannier.delete_parallelMethod
delete_parallel(shells::BVectorShells)

Remove shells having parallel bvectors.

Arguments

  • shells: BVectorShells containing bvectors in each shell
source
Wannier.delete_parallelMethod
delete_parallel(bvectors::Vector{Matrix{T}})

Remove shells having parallel bvectors.

Arguments

  • bvectors: vector of bvectors in each shell
source
Wannier.flatten_shellsMethod
flatten_shells(shells::BVectorShells)

Flatten shell vectors into a matrix.

Return a tuple of (bvecs, bvecs_weight), where

  • bvecs: 3 * n_bvecs
  • bvecs_weight: n_bvecs
source
Wannier.get_bvectorsMethod
get_bvectors(kpoints, recip_lattice; kmesh_tol=1e-6)

Generate and sort bvectors for all the kpoints.

Arguments

  • kpoints: 3 * n_kpts, kpoints in fractional coordinates
  • recip_lattice: 3 * 3, columns are reciprocal lattice vectors

Keyword Arguments

  • kmesh_tol: equivalent to Wannier90 input parameter kmesh_tol
source
Wannier.get_bvectors_nearestMethod
get_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 coordinates
  • recip_lattice: 3 * 3, columns are reciprocal lattice vectors

Keyword Arguments

  • kmesh_tol: equivalent to Wannier90 input parameter kmesh_tol
source
Wannier.index_bvectorMethod
index_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 at k1
  • kpb_b: 3 * n_bvecs * n_kpts, displacement vector for k+b bvectors at k1
  • k1: integer, index of kpoint k1
  • k2: integer, index of kpoint k2
  • b: vector of 3 integer, displacement vector from k1 to k2
source
Wannier.search_shellsMethod
search_shells(kpoints, recip_lattice; atol=1e-6, max_shells=36)

Search bvector shells satisfing B1 condition.

Arguments

  • kpoints: fractional coordinates
  • recip_lattice: each column is a reciprocal lattice vector

Keyword Arguments

  • atol: tolerance to select a shell (points having equal distances), equivalent to Wannier90 input parameter kmesh_tol.
  • max_shells: max number of nearest-neighbor shells, equivalent to Wannier90 input parameter search_shells.
source
Wannier.sort_bvectorsMethod
sort_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 to Wannier90 input parameter kmesh_tol
source
Wannier.sort_supercellMethod
sort_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_supercell matrix, in fractional coordinates
  • recip_lattice: each column is a reciprocal lattice vector

Keyword Arguments

  • atol: tolerance to compare bvectors, this is the same as what is hardcoded in Wannier90
Note

This is used to reproduce Wannier90 bvector order.

source