Real space WFs

This page lists functions for processing WFs in real space.

Normally operators are computed in reciprocal space, but sometimes it might be useful to evaluate them in real space. For example, computing higher moment of WFs.

Contents

Index

Real-space grid struct

Wannier.RGridType
struct RGrid(basis, X, Y, Z)

Represents a regular grid of points.

Fields

  • basis: each column is a basis vector of the grid, usually just the lattice vectors.
  • X: nx * ny * nz array of fractional coordinate w.r.t basis, the x coordinate of each point in the grid.
  • Y: nx * ny * nz array of fractional coordinate w.r.t basis, the y coordinate of each point in the grid.
  • Z: nx * ny * nz array of fractional coordinate w.r.t basis, the z coordinate of each point in the grid.
Tip

The X, Y, and Z are usually generated by LazyGrids.ndgrid. They are fractional and can be outside of [0, 1), so the basis are not necessarily the spanning vectors of the grid. See also origin and span_vectors.

Usually the grid does not contain the periodically repeated points, e.g., the x coordinate can be [0.0, 0.25, 0.5, 0.75] without 1.0 which is repeatition of 0.0.

source
Wannier.RGridMethod
RGrid(basis, origin, X, Y, Z)

Construct a regular grid of points.

Arguments

  • basis: each column is a basis vector of the grid, usually just the lattice vectors.
  • origin: 3, origin of the grid in cartesian coordinates
  • X: nx vector of fractional coordinate w.r.t basis, the x coordinate of each point in the grid.
  • Y: ny vector of fractional coordinate w.r.t basis, the y coordinate of each point in the grid.
  • Z: nz vector of fractional coordinate w.r.t basis, the z coordinate of each point in the grid.
source
Wannier.cartesianize_xyzMethod
cartesianize_xyz(rgrid::RGrid)

Return X, Y, Z in cartesian coordinates.

The size of the returned X, Y, and Z are nx * ny * nz.

source
Wannier.originMethod
origin(rgrid::RGrid)

Get the origin in cartesian coordinates, i.e. the 1st point, of the RGrid.

source
Wannier.span_vectorsMethod
span_vectors(rgrid::RGrid)

Get the spanning vectors of the RGrid.

Each column in the returned matrix is a spanning vector.

Note

There is no limit constraint on the fractional coordinates X, Y, and Z, so the spanning vectors are not necessarily the basis vectors, they can be fractional of the basis vectors, or multiple times of that.

source

Read/write real-space WFs

Wannier._get_unk_extMethod
_get_unk_ext(unkdir::AbstractString)

Get the extension name of UNK files.

For example:

  • 1 of UNK00001.1, for no-spin calcluation
  • NC of UNK00001.NC, for non-collinear calculation
source
Wannier.calc_dipoleMethod

Calculates the dipole term between two wavefunctions. Make sure the wavefunctions are normalized!

source
Wannier.read_realspace_wfMethod
read_realspace_wf(lattice, U, kpoints, n_supercells=2, unkdir="."; R=[0, 0, 0])

Read UNK files, rotate gauge, and generate real space WFs.

This is a more user-friendly version, which returns a tuple of (RGrid, W), where RGrid is the grid on which W is defined, and W is volumetric data for WFs.

Arguments

  • lattice: each column is a lattice vector
  • U: n_bands * n_wann * n_kpts, gauge rotation matrix
source
Wannier.read_realspace_wfMethod
read_realspace_wf(U, kpoints, n_supercells, unkdir="."; R=[0, 0, 0])

Read UNK files, rotate gauge, and generate real space WFs.

Arguments

  • U: n_bands * n_wann * n_kpts, gauge rotation matrix
  • kpoints: 3 * n_kpts, each column is a vector for fractional coordinates
  • n_supercells: an integer or a vector of 3 integers for 3 directions along lattice vectors, defines the number of super cells where the real space WF lives
  • unkdir: folder containing UNK files

