Questaal Home
Navigation

The Wannier-90 interface

Summary

lmf --w90 — Wannier functions via the Wannier90 library

Sun 26 Jul 17:33:35 BST 2026

Computes the overlap matrices M_mn^{k,b} and the projections A_mn^{k} in the FP-LMTO basis and drives the Wannier90 library to produce maximally-localised Wannier functions.

Use

lmf --nosym --w90~proj=1,0~proj=1,1~win=-15,2.8~nb=4~quit <ext>
OptionTypeDefaultMeaning
proj=ib,lint,int—Trial orbitals: all 2l+1 partial waves of angular momentum l at site ib. Repeatable.
proj=ib,l,mint,int,int—As above but a single m, in Questaal’s real-harmonic order ilm = l²+l+m+1. For l=2: m = -2,-1,0,+1,+2 = xy, yz, 3z²-r², zx, x²-y², so with cubic axes t₂g is m = -2,-1,+1 and e_g is m = 0,+2.
nb=#intall bandsPass only the lowest # bands as num_bands. Fewer bands makes disentanglement much cheaper.
win=#,#real,realwhole spectrumOuter energy window for disentanglement, eV (Wannier90 dis_win_min/dis_win_max).
froz=[#,]#real[,real]noneInner (frozen) window, eV (Wannier90 dis_froz_max, plus dis_froz_min when two values are given): froz=max or froz=min,max. States within it are kept exactly. num_wann must be at least the number of frozen states at every k.
pdwfflagoffDisentangle by projectability instead of energy (Wannier90 dis_froz_proj): at every k a state is frozen when its projection onto the initial guess exceeds the upper threshold and discarded below the lower one, the thresholds found automatically (dis_proj_auto). Replaces froz=. Limit the bands with nb=: Wannier90 rejects a projectability above 1, which the one-centre expansion of lmf gives for bands far above the linearisation energies, whether or not win= excludes them.
spin=#int1Spin channel to wannierise. One Wannier calculation per run; rerun for the other. Collinear only: with SO=1 the spins are coupled, one run covers both, and spin=2 is refused.
nit=#int100Wannier90 num_iter.
nitd=#int200Wannier90 dis_num_iter.
l3mx=#int6Truncation of the Rayleigh expansion of exp(-i b·r) in the spheres. Convergence is governed by \|b\|·rmt (not lmxa); 6 is generous.
gmax=#realHAM_GMAXG cutoff for the envelope plane-wave expansion, a.u.
dumpflagoffHave Wannier90 write w90.mmn_dump, w90.amn_dump, w90.eig_dump and the Wannier90 input file w90.win_dump (these must be renamed to remove the _dump suffix).
syml[=fn]flag[=string]offInterpolate the Wannier bands along the path of symmetry-lines file fn.ext, syml.ext when no name is given (Cartesian q in units of 2π/alat, optional labels A to B naming the special points, ? where absent, as --band~fn=): Wannier90 writes w90_band.dat and friends on the same k list that lmf --band evaluates.
checkflagoffVerify the parity invariant while assembling Omega, and report the closure sum_n \|M_mn\|² band by band.
bzeroflagoffAssemble M at b=0 and report max\|M-I\|, then stop (see below).
wspinorflagoffWrite the spin matrix <psi_ik\|sigma\|psi_jk> to w90.spn. SO=1 only; see the spin–orbit section.
randflagoffReplace the projections by random ones.
cube[=n1,n2,n3]int,int,int3,3,3Write each Wannier function as a Gaussian cube file; see the real-space section.
h5[=n1,n2,n3]int,int,int3,3,3As cube, in the BSE plotter’s hdf5 layout.
quitflagoffStop after the Wannier functions are made.

num_wann is not an option: it is the length of the projector list (doubled under SO=1; see the spin–orbit section below).

Notes

  • LMTO basis only.
  • Collinear and SO=1 (spinor) cases (perturbative SO, SO=3,4, modes are refused).
  • Full BZ required; run with --nosym.
  • Atom-centred projections only.
  • Local orbitals are not handled (the (phi,phidot) pair is taken as complete).

Parallel execution

Under MPI the Wannier step is k-parallel over lmf’s k-groups (the across-k row of the process grid, --pmesh): each rank assembles M, A and the diagnostics for the contiguous block of k it already holds from the band pass, and the Wannier90 library is driven on that row’s communicator with the same distribution (distk). Output, including w90.spn, comes from rank 0. w90.spn is gauge-dependent within Kramers pairs, so it reproduces a serial run byte for byte only when the eigenvectors do: the same BLAS thread count on both runs (OMP_NUM_THREADS=1). Rows of the grid beyond the first (na > 1) hold replicas of every k and stay idle. The _dump images are gathered from every k-group.

Implementation: src/fp/w90fp.F90, called from bndfp.f. Wannier90 v4.0.3 or later (library name wannier90) is an optional dependency in the manner of libxc/spglib: configure with wannier90[=PATH] (a wannier90 checkout or install prefix, or set WANNIER90_LIB/WANNIER90_INC); without it --w90 reports that lmf was built without the library.

Overlap matrices:

M_mn^{k,b} = <u_mk | u_n,k+b> = M_I + sum_a ( M1_a - M2_a )
  • M_I — the smooth envelope over the whole cell: a diagonal sum over G (Parseval), no interstitial overlap matrix, no linear solve. G space is necessary, not merely faster: the product of two functions cut off at gmax has content to 2*gmax, which aliases on a mesh.
  • M1_a, M2_a — true partial waves and their smooth counterparts inside each sphere, via a Rayleigh expansion of exp(-i b·r) and Gaunt contraction. The true waves carry the scalar-relativistic measure (small component and mass correction, as in the Hamiltonian’s own overlap); the envelopes are non-relativistic.

Projections:

The projections use the partial waves themselves as trial orbitals, so the angular integral is delta_LL' and no Gaunt contraction arises:

A_mn = [ conjg(aus_1) + conjg(aus_2)*<phidot|phidot> ] / sqrt(1 + <phidot|phidot>)

Both are phase-free in the sense that no exp(i k·tau) is folded into aus; positions are absolute, which is why M carries an explicit exp(-i 2 pi b·tau_a) and A carries none.

Real-space Wannier functions (cube, h5)

W_n(r+T) = (1/Nk) sum_k e^{ik.T} sum_m U_mn(k) psi_mk(r)

r runs over the home cell on the GMAX density mesh and T over a block of n1 x n2 x n3 repetitions of the primitive cell along plat (default 3,3,3; one value sets all three; odd counts centre the block on the function). The mesh is the unit cell’s, repeated in every cell of the block. U(k) is the rotation Wannier90 leaves behind (u_matrix_opt u_matrix after disentanglement). psi_mk is the plane-wave envelope of the fixed-G expansion (the same coefficients as M_I) times e^{ik.r}, with every mesh point inside an augmentation sphere, or an image of one, overwritten by the one-centre form sum_{L,i} aus(L,m,i) phi_li(|r-R|)/|r-R| Y_L(r-R). The spheres are sampled at the mesh spacing, so norms fall short on coarse meshes (Ni at gmax=6: 0.97 for t2g, 0.82 for eg); a mesh point within half a step of a nucleus takes the s part at that distance rather than the cusp. Files w90_n.cube (w90_n_s.cube per spinor component with SO=1), or w90_n[_s].h5 with h5 (datasets dims, p0, plat, vals, posc, zs, and the Wannier centre as rp), hold Re W in bohr units; the box norm and max|Im W|/max|W| are printed per function. Under MPI each rank accumulates its own k and the fields are summed before writing; the parallel localisation returns a slightly different gauge, so the files are not byte identical to a serial run’s (with SO=1 the gauge within a Kramers pair is arbitrary and only the pair density is invariant).

Reference comparisons

  1. Wannier90 tutorials/tutorial02/lead.win

Atom centred s,p given, but use a random initial projection (and more iterations):

ham gmax=5.0
bz nkabc=4
iter conv=1e-7
spec
 atom=Pb z=82 r=3.3
 rsmh= 1.811 2.068 2.2 2.2 eh= -0.1 -0.1 -0.1 -0.1 rsmh2= 1.811 2.068 2.2 eh2= -0.9 -0.9 -0.9
struc nbas=1 alat=4.67775 plat=-1 0 1 0 1 1 -1 1 0
site atom=Pb pos=0 0 0
lmf --nosym --w90~proj=1,0~proj=1,1~nb=8~rand~dump~nit=1000~quit ctrl.pb
  1. Wannier90 tutorials/tutorial03/silicon.win

Frozen window to match the QE run.

bz nkabc=4
ham gmax=8.0
iter nit=25 conv=1e-7
site
  atom=Si xpos=-0.25 0.75 -0.25
  atom=Si xpos=0 0 0
spec atom=Si z=14 r=2.2
  rsmh= 1.492 1.492 1.492 1.492 eh= -0.1 -0.1 -0.1 -0.1 rsmh2= 1.492 1.492 1.492 eh2= -0.9 -0.9 -0.9
struc nbas=2 alat=5.100 plat=-1 0 1 0 1 1 -1 1 0
lmf --nosym --w90~proj=1,0~proj=1,1~nb=12~froz=2.768~dump~quit ctrl.si
  1. Wannier90 tutorials/tutorial04/copper.win

Can’t project on cell-centred s functions; reduce to 5 d-orbitals:

ham autobas[mto=4 lmto=5] gmax=7.0
bz nkabc=4
iter conv=1e-7
spec
  atom=Cu z=29 r=2.412
  rsmh= 1.608 1.608 1 1.608 eh= -0.1 -0.1 -0.1 -0.1 rsmh2= 1.608 1.608 1 eh2= -0.9 -0.9 -0.9
struc nbas=1 alat=3.411 plat=-1 0 1 0 1 1 -1 1 0
site atom=Cu pos=0 0 0
lmf --nosym --w90~proj=1,2~dump~nit=100~quit ctrl.cu
  1. SrTiO3

Require to window disentanglement and provide a frozen (inner) window for e_g states, these are given in eV to options ~win (outer) and ~froz (inner).

ham autobas[mto=14 eh=-0.5] gmax=7.0
bz nkabc=4
iter conv=1e-7 nit=25
struc nbas=5 alat=7.3692 plat=1 0 0 0 1 0 0 0 1
spec
  atom=Sr z=38 r=3.300000 lmx=3 lmxa=5
  atom=Ti z=22 r=2.089716 lmx=3 lmxa=5
  atom=O  z= 8 r=1.594872 lmx=3 lmxa=5
site
  atom=Sr pos= 0.0  0.0  0.0
  atom=Ti pos= 0.5  0.5  0.5
  atom=O  pos= 0.0  0.5  0.5
  atom=O  pos= 0.5  0.0  0.5
  atom=O  pos= 0.5  0.5  0.0
lmf --nosymm --w90~proj=2,2~win=0.0,10.0~froz=0.0,3.0~dump~quit ctrl.sto

yields:

 w90fp: spin 1  Wannier centres (Ang) and spreads (Ang^2)
    1    1.949806    1.949806    1.949806      1.719016
    2    1.949806    1.949806    1.949806      1.719027
    3    1.949806    1.949806    1.949806      1.439655
    4    1.949806    1.949806    1.949806      1.719020
    5    1.949806    1.949806    1.949806      1.439833

Running wannier90

  • the dump option prints the inputs needed to run Wannier90 directly after the lmf run.
  • rename the files to the expected extensions: # rename "_dump" "" *dump.
  • run the wannier90 executable via wannier90.x w90.
  • add different options as needed to the .win file; it is only necessary to rerun lmf if you need to change any of the number of bands, number of wannier functions and choice of projections, or the k-mesh.
  • for WF band plotting, ~syml passes the lmf symmetry-lines path to Wannier90 (converted to the reduced coordinates it expects), which interpolates the bands inside lmf; with ~dump the dumped w90.win carries the path as explicit_kpath blocks.
  • some data manipulation is needed to overlay the bands (see STO WF); some utilities are provided to help this–see the SO=1 section below.

Plotting/overlaying lmf/Wannier90 bands

  • wannier2bnds: tabulates the Wannier90 output bands in lmf’s bnds format so that they can be plotted together: it needs $E_F$ from the lmf bnds file, or entered manually: Wannier90 usually doesn’t know/use the Fermi level.
  • these scripts are available in the utils/ directory.

See the worked example for Pb with SOC below.

Spin–orbit coupling (SO=1)

With HAM SO=1 the spins are coupled (nspc=2): one --w90 run wannierises the full spinor spectrum, with spinors = .true. set in Wannier90 and each M_mn a spinor inner product.

  • NSPIN=2 is required even without magnetism (the SO token is only read when NSPIN=2); start from zero moments.
  • Quantisation axis is the global z axis. Each proj= orbital doubles into an (up,down) pair, in that order, so num_wann is twice the length of the projector list. No other axis is available; orient the structure, as with the real-harmonic m selection.
  • Count in Kramers pairs. Every band is doubly degenerate: choose nb= even. Energy windows (win=, froz=) are safe — exact partners fall on the same side of any edge.

Spin matrix (wspinor)

The wspinor option writes S_a(i,j) = <psi_ik|sigma_a|psi_jk> (dimensionless Pauli matrices, global z quantisation axis) for band pairs at every k. The matrix is the b=0 overlap resolved into its spinor blocks O^(ss') = <psi_i^s|psi_j^s'>:

S_x = O^(12) + O^(21),   S_y = i (O^(21) - O^(12)),   S_z = O^(11) - O^(22)

with O^(21) = O^(12)^H. The cross block needs one new radial table, the overlap of up with down partial waves.

The file is the formatted .spn.

At a k-point where bands are degenerate (every k, for Kramers pairs) the individual diagonal elements within the degenerate block are gauge-dependent; only the block as a whole (e.g. its trace, which vanishes for a Kramers pair) is physical.

SOC workflow

lmf input for SO=1 case:

    bz nkabc=8
    ham gmax=5.0 nspin=2 so=1
    iter conv=1e-7
    site atom=Pb pos=0 0 0
    spec
     atom=Pb z=82 r=3.3
     rsmh= 1.811 2.068 2.2 2.2 eh= -0.1 -0.1 -0.1 -0.1 rsmh2= 1.811 2.068 2.2 eh2= -0.9 -0.9 -0.9
    struc nbas=1 alat=4.67775 plat=-1 0 1 0 1 1 -1 1 0
    symgrp soc=1

complete command list:

    lmroot=~/kkr-lmto-lapw/lm
    set -e
    set -x

    lmchk --syml ctrl.pb > llmchk

    lmfa ctrl.pb > llmfa

    mpirun -- lmf ctrl.pb > llmf

    mpirun -- lmf --band~fn=syml ctrl.pb > llmf-band

    lmf --nosym --w90~proj=1,0~proj=1,1~nb=8~syml~nit=3000~quit ctrl.pb > llmf-w90
    # ~syml: Wannier90 writes w90_band.dat, w90_band.kpt and w90_band.labelinfo.dat

    $lmroot/utils/wannier2bnds --ef-from bnds.pb w90 > bnds-w90.pb

    band-plot syml.pb bnds.pb:c=grey bnds-w90.pb:c=red -e -15,12 -o pb-bands.pdf

In this case, the WF reliably converge to the mid-cell: they do not stay on the atom centred initial projections (beware that with SO=1, using random initial projections via ~rand may cause the MLWF optimisation to stall in this case).

Result for atom-centred s,p projections:

     Final State
      WF centre and spread    1  (  0.372597, -0.373054,  0.372838 )     2.70562929
      WF centre and spread    2  (  0.372596, -0.373055,  0.372838 )     2.70562929
      WF centre and spread    3  ( -0.373009, -0.372608, -0.372870 )     2.70563805
      WF centre and spread    4  ( -0.373010, -0.372607, -0.372870 )     2.70563805
      WF centre and spread    5  ( -0.372653,  0.373022,  0.372816 )     2.70562780
      WF centre and spread    6  ( -0.372652,  0.373023,  0.372815 )     2.70562780
      WF centre and spread    7  (  0.373064,  0.372640, -0.372785 )     2.70563244
      WF centre and spread    8  (  0.373065,  0.372639, -0.372784 )     2.70563245
      Sum of centres and spreads ( -0.000000, -0.000000, -0.000001 )    21.64505518

             Spreads (Ang^2)       Omega I      =    17.904424328
            ================       Omega D      =     0.010078903
                                   Omega OD     =     3.730551948
        Final Spread (Ang^2)       Omega Total  =    21.645055180

The Wannier interpolated eigenvalues agree well with the original LDA results: in this figure the Wannier WF are plotted in red above the lmf bands in grey: Lead-SOC.