Skip to content

Wannier90

What is Wannier90?

Wannier90 is a program for calculating maximally-localized Wannier functions (MLWFs) from electronic structure calculations. It is widely used in solid-state physics and materials science for analyzing electronic properties, computing band structures, and studying topological materials.

Important

Wannier90 does NOT support GPU acceleration.

Base Environment

Wannier90 is provided via the environment modules system.

DFT Interface

Wannier90 is typically used with DFT codes such as Quantum ESPRESSO, VASP, Abinit, CASTEP, or Siesta.

For full Wannier function calculations, it requires input files (.mmn, .amn, .eig) generated by these DFT codes. However, Wannier90 can run standalone for preprocessing tasks (generating .nnkp files).

For Quantum ESPRESSO workflows, refer to the Quantum ESPRESSO documentation first.

Loading Wannier90

Load module

module load wannier90/3.1.0-1423-gb0695c20

Best Practice

Always verify the loaded version:

module list
wannier90.x --version

Standalone Preprocessing

Wannier90 can be run standalone to generate the .nnkp file (nearest-neighbor k-points) needed by DFT codes.

silicon.win

Basic Wannier90 input

num_wann = 4
num_iter = 100

begin unit_cell_cart
bohr
-5.13  0.0   5.13
 0.0   5.13  5.13
-5.13  5.13  0.0
end unit_cell_cart

begin atoms_frac
Si  0.00  0.00  0.00
Si  0.25  0.25  0.25
end atoms_frac

mp_grid = 2 2 2

begin kpoints
0.0 0.0 0.0
0.5 0.0 0.0
0.0 0.5 0.0
0.5 0.5 0.0
0.0 0.0 0.5
0.5 0.0 0.5
0.0 0.5 0.5
0.5 0.5 0.5
end kpoints

wannier_preprocess.sh

Preprocessing job script

#!/bin/bash
#SBATCH --job-name=wannier_pp
#SBATCH --partition=CPU
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --mem=2G
#SBATCH --time=00:05:00
#SBATCH --output=wannier_pp_%j.out

module load wannier90/3.1.0-1423-gb0695c20

wannier90.x -pp silicon

Submit job

sbatch wannier_preprocess.sh

Output

This creates silicon.nnkp which contains k-point neighbor information needed by your DFT code.

The .nnkp file is then read by the DFT code's Wannier90 interface to generate the required .mmn, .amn, and .eig files.

Complete Workflow Example

This example demonstrates the full Quantum ESPRESSO + Wannier90 workflow for silicon.

Step 1: Quantum ESPRESSO SCF Calculation

si.scf.in

SCF input file

&control
    calculation = 'scf'
    prefix = 'silicon'
    outdir = './tmp'
    pseudo_dir = '/mnt/netapp_home/apps/quantum-espresso/qe-7.5-cpu/qe-7.5/pseudo'
/
&system
    ibrav = 2
    celldm(1) = 10.26
    nat = 2
    ntyp = 1
    ecutwfc = 20.0
    nbnd = 8
/
&electrons
    conv_thr = 1.0d-8
/
ATOMIC_SPECIES
 Si  28.086  Si_r.upf
ATOMIC_POSITIONS (alat)
 Si 0.00 0.00 0.00
 Si 0.25 0.25 0.25
K_POINTS (automatic)
 4 4 4 0 0 0

Step 2: Quantum ESPRESSO NSCF Calculation

si.nscf.in

NSCF input file

&control
    calculation = 'nscf'
    prefix = 'silicon'
    outdir = './tmp'
    pseudo_dir = '/mnt/netapp_home/apps/quantum-espresso/qe-7.5-cpu/qe-7.5/pseudo'
/
&system
    ibrav = 2
    celldm(1) = 10.26
    nat = 2
    ntyp = 1
    ecutwfc = 20.0
    nbnd = 8
/
&electrons
    conv_thr = 1.0d-8
/
ATOMIC_SPECIES
 Si  28.086  Si_r.upf
ATOMIC_POSITIONS (alat)
 Si 0.00 0.00 0.00
 Si 0.25 0.25 0.25
K_POINTS (crystal)
8
0.0 0.0 0.0 1.0
0.5 0.0 0.0 1.0
0.0 0.5 0.0 1.0
0.5 0.5 0.0 1.0
0.0 0.0 0.5 1.0
0.5 0.0 0.5 1.0
0.0 0.5 0.5 1.0
0.5 0.5 0.5 1.0

Step 3: Wannier90 Input File

silicon.win

Wannier90 input

