Vienna Ab initio Simulation Package (VASP) is a computer program for atomic scale materials modelling, e.g. electronic structure calculations and quantum-mechanical molecular dynamics, from first principles.
To compile VASP, I will be using the following
- Intel Compiler XE 12.1.5
- OpenMPI 1.6.5
- Maths Kernel Library (MKL)
- CentOS 6.3 / RH 6.3
A. Prerequisites
Step 1: Install and Compile Intel XE Compilers 12.1.5 and OpenMPI 1.6.5
- Compiling OpenMPI 1.6.5 with Intel 12.1.5 on CentO 6
Step 2: Intel MKL FFTW wrappers
- Compile and Build FFTW3 wrapper routines on MKL implementation of FFT
B. Compiling VASP Libraries
Assuming you have unpacked the VASP files. Here is may make file
.SUFFIXES: .inc .f .F
#-----------------------------------------------------------------------
# Makefile for LINUX NAG f90
#-----------------------------------------------------------------------
# fortran compiler
FC=ifort
# C-preprocessor
#CPP = /usr/lib/gcc-lib/i486-linux/2.7.2/cpp -P -C $*.F >$*.f
CPP = gcc -E -P -C -DLONGCHAR $*.F >$*.f
CFLAGS = -O
FFLAGS = -Os -FI
FREE = -FR
DOBJ = preclib.o timing_.o derrf_.o dclock_.o diolib.o dlexlib.o drdatab.o
#-----------------------------------------------------------------------
# general rules
#-----------------------------------------------------------------------
libdmy.a: $(DOBJ) linpack_double.o
-rm libdmy.a
ar vq libdmy.a $(DOBJ)
linpack_double.o: linpack_double.f
$(FC) $(FFLAGS) $(NOFREE) -c linpack_double.f
# files which do not require autodouble
lapack_double.o: lapack_double.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_double.f
lapack_single.o: lapack_single.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_single.f
#lapack_cray.o: lapack_cray.f
# $(FC) $(FFLAGS) $(NOFREE) -c lapack_cray.f
.c.o:
$(CC) $(CFLAGS) -c $*.c
.F.o:
$(CPP)
$(FC) $(FFLAGS) $(FREE) $(INCS) -c $*.f
.F.f:
$(CPP)
.f.o:
$(FC) $(FFLAGS) $(FREE) $(INCS) -c $*.f
C. Compiling VASP
1. Copy the Makefile from makefile.linux_ifc_P4 in the vasp software.
# cp makefile.linux_ifc_P4 Makefile
2. Edit the Makefile
FC (~ line 62)
#-----------------------------------------------------------------------
# fortran compiler and linker
#-----------------------------------------------------------------------
FC=mpif90
# fortran linker
FCL=$(FC) -mkl
FFLAGS (~line 108)
#-----------------------------------------------------------------------
# general fortran flags (there must a trailing blank on this line)
# byterecl is strictly required for ifc, since otherwise
# the WAVECAR file becomes huge
#-----------------------------------------------------------------------
FFLAGS = -FR -names lowercase -assume byterecl
BLAS (~ line 149)
# BLAS
# setting -DRPROMU_DGEMV -DRACCMU_DGEMV in the CPP lines usually speeds up program execution
# BLAS= -Wl,--start-group $(MKL_PATH)/libmkl_intel_lp64.a $(MKL_PATH)/libmkl_intel_thread.a $(MKL_PATH)/libmkl_core.a -Wl,--end-group -lguide
# faster linking and available from at least version 11
BLAS= -mkl=sequential
LAPACK (~ line 158)
# LAPACK from mkl, usually faster and contains scaLAPACK as well
#LAPACK= $(MKL_PATH)/libmkl_intel_lp64.a
LAPACK =
CPP ( ~ line 223)
#-----------------------------------------------------------------------
CPP = $(CPP_) -DMPI -DHOST=\"LinuxIFC\" -DIFC \
-DCACHE_SIZE=4000 -DPGF90 -Davoidalloc -DNGZhalf \
-DMPI_BLOCK=8000 -Duse_collective -DscaLAPACK \
-DRPROMU_DGEMV -DRACCMU_DGEMV
SCALAPACK (~ line 233)
#-----------------------------------------------------------------------
# location of SCALAPACK
# if you do not use SCALAPACK simply leave this section commented out
#-----------------------------------------------------------------------
# usually simplest link in mkl scaLAPACK
BLACS= -lmkl_blacs_openmpi_lp64
SCA= $(MKL_PATH)/libmkl_scalapack_lp64.a $(BLACS)
LIBRARIES (~line 238)
#-----------------------------------------------------------------------
# libraries
#-----------------------------------------------------------------------
LIB = -L../vasp.5.lib -ldmy \
../vasp.5.lib/linpack_double.o \
$(SCA) $(LAPACK) $(BLAS)
Parallel FFT (~ line 246)
#-----------------------------------------------------------------------
# parallel FFT
#-----------------------------------------------------------------------
# FFT: fftmpi.o with fft3dlib of Juergen Furthmueller
FFT3D = fftmpi.o fftmpi_map.o fft3dfurth.o fft3dlib.o
References:
- Building VASP* with Intel® MKL and Intel® Compilers
(Intel Developer Zone)
- How to Compile VASP on NSC’s Triolith
- Installing VASP
- How to build VASP-4.6.36 and VASP-5.2.8 on Intel Westmere with Infiniband network