Keyword arguments

  • R: fractional coordinates w.r.t lattice (actually integers), the cell for WF $|n \bm{R} \rangle$, default is generating WF at home unit cell $|n \bm{0} \rangle$
Tip

See also the section Normalization convention of WFs for further explanation.

source
Wannier.read_realspace_wfMethod
read_realspace_wf(model, U, n_supercells=2, unkdir="."; R=[0, 0, 0])

Read UNK files, rotate gauge, and generate real space WFs.

This is a most user-friendly version, use lattice, U and kpoints from model and returns a tuple of (RGrid, W), where RGrid is the grid on which W is defined, and W is volumetric data for WFs.

Arguments

  • model: a Model
  • U: n_bands * n_wann * n_kpts, gauge rotation matrix
source
Wannier.read_realspace_wfMethod
read_realspace_wf(model, n_supercells=2, unkdir="."; R=[0, 0, 0])

Read UNK files, rotate gauge, and generate real space WFs.

This is a most user-friendly version, use lattice, U and kpoints from model and returns a tuple of (RGrid, W), where RGrid is the grid on which W is defined, and W is volumetric data for WFs.

Arguments

  • model: a Model
source
Wannier.write_realspace_wfMethod
write_realspace_wf(seedname, U, kpoints, lattice, atom_positions, atom_labels;
    n_supercells=2, unkdir=".", part=real, format=:xsf, wf_center=nothing)

Write real space WFs to xsf or cube files.

Arguments

  • seedname: the name prefix for cube files, e.g., seedname_00001.cube
  • U: gauge rotation matrix
  • kpoints: each column is a kpoint, fractional coordinates
  • lattice: each column is a lattice vector
  • atom_positions: each column is an atom position, fractional coordinates w.r.t. lattice
  • atom_labels: each element is an atom label

Keyword arguments

  • n_supercells: number of supercells in each direction, equivalent to wannier_plot_supercell of Wannier90
  • unkdir: directory of UNK files
  • part: which part to plot? pass a Function, e.g. real, imag, abs2
  • format: :xsf or :cube
  • wf_center: WF centers in fractional coordinates w.r.t. lattice. Only used for cube format, add additional atoms around WF centers.
Note

Wannier90 only plot the real part of WFs, so part=real is the default.

Tip

See also the section Normalization convention of WFs for further explanation.

source
Wannier.write_realspace_wfMethod
write_realspace_wf(seedname, model; n_supercells=2, unkdir=".", part=real, format=:xsf)

Write real space WFs to xsf or cube files.

This is a user-friendly version that use model to fill the arguments of write_realspace_wf.

source

Evaluate operators in real space

Wannier.centerMethod
center(rgrid::RGrid, W::AbstractArray)

Compute WF center in real space.

Returned value in Cartesian coordinates.

See also moment.

source
Wannier.momentMethod
moment(rgrid::RGrid, W::AbstractArray, n)

Compute WF moment to arbitrary order in real space.

Arguments

  • rgrid: real space grid on which W is defined
  • W: WFs, nx * ny * nz * n_wann, or nx * ny * nz for single WF
  • n: order of moment, e.g., 1 for WF center, 2 for variance, etc.

Returned value in Cartesian coordinates.

Note

The WFs are defined in a supercell that is n_kpts times unit cell, however, usually we only calculate realspace WFs in a smaller supercell that is 2^3 or 3^3 times unit cell (as defined by the n_supercells argument of read_realspace_wf). Some times this is not sufficient if the WFs are truncated by the boundries of the smaller supercell, thus the center calculated by this function is inexact. In principle, we should calculate centers in the n_kpts supercell, however, this is memory-consuming.

source
Wannier.omegaMethod
omega(rgrid::RGrid, W::AbstractArray)

Compute WF spread in real space.

Returned value in Å^2 unit.

See also moment.

source
Wannier.position_opMethod
position_op(rgrid::RGrid, W::AbstractArray{T,4})

Compute position operator matrices in real space.

Returned value in Cartesian coordinates.

See also center.

source