Compile VASPsol codes into VASP

Xijun Wang

3/14/2022

VASPsol, developed by Kiran Mathew and Dr. Richard Hennig (https://github.com/henniggroup/VASPsol/blob/master/README.md), is an implicit solvation model that describes the effect of electrostatics, cavitation, and dispersion on the interaction between a solute and solvent into the plane-wave DFT code VASP (v. 5.2+).

It provides a efficient approach to estimate the solvation effects for large periodic systems (e.g. catalyst surfaces) with good interoperability with standard ultrasoft pseudopotential and projector-augmented wave potential libraries.

For publication purposes, please cite the following papers:

  • Implicit solvation model for density-functional study of nanocrystal surfaces and reaction pathways. K. Mathew, R. Sundararaman, K. Letchworth-Weaver, T. A. Arias, and R. G. Hennig, J. Chem. Phys. 140, 084106 (2014), [doi:10.1063/1.4865107] (https://doi.org/10.1063/1.4865107).

  • Implicit self-consistent electrolyte model in plane-wave density-functional theory. K. Mathew, V. S. C. Kolluru, S. Mula, S. N. Steinmann, and R. G. Hennig, J. Chem. Phys. 151, 234101 (2019), [doi:10.1063/1.5132354] (https://doi.org/10.1063/1.5132354).

Three steps for the compilation of VASPsol

  1. Prepare the makefile for normal VASP compilation

Copy one of the makefile.include.arch files in /your_VASP_directory/arch to /your_VASP_directory/makefile.include. Take one that most closely reflects your system (hopefully):

cp /your_VASP_directory/arch/makefile.include.linux_intel /your_VASP_directory/makefile.include

and make modifications based on the requirements of your complier (for more information, please refer to https://www.vasp.at/wiki/index.php/Category:Installation), including but not limited to the following settings:

FC = mpifort

FCL = mpifort -mkl=sequential -lstdc++

OFLAG = -O3

MKL_PATH = /software/intel/2019.5/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64

Make sure that the make.include can successfully compile normal VASP codes.


  1. Add the VASPsol codes into VASP codes

  • Download VASPsol from https://github.com/henniggroup/VASPsol/blob/master/README.md.

  • For VASP >= 5.4.4, update the solvation routines by cp /your_VASPsol_directory/src/solvation.F* /your_VASP_directory/src/.

  • To ensure the solvation module's compatibility with the newer versions of vasp please add **-Dsol_compat** option to the list of precompiler options(CPP_OPTIONS) in the makefile (see the yellow highlighted line in the attached makefile.include).

---Specifically for VASP 5.4.1---

- To compute the FERMI_SHIFT as mentioned in the documentation in the VASPsol webpage, minor modification is required to the pot.F file. This can be done by cp /your_VASPsol_directory/src/patches/pbz_patch_541 /your_VASP_directory/src/.

- patch src/pot.F < <path to the pbz_patch_541 patch file>

--- Specifically for VASP 6+---

For VASP6 versions >= 6.1.0, there is currently a patch in /your_VASPsol_directory/src/patches/VASPsol6.patch. This patch applies the FERMI_SHIFT patch to the pot.F as well as providing additional subroutines.

- copy solvation.F from path_to_VASPsol/src/solvation.F to path_to_VASP6_install/src/

- Navigate to path_to_VASP6_install/src/ and modify the .objects file by ensuring that “solvation.o” appears before “pot.o”

- Set the CPP option "-Dsol_compat" in the VASP makefile.include file.

- Compile the code as described in the instructions on the VASP wiki.

- cd vasp.6.1.0 and patch -p0 < <path to the pbz_patch_610 patch file>


  1. Build VASP with VASPsol codes

When you've finished setting up makefile.include, build VASP:

make all

or

make gam # or std, ncl

Below is an example of the makefile.include on the Quest HPC Cluster at Northwestern University (Take vasp 5.4.4 as an example):

# Precompiler options

CPP_OPTIONS= -DHOST=\"LinuxIFC\"\

-DMPI -DMPI_BLOCK=8000 \

-Duse_collective \

-DscaLAPACK \

-DCACHE_SIZE=4000 \

-Davoidalloc \

-Duse_bse_te \

-Dtbdyn \

-Duse_shmem \

-Dsol_compat # For VASPsol

CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)

FC = mpifort

FCL = mpifort -mkl=sequential -lstdc++

FREE = -free -names lowercase

FFLAGS = -assume byterecl -w

OFLAG = -O3

OFLAG_IN = $(OFLAG)

DEBUG = -O0

MKL_PATH = /software/intel/2019.5/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64

BLAS =

LAPACK =

BLACS = -lmkl_blacs_openmpi_lp64

SCALAPACK = $(MKL_PATH)/libmkl_scalapack_lp64.a $(BLACS)

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

INCS =-I$(MKLROOT)/include/fftw

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

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 = icc

CFLAGS_LIB = -O

FFLAGS_LIB = -O1

FREE_LIB = $(FREE)

OBJECTS_LIB= linpack_double.o getshmem.o

# For the parser library

CXX_PARS = icpc

LIBS += parser

LLIBS += -Lparser -lparser -lstdc++

# # Normally no need to change this

SRCDIR = ../../src

BINDIR = ../../bin

If the compilation ends normally, it will generate three executable files under /your_VASP_directory/bin/:

vasp_gam vasp_ncl vasp_std

Usage (FYI, https://github.com/henniggroup/VASPsol/blob/master/docs/USAGE.md):

LSOL = .TRUE. # In the simplest case the only parameter that needs to be set is the solvation flag

EB_K = 80 # Dielectric constant for the solvent

EB_k = 78.4 # The relative permittivity of the solvent can be changed

TAU = 0 # You can also change the surface tension parameter tau in the INCAR file. For example, to neglect the the cavitation energy contribution, set in the INCAR file. Note that you may have to increase the cutoff energy to converge the caviation energy because the grid must be fine enough to resolve the cavity surface.

LRHOB = .TRUE. # If you would like to write out the bound charge density in the CHGCAR format. The file is named RHOB.

LAMBDA_D_K = # Set LAMBDA_D_K (the Debye length in Angstroms) parameter in the INCAR file to use the linearized Poisson-Boltzmann model(electrolyte model)