The following guide builds an OpenMPI version of VASP using the GNU compiler suite and the LAPACK, SCALAPACK and FFTW library provided by the internal package manager APT. This guide was tested successfully on Ubuntu (18.04). Note that following steps will yield a version of VASP without OpenMP support.

  • Open a terminal and make sure that all relevant GNU compilers are installed
sudo apt-get install make build-essential g++ gfortran

  • The following command installs all necessary libraries for VASP, that is LAPACK, SCALAPACK, OpenMPI and FFTW

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

  • Extract the VASP tar ball and patch

tar -zxvf vasp.5.4.4.tar.gz
gunzip patch.
cd vasp.5.4.4/
patch -p0 < ../patch.

  • Create a file "makefile.include" with following content
# Precompiler options
            -DMPI -DMPI_BLOCK=8000 -Duse_collective \
            -DscaLAPACK -DCACHE_SIZE=4000 \
            -Davoidalloc -Duse_bse_te \
            -Dtbdyn -Duse_shmem

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

FC         = mpif90
FCL        = mpif90 

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

FFLAGS     = -w
OFLAG      = -O2 -mtune=native -m64
DEBUG      = -O0

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


LLIBS      += -lfftw3
INCS       = -I/usr/include

OBJECTS    = fftmpiw.o fftmpi_map.o  fftw3d.o  fft3dlib.o 

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

# For what used to be vasp.5.lib
CPP_LIB    = $(CPP)
FC_LIB     = $(FC)
CC_LIB     = gcc

OBJECTS_LIB= linpack_double.o getshmem.o 

# For the parser library
CXX_PARS   = g++  
LIBS       += parser
LLIBS      += -Lparser -lparser -lstdc++

# Normally no need to change this
SRCDIR     = ../../src
BINDIR     = ../../bin
  • Build std, gam and ncl versions of VASP

make std gam ncl

After a successful build the corresponding executables are found in ./bin

  • After adding VASP to the environment variable, you can run it directly through the command vasp. Next you need to add environment variables
vim ~/.bashrc

  • Add the following command to fill in the file directory according to your installation. The following is the standard version of the vasp.


  • Re-execute the newly modified initialization file for immediate effect

source ~/.bashrc

  • To calculate using vasp, first prepare four input files: POSCAR, POTCAR, KPOINTS, INCAR. Put these four input files in a single folder. Use the command in the file directory:


  • Parallel computing command(4 cores):

mpirun -np 4 vasp

Last modified: 2020年2月14日


Ghalla Houcine 

Dear Sir, please can you provide me the patch file of vasp 5.4.4. Thank you for your help.
With kind regards.

Write a Reply or Comment

Your email address will not be published.