Wannier90: Band Structures, Tips and Tricks

30
J. M. Skelton University of Bath, UK WMD [Virtual] Group Meeting 31 st October 2016 Wannier90: Band Structures, Tips and Tricks

Transcript of Wannier90: Band Structures, Tips and Tricks

Page 1: Wannier90: Band Structures, Tips and Tricks

J. M. Skelton

University of Bath, UK

WMD [Virtual] Group Meeting

31st October 2016

Wannier90:Band Structures, Tips and Tricks

Page 2: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 2

Overview

Wannier90 is a code for obtaining and performing calculations with maximally-localised Wannier functions

Comes as a standalone executable, or as a library that can be interfaced with a number of DFT codes including VASP

Between wannier90.x and postw90.x, a large number of electronic-structure-related calculations can be done:

o High-resolution band structures and electronic DoS curves

o Generating band energies at lists of arbitrary k-points (geninterp)

o Berry-curvature (berry) and Boltzmann transport (BoltzWann) calculations

If we are only interested in electronic-structure calculations, Wannier90 is fairly easy to use, and you can follow a simple “recipe” to do these calculations

Page 3: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 3

Building VASP with Wannier90 support

Download Wannier90 1.2 from http://www.wannier.org/download.html [N.B. the interface from VASP 5.4.1 does not use the latest version]

For more recent Intel compilers, copy config/make.sys.ifort to make.sys and edit as follows:

LIBDIR = /opt/intel/mkl721/lib/32

LIBS = -L$(LIBDIR) -lmkl_lapack -lmkl_ia32 -lguide -lpthread

LIBDIR = ${MKLROOT}/lib/intel64

LIBS = -L$(LIBDIR) -mkl -lpthread

Build the executable and library, run the tests, and check the report:

make wannier lib test

Page 4: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 4

Building VASP with Wannier90 support

For VASP 5.4.1 and the Intel compilers, edit makefile.include as follows:

CPP_OPTIONS = ...

...

LLIBS = $(SCALAPACK) $(LAPACK) $(BLAS)

CPP_OPTIONS = -DVASP2WANNIER90 ...

...

LLIBS = install_path/libwannier.a $(SCALAPACK) $(LAPACK) $(BLAS)

(Re)compile VASP:

make veryclean ; make gam std ncl

N.B. The build was done from a copy of the source with all the latest patches applied - if you run into any strange build errors, try applying these to see if it fixes it

Page 5: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 5

Building Wannier90 2.0.1

Download Wannier90 2.0.1 from http://www.wannier.org/download.html

As before, copy config/make.sys.ifort to make.sys, and this time change the LIBDIR variable in the section for the Intel MKL libraries:

LIBDIR = /opt/intel/mkl/lib/intel64

LIBDIR = ${MKLROOT}/lib/intel64

Build the executables and library:

make all

The make.sys.ifort input file seems to have been written for Intel MPI and so sets MPIF90=mpiifort; if you are using OpenMPI, you may need to change this to e.g. mpif90

Page 6: Wannier90: Band Structures, Tips and Tricks

Our example system: SnS2

Cell shape/volume fixed to experimental values,1 and atom positions relaxed w/ PBEsol-D3

Initial setup is the Sn_d and S PAW PPs (26 electrons), 550 eV cutoff, Γ-centered 12x12x8 k-point grid, PREC = Accurate, LREAL = .FALSE. and LASPH = .TRUE.

All these examples were run on chpc-cobalt (VASP 5.4.1, 32 cores, 128 Gb RAM)

A set of input files and reference output files can be downloaded from GitHub: https://github.com/JMSkelton/VASP-Examples/tree/master/Wannier90_SnS2

Wannier90: Band Structures, Tips and Tricks | Slide 6

Page 7: Wannier90: Band Structures, Tips and Tricks

VASP and Wannier90 workflow

Electronic-Structure Calculation

VASP-to-Wannier90(LWANNIER90)

Minimise WF Spread(wannier90.x)

Post-Processing(wannier90.x/postw90.x)

These two steps can be done separately (in most cases), or can be combined - see next slide

