目录

VASP

misaraty 更新 | 2023-01-14
前言
VASP是使用最为广泛的第一性原理计算软件。

VASP

下载

运行环境
CentOS-7-x86_64-Minimal,Intel® Parallel Studio XE 2015。

安装

修改makefilemakefile.includesrc/constr_cell_relax.F,其中makefile.include

  • VASP5.4.4
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
             -DMPI -DMPI_BLOCK=8000 \
             -Duse_collective \
             -DscaLAPACK \
             -DCACHE_SIZE=4000 \
             -Davoidalloc \
             -Duse_bse_te \
             -Dtbdyn \
             -Duse_shmem
CPP        = fpp -f_com=no -free -w0  $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
FC         = mpiifort
FCL        = mpiifort -mkl=sequential -lstdc++
FREE       = -free -names lowercase
FFLAGS     = -assume byterecl -w -heap-arrays 64
OFLAG      = -O2
OFLAG_IN   = $(OFLAG)
DEBUG      = -O0
MKL_PATH   = $(MKLROOT)/lib/intel64
BLAS       =
LAPACK     =
BLACS      = -lmkl_blacs_intelmpi_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
#================================================
# GPU Stuff
CPP_GPU    = -DCUDA_GPU -DRPROMU_CPROJ_OVERLAP -DUSE_PINNED_MEMORY -DCUFFT_MIN=28 -UscaLAPACK
OBJECTS_GPU = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d_gpu.o fftmpiw_gpu.o
CC         = icc
CXX        = icpc
CFLAGS     = -fPIC -DADD_ -Wall -openmp -DMAGMA_WITH_MKL -DMAGMA_SETAFFINITY -DGPUSHMEM=300 -DHAVE_CUBLAS
CUDA_ROOT  ?= /usr/local/cuda/
NVCC       := $(CUDA_ROOT)/bin/nvcc -ccbin=icc
CUDA_LIB   := -L$(CUDA_ROOT)/lib64 -lnvToolsExt -lcudart -lcuda -lcufft -lcublas
GENCODE_ARCH    := -gencode=arch=compute_30,code=\"sm_30,compute_30\" \
                   -gencode=arch=compute_35,code=\"sm_35,compute_35\" \
                   -gencode=arch=compute_60,code=\"sm_60,compute_60\"
MPI_INC    = $(I_MPI_ROOT)/include64/
  • VASP6.3.2
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxIFC\" \
              -DMPI -DMPI_BLOCK=8000 -Duse_collective \
              -DscaLAPACK \
              -DCACHE_SIZE=4000 \
              -Davoidalloc \
              -Dvasp6 \
              -Duse_bse_te \
              -Dtbdyn \
              -Dfock_dblbuf

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

FC          = mpiifort
FCL         = mpiifort -mkl=sequential

FREE        = -free -names lowercase

FFLAGS      = -assume byterecl -w -xHOST

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

OBJECTS     = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o /opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mkl/interfaces/fftw3xf/libfftw3xf_intel.a
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

# For the parser library
CXX_PARS    = icpc
LLIBS       = -lstdc++

##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##

# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
# VASP_TARGET_CPU ?= -xHOST
# FFLAGS     += $(VASP_TARGET_CPU)

# Intel MKL (FFTW, BLAS, LAPACK, and scaLAPACK)
# (Note: for Intel Parallel Studio's MKL use -mkl instead of -qmkl)
FCL        += -qmkl=sequential
MKLROOT    = /opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mkl
MKL_PATH   = $(MKLROOT)/lib/intel64
BLAS       =
LAPACK     =
BLACS      = -lmkl_blacs_intelmpi_lp64
SCALAPACK  = $(MKL_PATH)/libmkl_scalapack_lp64.a $(BLACS)
LLIBS      += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
INCS        =-I$(MKLROOT)/include/fftw

# HDF5-support (optional but strongly recommended)
#CPP_OPTIONS+= -DVASP_HDF5
#HDF5_ROOT  ?= /path/to/your/hdf5/installation
#LLIBS      += -L$(HDF5_ROOT)/lib -lhdf5_fortran
#INCS       += -I$(HDF5_ROOT)/include

# For the VASP-2-Wannier90 interface (optional)
#CPP_OPTIONS    += -DVASP2WANNIER90
#WANNIER90_ROOT ?= /path/to/your/wannier90/installation
#LLIBS          += -L$(WANNIER90_ROOT)/lib -lwannier

安装命令,

