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,intTrial orbitals: all 2l+1 partial waves of angular momentum l at site ib. Repeatable.
proj=ib,l,mint,int,intAs 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.
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).
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).
randflagoffReplace the projections by random ones.
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).

Implementation: src/fp/w90fp.F, called from bndfp.f. 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.

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, add a suitable path to the “w90.win” file: Wannier90 expects reduced coordinates while lmf by default uses Cartesian; for cubic STO we are lucky that they are identical:

      bands_plot = .true.
      begin kpoint_path
             X 0.5 0.0 0.0   G 0.0 0.0 0.0
             G 0.0 0.0 0.0   M 0.5 0.5 0.0
             M 0.5 0.5 0.0   R 0.5 0.5 0.5
             R 0.5 0.5 0.5   G 0.0 0.0 0.0
      end kpoint_path
    
  • 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

  • syml2win: creates Wannier90 input file instructions for reproducing the band plot: it needs the unit cell vectors to order to convert Cartesian to reduced k-points.
  • 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.

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~dump~nit=3000~quit ctrl.pb > llmf-w90

    rename "_dump" "" *dump

    $lmroot/utils/syml2win --plat -1 0 1 0 1 1 -1 1 0 syml.pb >> w90.win

    wannier90.x w90

    $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.