Since 18/01/2017

header ads

How to compile VASP 5.4.1 for Linux Debian using the GNU compiler

This tutorial will explain how to install VASP 5.4.1 on a Linux Debian system. The developers of VASP have completely remade the compilation procedure. Personally, I believe they have done a marvelous job and the new compilation system will make compiling VASP significantly easier.
For installing VASP 4.6.38, you can refer to my previous blogpost.
If you are interested in compiling VASP 5.3.5 using the old procedure, have a look at this tutorial.

Step 1: Acquiring the necessary packages


sudo apt-get install build-essential libopenmpi-dev libfftw3-dev libblas-dev 
liblapack-dev libscalapack-mpi-dev libblacs-mpi-dev

Step 2: Extracting the VASP source tarball

Extract the VASP sources and go to the root directory of the VASP package.

tar -xvzf vasp.5.4.1.tar.gz
cd vasp.5.4.1

Step 3: Setting the build procedure

You need to copy the makefile corresponding to your build architecture. Here, I assume we are going to use the GNU compiler, so you need to copy the makefile for gfortran:

cp -v arch/makefile.include.linux_gfortran makefile.include

Step 4: Configuring the makefile

You need to tweak some directives in the Makefile to point the compiler to the right libraries and header files. For my Linux Debian system, I have used the following directives:

# Precompiler options
CPP_OPTIONS= -DMPI -DHOST=\"IFC91_ompi\" -DIFC \
             -DCACHE_SIZE=4000 -Davoidalloc \
             -DMPI_BLOCK=8000 -DscaLAPACK -Duse_collective \
             -DnoAugXCmeta -Duse_bse_te \
             -Duse_shmem -Dtbdyn

CPP        = gcc -E -P -C $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)

FC         = mpif90
FCL        = mpif90

FREE       = -ffree-form -ffree-line-length-none

FFLAGS     =
OFLAG      = -O2
OFLAG_IN   = $(OFLAG)
DEBUG      = -O0

LIBDIR     = /usr/lib/x86_64-linux-gnu
BLAS       = -L$(LIBDIR) -lblas
LAPACK     = -L$(LIBDIR) -llapack
BLACS      = -L$(LIBDIR) -lblacs-openmpi -lblacsCinit-openmpi
SCALAPACK  = -L$(LIBDIR) -lscalapack-openmpi $(BLACS)

OBJECTS    = fftmpiw.o fftmpi_map.o  fftw3d.o  fft3dlib.o \
             /usr/lib/x86_64-linux-gnu/libfftw3.a
INCS       =-I/usr/include

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

OBJECTS_O1 += fft3dfurth.o fftw3d.o fftmpi.o fftmpiw.o chi.o
OBJECTS_O2 += fft3dlib.o

# For what used to be vasp.5.lib
CPP_LIB    = $(CPP)
FC_LIB     = $(FC)
CC_LIB     = gcc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB   = $(FREE)

OBJECTS_LIB= linpack_double.o getshmem.o

# Normally no need to change this
SRCDIR     = ../../src
BINDIR     = ../../bin

Step 5: Compiling

You are now ready to compile VASP!

make std

Troubleshooting

When compiling, I encountered the same error as for VASP 5.3.5 relating to the us.f90.

us.f90:1403.10:

       USE us
           1
Error: 'setdij' of module 'us', imported at (1), is also the name of the current program unit

The way to resolve this error, is by changing the names. The way we are going to do that, is by applying a patch to this file. You can download the patch file here. The patch was created for VASP 5.3.5, but works fine for VASP 5.4.1. Just place it in the same directory as where the VASP sources reside (src) and apply the patch by typing:

wget http://www.ivofilot.nl/downloads/vasp535.patch
patch -p0 < vasp535.patch

This will change the names automatically. You will receive a message such as

patching file us.F

Upon typing make, the compilation will resume.


Reference: http://www.ivofilot.nl/posts/view/31/How+to+compile+VASP+5.4.1+for+Linux+Debian+using+the+GNU+compiler

Post a Comment

0 Comments