num_bands = 8
num_wann = 4
num_iter = 100

dis_win_min = -6.0
dis_win_max = 10.0
dis_froz_max = 4.0

begin unit_cell_cart
bohr
-5.13  0.0   5.13
 0.0   5.13  5.13
-5.13  5.13  0.0
end unit_cell_cart

begin atoms_frac
Si  0.00  0.00  0.00
Si  0.25  0.25  0.25
end atoms_frac

begin projections
random
end projections

mp_grid = 2 2 2

begin kpoints
0.0 0.0 0.0
0.5 0.0 0.0
0.0 0.5 0.0
0.5 0.5 0.0
0.0 0.0 0.5
0.5 0.0 0.5
0.0 0.5 0.5
0.5 0.5 0.5
end kpoints

Step 4: pw2wannier90 Input File

si.pw2wan.in

Interface input

 &inputpp
   prefix = 'silicon'
   outdir = './tmp'
   seedname = 'silicon'
   write_mmn = .true.
   write_amn = .true.
   wan_mode = 'standalone'
 /
 /

Step 5: Complete SLURM Job Script

run_wannier90.sh

Complete workflow job script

#!/bin/bash
#SBATCH --job-name=qe_wannier
#SBATCH --partition=CPU
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --mem=8G
#SBATCH --time=00:30:00
#SBATCH --output=wannier_%j.out

module load qe/7.5-cpu
module load wannier90/3.1.0-1423-gb0695c20

echo "=== Step 1: SCF calculation ==="
mpirun --bind-to none -np 4 pw.x -in si.scf.in > si.scf.out

echo "=== Step 2: Wannier90 preprocessing ==="
wannier90.x -pp silicon

echo "=== Step 3: NSCF calculation ==="
mpirun --bind-to none -np 4 pw.x -in si.nscf.in > si.nscf.out

echo "=== Step 4: Generate Wannier90 input files ==="
mpirun --bind-to none -np 4 pw2wannier90.x -in si.pw2wan.in > si.pw2wan.out

echo "=== Step 5: Run Wannier90 ==="
wannier90.x silicon

echo "=== Checking completion ==="
grep "All done" silicon.wout

echo "=== Output files created ==="
ls -lh silicon.*

Submit job

sbatch run_wannier90.sh

GPU-Accelerated DFT Steps

The DFT calculations (Steps 1, 3, and 4) can be GPU-accelerated by using qe/7.5-gpu instead of qe/7.5-cpu:

#SBATCH --partition=GPU
#SBATCH --gres=gpu:1

module load nvhpc/24.11
module load qe/7.5-gpu
module load wannier90/3.1.0-1423-gb0695c20

Wannier90 itself remains CPU-only, but GPU-accelerated QE can significantly speed up the SCF/NSCF calculations for large systems.

Checking Job Completion

Successful completion

Check the Wannier90 output file:

grep "All done" silicon.wout

Expected output:

All done: wannier90 exiting

Output Files

File Description
silicon.wout Main Wannier90 output with convergence information
silicon.nnkp Nearest-neighbor k-points (from preprocessing)
silicon.mmn Overlap matrices (from pw2wannier90)
silicon.amn Projection matrices (from pw2wannier90)
silicon.eig Eigenvalues (from pw2wannier90)
silicon.chk Checkpoint file for calculations

Parallel Execution

Wannier90 is compiled with MPI support for parallel execution.

wannier90_parallel.sh

Parallel Wannier90 job (16 cores)

#!/bin/bash
#SBATCH --job-name=wannier_mpi
#SBATCH --partition=CPU
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem=16G
#SBATCH --time=02:00:00
#SBATCH --output=wannier_%j.out

module load qe/7.5-cpu
module load wannier90/3.1.0-1423-gb0695c20

# Run QE steps with MPI
mpirun --bind-to none -np 16 pw.x -in si.scf.in > si.scf.out
wannier90.x -pp silicon
mpirun --bind-to none -np 16 pw.x -in si.nscf.in > si.nscf.out
mpirun --bind-to none -np 16 pw2wannier90.x -in si.pw2wan.in > si.pw2wan.out

# Wannier90 itself is typically run in serial for small systems
wannier90.x silicon

Parallel Scaling

Wannier90's parallel efficiency depends on system size and number of k-points. For small systems like this silicon example, serial execution is sufficient. Use parallelization for larger systems with many k-points.

More Information

Documentation

Official Wannier90 website:

http://www.wannier.org/

Official Wannier90 documentation and tutorials:

https://wannier90.readthedocs.io/en/latest/