The convergence of the Wannier interpolation w.r.t. the WF spread is definitely not intuitive -> safest to verify your setup by comparing cheap (e.g. GGA) band structures from VASP and Wannier90

postw90.x is not included in Wannier90 1.2, but you can use the v1.2 output in v2.0

Wannier90: Band Structures, Tips and Tricks | Slide 7

Page 8: Wannier90: Band Structures, Tips and Tricks

The VASP-to-Wannier90 interface

There are three potential issues with the current Wannier90 interface:

o Calculations with LWANNIER90 fail for NPAR != Default (but KPAR works)

o If there are any errors in the input file, VASP will crash before writing the WAVECARfile

o Performing the initial projections to generate the Wannier90 input files takes a very long time, particularly with large NBANDS

If your calculation saves a WAVECAR file [some flavours of the GW algorithms do not], there is a filthy hack possible workaround:

1. Perform an electronic-structure calculation and save the WAVECAR

2. Copy the input files + WAVECAR to a workstation, and re-run VASP with LWANNIER90 = .TRUE., ALGO = None and NELMIN = 0

o N.B. WAVECARs are binary files [I think!], so the HPC and workstation probably need to use a similar CPU architecture for this to work

Wannier90: Band Structures, Tips and Tricks | Slide 8

Page 9: Wannier90: Band Structures, Tips and Tricks

The VASP-to-Wannier90 interface

Wannier90: Band Structures, Tips and Tricks | Slide 9

Example INCAR for LWANNIER90: Example skeleton wannier90.win file:

Other required tags are added automatically by VASP:

• num_wann (= NBANDS)• unit_cell_cart

• atoms_cart

• mp_grid

• kpoints

ALGO = Normal ! None

EDIFF = 1E-8

ENCUT = 550

GGA = PE

ISIF = 2

ISMEAR = -5

KPAR = 8

LASPH = .TRUE.

LREAL = .FALSE.

NBANDS = 64

NELMIN = 5 ! 0

!NPAR = 1

NSW = 0

PREC = Accurate

SYSTEM = SnS2

LWANNIER90 = .TRUE.

Begin Projections

Random

End Projections

Page 10: Wannier90: Band Structures, Tips and Tricks

The VASP-to-Wannier90 interface

Wannier90: Band Structures, Tips and Tricks | Slide 10

Page 11: Wannier90: Band Structures, Tips and Tricks

Wannier90 band structures

num_wannier must be set to num_bands

o The W90 band structure will contain num_wannier bands...

o ... so if num_wannier < num_bands, the band structure cannot be accurately represented

Since we aren’t interested in the WFs themselves, Random initial projections are fine

Not specifying an initial projection and setting use_bloch_phases seems to generate nonsense

When num_wannier = num_bands, no disentanglement is required, which means these parameters can be safely ignored

The only remaining issue is then the convergence of the “Wannierisation” procedure, i.e. minimising the quadratic spread of the WFs

Wannier90: Band Structures, Tips and Tricks | Slide 11

Page 12: Wannier90: Band Structures, Tips and Tricks

Wannier90 band structures

Begin Projections

Random

End Projections

bands_plot = .true.

bands_plot_format = 'gnuplot'

bands_num_points = 51

begin kpoint_path

G 0.000000 0.000000 0.000000 A 0.000000 0.000000 0.500000

A 0.000000 0.000000 0.500000 H 0.333333 0.333333 0.500000

...

L 0.500000 0.000000 0.500000 H 0.333333 0.333333 0.500000

end kpoint_path

A skeleton wannier90.win file can specify projections, or VASP will automatically add use_bloch_phases = T for you

As noted above, other required tags are added automatically by VASP

This is the number of k-points along the first segment; the number along the rest will be adjusted to maintain the same density

Wannier90: Band Structures, Tips and Tricks | Slide 12

Page 13: Wannier90: Band Structures, Tips and Tricks

Wannier90 band structures

Wannier90: Band Structures, Tips and Tricks | Slide 13

Page 14: Wannier90: Band Structures, Tips and Tricks

Converging the “Wannierisation”

A number of tags in Wannier90 control the convergence of the “Wannierisation” procedure:

o num_iter : (maximum) number of minimisations; default = 100

