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
Wannier.RGridWannier.RGridWannier._get_unk_extWannier.cartesianize_xyzWannier.centerWannier.momentWannier.omegaWannier.originWannier.position_opWannier.read_realspace_wfWannier.read_realspace_wfWannier.read_realspace_wfWannier.read_realspace_wfWannier.span_vectorsWannier.write_realspace_wfWannier.write_realspace_wf
Real-space grid struct
Wannier.RGrid — Typestruct 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 * nzarray of fractional coordinate w.r.tbasis, the x coordinate of each point in the grid.Y:nx * ny * nzarray of fractional coordinate w.r.tbasis, the y coordinate of each point in the grid.Z:nx * ny * nzarray of fractional coordinate w.r.tbasis, the z coordinate of each point in the grid.
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.
Wannier.RGrid — MethodRGrid(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 coordinatesX:nxvector of fractional coordinate w.r.tbasis, the x coordinate of each point in the grid.Y:nyvector of fractional coordinate w.r.tbasis, the y coordinate of each point in the grid.Z:nzvector of fractional coordinate w.r.tbasis, the z coordinate of each point in the grid.
Wannier.cartesianize_xyz — Methodcartesianize_xyz(rgrid::RGrid)Return X, Y, Z in cartesian coordinates.
The size of the returned X, Y, and Z are nx * ny * nz.
Wannier.origin — Methodorigin(rgrid::RGrid)Get the origin in cartesian coordinates, i.e. the 1st point, of the RGrid.
Wannier.span_vectors — Methodspan_vectors(rgrid::RGrid)Get the spanning vectors of the RGrid.
Each column in the returned matrix is a spanning vector.
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.
Read/write real-space WFs
Wannier._get_unk_ext — Method_get_unk_ext(unkdir::AbstractString)Get the extension name of UNK files.
For example:
1ofUNK00001.1, for no-spin calcluationNCofUNK00001.NC, for non-collinear calculation
Wannier.read_realspace_wf — Methodread_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 matrixkpoints:3 * n_kpts, each column is a vector for fractional coordinatesn_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 livesunkdir: folder containingUNKfiles
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$
See also the section Normalization convention of WFs for further explanation.
Wannier.read_realspace_wf — Methodread_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 vectorU:n_bands * n_wann * n_kpts, gauge rotation matrix
Wannier.read_realspace_wf — Methodread_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: aModelU:n_bands * n_wann * n_kpts, gauge rotation matrix
Wannier.read_realspace_wf — Methodread_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: aModel
Wannier.write_realspace_wf — Methodwrite_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 forcubefiles, e.g.,seedname_00001.cubeU: gauge rotation matrixkpoints: each column is a kpoint, fractional coordinateslattice: each column is a lattice vectoratom_positions: each column is an atom position, fractional coordinates w.r.t. latticeatom_labels: each element is an atom label
Keyword arguments
n_supercells: number of supercells in each direction, equivalent towannier_plot_supercellofWannier90unkdir: directory ofUNKfilespart: which part to plot? pass aFunction, e.g.real,imag,abs2format::xsfor:cubewf_center: WF centers in fractional coordinates w.r.t. lattice. Only used forcubeformat, add additional atoms around WF centers.
Wannier90 only plot the real part of WFs, so part=real is the default.
See also the section Normalization convention of WFs for further explanation.
Wannier.write_realspace_wf — Methodwrite_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.
Evaluate operators in real space
Wannier.center — Methodcenter(rgrid::RGrid, W::AbstractArray)Compute WF center in real space.
Returned value in Cartesian coordinates.
See also moment.
Wannier.moment — Methodmoment(rgrid::RGrid, W::AbstractArray, n)Compute WF moment to arbitrary order in real space.
Arguments
rgrid: real space grid on whichWis definedW: WFs,nx * ny * nz * n_wann, ornx * ny * nzfor single WFn: order of moment, e.g., 1 for WF center, 2 for variance, etc.
Returned value in Cartesian coordinates.
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.
Wannier.omega — Methodomega(rgrid::RGrid, W::AbstractArray)Compute WF spread in real space.
Returned value in Å^2 unit.
See also moment.
Wannier.position_op — Methodposition_op(rgrid::RGrid, W::AbstractArray{T,4})Compute position operator matrices in real space.
Returned value in Cartesian coordinates.
See also center.