Installing VASP 6.x on x86_64 RHEL 7.9 Linux
In the past I have posted two sets of instructions for installing VASP (Vienna Ab-initio Simulation Package for quantum-mechanical molecular dynamics (MD) using pseudopotentials and a plane wave basis set), each for VASP 5.X on an Opteron system. Now, many years later, I find myself in the position of having to install VASP once again.
The installation approach is still pretty horrible but it has improved a great deal. Previously there was a small mountain of makefiles for different architectures and one had to find a file that was "close enough" and modify as required. This process is still required, but the quantity of makefiles is dramatically reduced with improved abstraction, directory management, and a test suite.
The structure (once extracted) is as follows:
vasp.X.X.X (root directory) | ------------------------------------------------ | | | | | | arch bin build src testsuite tools
* `root/`. Holds the high-level makefile and several subdirectories.
* `root/src`. Holds the source files of VASP and a low-level makefile.
* `root/arch`. Holds a collection of `makefile.include.*` files.
* `root/build`. The different versions of VASP, i.e., the standard, gamma-only, non-collinear, and CUDA-GPU versions will be build in separate subdirectories of this directory.
* `root/bin`. Here make will store the binaries.
* `root/testsuite`. Holds a suite of correctness tests to check your build.
* `root/tools`. Holds several python scripts related to the (optional) use of HDF5 input/output files.
Installation involves copying one the makefile.include.xxx files to the root directory as makefile.include, modifying it running make. The most straightforward, used in this example, is makefile.include.linux_gnu.
Within the makefile one will have to enter the values of the Fortran library directory, the LIBDIR for Blas, LAPACK, SCALAPACK, and FFTW. c.f.,
# LIBDIR = /opt/gfortran/libs/ LIBDIR = /usr/local/easybuild-2019/easybuild/software/core/gcccore/10.2.0/lib64/lib BLAS = -L$(LIBDIR) -lrefblas LAPACK = -L$(LIBDIR) -ltmglib -llapack BLACS = SCALAPACK = -L$(LIBDIR) -lscalapack $(BLACS) LLIBS = $(SCALAPACK) $(LAPACK) $(BLAS)
In this particular installation, there is the use of the EasyBuild foss/2020b toolchain, which consists of GCC/10.2.0 and OpenMPI 4.0.5. Once that toolchain is loaded then one can also load FFTW/3.3.8, scalapack/2.1.0, openblas/0.3.12. Note that loading the modules will not be read by the VASP makefile. They still have to be hard-coded - it is convenient however when checking the PATH to the libraries.
The above code snippet from the makefile is a little deceptive. Something like the following is recommended instead:
# LIBDIR = /opt/gfortran/libs/ LIBDIR = /usr/local/easybuild-2019/easybuild/software/core/gcccore/10.2.0/lib64/lib # BLAS = -L$(LIBDIR) -lrefblas # LAPACK = -L$(LIBDIR) -ltmglib -llapack BLACS = # SCALAPACK = -L$(LIBDIR) -lscalapack $(BLACS) OPENBLAS_ROOT ?= /usr/local/easybuild-2019/easybuild/software/compiler/gcc/10.2.0/openblas/0.3.12/ BLASPACK = -L$(OPENBLAS_ROOT)/lib -lopenblas SCALAPACK_ROOT ?= /usr/local/easybuild-2019/easybuild/software/mpi/gcc/10.2.0/openmpi/4.0.5/scalapack/2.1.0 SCALAPACK = -L$(SCALAPACK_ROOT)/lib -lscalapack LLIBS += $(SCALAPACK) $(BLASPACK) # FFTW ?= /opt/gfortran/fftw-3.3.6-GCC-5.4.1 FFTW ?= /usr/local/easybuild-2019/easybuild/software/mpi/gcc/10.2.0/openmpi/4.0.5/fftw/3.3.8 LLIBS += -L$(FFTW)/lib -lfftw3 -lfftw3_omp INCS = -I$(FFTW)/include
There is a further issue. If one is using GCC 10.x or greater there will be an argument mismatch. An error will occur like the following:
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
To get around this an additional Fortran flag must be added, resulting in:
# For gcc-10 and higher require -fallow FFLAGS = -w -march=native -fallow-argument-mismatch
Another interesting error is that VASP has only been built for up to GCC7. The use of GCC 10 and MPI will result in an error and the reader_base.F file needs to be patched. This has been discussed on the VASP forums, which also has a copy of the patchfile. Modify the headers if necessary and apply the patch. e.g.,
patch < reader.patch patching file reader_base.F
Following this, an incremental build of the three core VASP binaries should work.
make std make gam make ncl