o conv_tol : break criterion on the change in the quadratic spread, ΔΩ𝐓𝐨𝐭; default = 10-10

o conv_window : number of iterations over which ΔΩ𝐓𝐨𝐭 must be < conv_tol; default = -1

The code only applies conv_tol if conv_window > 1 (remember - the default value is -1)

o This means increasing num_iter without setting conv_window and/or conv_tol might be a waste of time (!)

The minimisation routine is fairly slow, and for most systems [at least, in my experience], reaching ΔΩ𝐓𝐨𝐭 < 10-10 on a typical spread of approx. 102 Å2 can take a very long time

Wannier90: Band Structures, Tips and Tricks | Slide 14

Page 15: Wannier90: Band Structures, Tips and Tricks

Converging the “Wannierisation”

Conv. Crit. # Iter t [min] Ω𝐓𝐨𝐭 [Å2] ΔΩ𝐓𝐨𝐭 [Å2]

- 0 0.27 558.77 -

- 1 0.30 469.79 -0.88 x 102

- 10 0.51 333.25 -0.66 x 101

- 100 2.81 265.23 -0.54 x 10-1

- 1000 25.83 254.74 -0.19 x 10-2

ΔΩ𝐓𝐨𝐭 < 1 28 0.96 290.79 -0.97 x 10-1

ΔΩ𝐓𝐨𝐭 < 10-1 29 1.00 290.75 -0.38 x 10-1

ΔΩ𝐓𝐨𝐭 < 10-2 172 4.73 259.60 -0.95 x 10-2

ΔΩ𝐓𝐨𝐭 < 10-3 266 7.52 258.44 -0.85 x 10-3

ΔΩ𝐓𝐨𝐭 < 10-4 674 17.49 255.23 -0.32 x 10-4

(!)

(!)

(!)

(!)

Wannier90: Band Structures, Tips and Tricks | Slide 15

Page 16: Wannier90: Band Structures, Tips and Tricks

Converging the “Wannierisation”

Wannier90: Band Structures, Tips and Tricks | Slide 16

Page 17: Wannier90: Band Structures, Tips and Tricks

Converging the “Wannierisation”

Wannier90: Band Structures, Tips and Tricks | Slide 17

Page 18: Wannier90: Band Structures, Tips and Tricks

DoS calculations with postw90

Wannier90: Band Structures, Tips and Tricks | Slide 18

Once the initial “Wannierisation” has been performed, the converged WFs are stored in wannier90.chk and can be read by postw90.x

Using postw90.x to generate a DoS is as simple as adding the relevant tags to wannier90.win and running e.g. mpirun -np 32 postw90.x wannier90

kmesh = 32 32 24

adpt_smr = .true.

smr_type = 'gauss'

dos = .true.

dos_task = 'dos_plot'

Run the dos module; dos_plot is the only dos_task currently available

Adaptive smearing: 𝜂𝑛𝐤 = α 𝛻𝐤𝜀𝑛𝐤 Δ𝑘

Size if the k-point mesh - crank it up with impunity (!)

Page 19: Wannier90: Band Structures, Tips and Tricks

PBE: final result

Wannier90: Band Structures, Tips and Tricks | Slide 19

531 points/band 32x32x24 mesh

Page 20: Wannier90: Band Structures, Tips and Tricks

A few more convergence tests...

Pseudopotential LOOP [s]

Sn_d 2.13

Sn 1.67

Wannier90: Band Structures, Tips and Tricks | Slide 20

Page 21: Wannier90: Band Structures, Tips and Tricks

A few more convergence tests...

ENCUT [eV] LOOP [s]

300 1.12

350 1.24

400 1.30

450 1.83

500 2.06

550 2.13

Wannier90: Band Structures, Tips and Tricks | Slide 21

Page 22: Wannier90: Band Structures, Tips and Tricks

A few more convergence tests...

k-Point Mesh LOOP [s]

6x6x5 0.87

7x7x5 0.89

6x6x6 0.99

7x7x6 1.03

8x8x6 2.13

Wannier90: Band Structures, Tips and Tricks | Slide 22

Page 23: Wannier90: Band Structures, Tips and Tricks

Convergence tests: final result