1
2
source /opt/longrun/intel2017/parallel_studio_xe_2017.5.061/psxevars.sh
chmod -R 755 ./* && make all #不要使用make all -j *

修改.bashrc

1
2
3
#vasp
export PATH=$PATH:/root/soft/vasp.5.4.4/bin
ulimit -s unlimited

运行

1
2
3
ulimit -s unlimited #与FFLAGS = -heap-arrays 64等价
mpirun -np 2 vasp_std > log
mpirun -np 2 vasp_std > log & #后台运行

VASPsol

  • 下载VASPsol

  • VASPsol/src/solvation.F覆盖添加到vasp.5.4.4/src

  • 修改makefile.includeCPP_OPTIONS,添加-Dsol_compat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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

VTST

VASP5.4.4+VTST

  • 下载VTST,包含vtstcode.tgzvtstscripts.tgz,软件替换只需vtstcode.tgz,也可以从这里下载vtstscripts最新版。

  • 修改src/main.F文件,将

1
2
CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, &
     LATT_CUR%A,LATT_CUR%B,IO%IU6)

          替换为

1
2
CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, &
     TSIF,LATT_CUR%A,LATT_CUR%B,IO%IU6)
  • src/.objects中的chain.o前面增加,
1
2
bfgs.o dynmat.o  instanton.o  lbfgs.o sd.o   cg.o dimer.o bbm.o \
fire.o lanczos.o neb.o  qm.o opt.o \
  • NEB计算之前,修改nebresults.pl,注释掉以下代码(L51-71),
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# # Zip the OUTCARs again
# print 'Zipping the OUTCARs again ... ' ;
# $zip = $ENV{'VTST_ZIP'};
# if($zip eq ''){ $zip = 'gzip'; }
# $i = 0;
# $string = "00";
# while(chdir $string) {
#     system "$zip OUTCAR";
#     $i++;
#     if($i < 10) { $string = "0$i"; }
#     elsif($i < 100) { $string = "$i"; }
#     chdir $dir;
# }
# print "done\n";

VASP6.3.2+VTST

1
2
CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, &
     LATT_CUR%A,LATT_CUR%B,IO%IU6)

          替换为

1
2
CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, &
     TSIF,LATT_CUR%A,LATT_CUR%B,IO%IU6)

          将

1
IF (LCHAIN) CALL chain_init( T_INFO, IO)

          替换为

1
CALL chain_init( T_INFO, IO)
  • vasp.6.3.2/src/.objects中的chain.o前面增加,
1
2
3
4
bfgs.o dynmat.o instanton.o lbfgs.o sd.o cg.o dimer.o bbm.o \
fire.o lanczos.o neb.o qm.o \
pyamff_fortran/*.o ml_pyamff.o \
opt.o \
  • 修改vasp.6.3.2/src/makefile文件,
1
2
3
LIB= lib parser pyamff_fortran
...
dependencies: sources libs

Wannier90

  • 下载wannier90

  • cp ./config/make.inc.ifort ./make.inc

  • 修改make.inc

1
LIBDIR = /opt/longrun/intel2017/compilers_and_libraries_2017.5.239/linux/mkl/lib/intel64_lin

          make wannier lib tests

  • 若vasp5.4.4与wannier90联用,需要修改makefile.include
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
             -DMPI -DMPI_BLOCK=8000 \
             -Duse_collective \
             -DscaLAPACK \
             -DCACHE_SIZE=4000 \
             -Davoidalloc \
             -Duse_bse_te \
             -Dtbdyn \
             -Duse_shmem \
             -DVASP2WANNIER90
CPP        = fpp -f_com=no -free -w0  $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
FC         = mpiifort
FCL        = mpiifort -mkl=sequential -lstdc++
FREE       = -free -names lowercase
FFLAGS     = -assume byterecl -w
OFLAG      = -O2 -xhost
OFLAG_IN   = $(OFLAG)
DEBUG      = -O0
MKLROOT    =/opt/longrun/intel2017/compilers_and_libraries_2017.5.239/linux/mkl
MKL_PATH   = $(MKLROOT)/lib/intel64
BLAS       = $(MKL_PATH)/libmkl_blas95_lp64.a
LAPACK     = $(MKL_PATH)/libmkl_lapack95_lp64.a
BLACS      = -lmkl_blacs_intelmpi_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)
LLIBS      += /opt/longrun/wannier90_3.0.0/libwannier.a
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
#================================================
# GPU Stuff
CPP_GPU    = -DCUDA_GPU -DRPROMU_CPROJ_OVERLAP -DUSE_PINNED_MEMORY -DCUFFT_MIN=28 -UscaLAPACK
OBJECTS_GPU = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d_gpu.o fftmpiw_gpu.o
CC         = icc
CXX        = icpc
CFLAGS     = -fPIC -DADD_ -Wall -openmp -DMAGMA_WITH_MKL -DMAGMA_SETAFFINITY -DGPUSHMEM=300 -DHAVE_CUBLAS
CUDA_ROOT  ?= /usr/local/cuda/
NVCC       := $(CUDA_ROOT)/bin/nvcc -ccbin=icc
CUDA_LIB   := -L$(CUDA_ROOT)/lib64 -lnvToolsExt -lcudart -lcuda -lcufft -lcublas
GENCODE_ARCH    := -gencode=arch=compute_30,code=\"sm_30,compute_30\" \
                   -gencode=arch=compute_35,code=\"sm_35,compute_35\" \
                   -gencode=arch=compute_60,code=\"sm_60,compute_60\"
MPI_INC    = $(I_MPI_ROOT)/include64/

文档