Danny Rehn

        


Home Tutorials
Projects RT-TDDFT

Installing Wannier90 for use with VASP

Assumptions

Here, we assume you are using VASP 5.4.4 on a UNIX/Linux machine, with a section at the end regarding VASP versions < 5.4. I am using the Intel compilers, so the instructions will follow that. However, things should be very similar using GNU, with the difference of using different make.inc or make.include files.

General Procedure

The procedure is as follows:

  1. Compile Wannier90
  2. Compile VASP (VASP links to a library produced by Wannier90)

There is a new version (3.0) of Wannier90, but it isn’t clear whether VASP will link to that, based on the compiler flags that need to be added to VASP (see below). Therefore, I choose to use version 2.1. Other versions of Wannier90 are available at http://www.wannier.org/download/ or https://github.com/wannier-developers/wannier90/releases

Download and compile Wannier90

For v2.1, use either

$ wget http://www.wannier.org/code/wannier90-2.1.0.tar.gz
or
$ wget https://github.com/wannier-developers/wannier90/archive/v2.1.tar.gz

Then extract the tar file

$ tar xzf v2.1.tar.gz
$ cd wannier90-2.1

Before compiling, choose the relevant make.inc file. We use the intel compiler:

$ cp config/make.inc.ifort ./make.inc

This needs to be edited slightly. Change the line:

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

to

LIBDIR = ${MKLROOT}/lib/intel64

Now we can compile. VASP requires a library file, libwannier90.a. We also want wannier90.x, the executable. To get both of these do the following (preferably in this order)

$ make
$ make lib

You should now see libwannier.a and wannier90.x in the directory.

To ensure that this compiled correctly, you can also run

$ make test

which will run a series of tests.

Compiling VASP 5.4 with Wannier90

VASP has to be compiled with reference to the library file libwannier.a. The instructions on the vasp website can be found at https://cms.mpi.univie.ac.at/wiki/index.php/LWANNIER90.

The instructions at the above link seem to be somewhat out-of-date (as of 6/2019), since VASP upgraded its build system and now the makefile in the root directory does not include any of the flags that need to be changed. Instead do the following:

  1. First copy the relevant make.include file to the root directory. In our case, we have

     $ cp arch/makefile.include.linux_intel ./makefile.include
    
  2. Edit this makefile.include file to change:

     CPP_OPTIONS = ...
         ...
         -Duse_shmem
    

    to

     CPP_OPTIONS = ...
         ...
         -Duse_shmem\       
         -DVASP2WANNIER90v2 
    

    and

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

    to

     LLIBS      = $(SCALAPACK) $(LAPACK) $(BLAS)                                 
     LLIBS     += /<path-to-wannier90-2.1>/libwannier.a
    

    where <path-to-wannier90-2.1> is the full directory to Wannier90 that was built.

  3. Now build VASP:

     $ make all
    

The last step will take a while, but that includes everything that needs to be done.

Compiling VASP <= 5.3 with Wannier90

Because the build system changed as of VASP 5.4, things are slightly different with older versions. Instructions are as follows:

  1. Change to the src directory in the VASP <= 5.3 folder
  2. Open the Makefile and edit the following tags:

    Change the line

    CPP=$(CPP_) -DMPI ...
    

    by adding the -DVASP2WANNIER90 tag at the end (note that -DVASP2WANNIER90v2 does not work in this version)

    CPP=$(CPP_) -DMPI ... -DVAPS2WANNIER90
    

    Also edit the LIB variable to add the libwannier.a library, which should end up looking something like this:

     LIB = -L../vasp.5.lib -ldmy ../vasp.5.lib/linpack_double.o \
             /path/to/libwannier.a \
             $(SCA) $(LAPACK) $(BLAS)
    
  3. Once done with the following edits, run

     $ make clean
     $ make
    

    to recompile.