Wannier90: Band Structures, Tips and Tricks | Slide 23

Page 24: Wannier90: Band Structures, Tips and Tricks

HSE06 calculations with Wannier90

HSE06 calculations save WAVECAR files, so we can use the “trick” and do the calculation in two parts to take advantage of NPAR

ALGO = All

EDIFF = 1E-8

ENCUT = 400

GGA = PE

HFSCREEN = 0.2

KPAR = 4

LHFCALC = .TRUE.

NBANDS = 64

NPAR = 1

NSW = 0

ALGO = None

EDIFF = 1E-8

ENCUT = 400

GGA = PE

HFSCREEN = 0.2

KPAR = 4

LHFCALC = .TRUE.

NBANDS = 64

NELMIN = 0

!NPAR = 1

NSW = 0

LWANNIER90 = .TRUE.

N.B. These INCARs are both incomplete - see GitHub for full input files

Wannier90: Band Structures, Tips and Tricks | Slide 24

Page 25: Wannier90: Band Structures, Tips and Tricks

GW calculations with Wannier90

ALGO = Exact

EDIFF = 1E-8

ENCUT = 400

GGA = PE

ISIF = 2

ISMEAR = -5

KPAR = 4

LASPH = .TRUE.

LOPTICS = .TRUE.

LREAL = .FALSE.

NBANDS = 64

NELMIN = 5

NPAR = 1

NSW = 0

PREC = Accurate

SYSTEM = SnS2

ALGO = GW0 | scGW0 | scGW

EDIFF = 1E-8

ENCUT = 400

GGA = PE

ISIF = 2

ISMEAR = -5

KPAR = 8

LASPH = .TRUE.

LREAL = .FALSE.

NBANDS = 64

NELM = 4 !NELMIN = 5

!NPAR = 1

NSW = 0

PREC = Accurate

SYSTEM = SnS2

LWANNIER90 = .TRUE.

Create and saveWAVEDER file

Ensures converged conduction bands

Apparently PBE givesbest W0 for GW

Run GW and LWANNIER90in the same calculation

Can’t use NPAR -> bumpup KPAR instead

Set number of GWiterations

Five GW ALGOs tochoose from (!)

Wannier90: Band Structures, Tips and Tricks | Slide 25

Page 26: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 26

PBE vs. HSE06 vs. GW: final result

Page 27: Wannier90: Band Structures, Tips and Tricks

PBE vs. HSE06 vs. GW: final result

Wannier90: Band Structures, Tips and Tricks | Slide 27

Method Eg,dir [eV] Eg,indir [eV]

Expt.1 2.38-2.56 2.25-2.48

PBE 1.915 1.505

HSE06 2.784 2.399

G0W0 2.927 2.517

scGW0 3.109 2.706

scGW 3.335 2.897

1L. A. Burton et al., J. Mat. Chem. A 4, 1312-1318 (2016)

Page 28: Wannier90: Band Structures, Tips and Tricks

Wannier90: Band Structures, Tips and Tricks | Slide 28

Method t [min]

PBE 2.08

HSE06 156

G0W0 20.6

scGW0 (4 iter.) 153

scGW (4 iter.) 152

PBE vs. HSE06 vs. GW: execution times

Page 29: Wannier90: Band Structures, Tips and Tricks

Summary

If all you want from Wannier90 is to interpolate the electronic structure, the “recipe” outlined here is fairly reliable [in my limited experience (!)]

Convergence (= minimisation of the WF spread) is not intuitive

o Probably the best advice here is to check your Wannier90 setup is working with a cheap (e.g. GGA) band structure

Between wannier90.x and postw90.x, you can do some neat stuff:

o High-resolution band structures + easy modification of band paths

o DoS calculations with fine k-point meshes + eigenvalues at arbitrary lists of k-points

o Several other modules in postw90.x (e.g. berry, BoltzWann)

If you plan to do an expensive electronic-structure calculation, checking whether the band energies are converged with a lower plane-wave cutoff and/or k-point sampling than your default setup could save you a lot of computer time...!

Wannier90: Band Structures, Tips and Tricks | Slide 29

Page 30: Wannier90: Band Structures, Tips and Tricks