VASP.5.4.4+wannier90_v2.1+vtst+OPTCELL

The way to compile vasp equipped with related packages, including wannier90, VTST, constrained optimization.

Files:

  1. vasp.5.4.4.tar.gz
  2. patch.5.4.4.16052018.gz
  3. vasp.5.lib.tar.gz

Operations:

  1. Extract 1 and 3 using tar -zxvf, 2 by gun zip
  2. Move patch.5.4.4.16052018 into vasp.5.4.4 and go to the root of VASP
  3. patch -p0 < patch.5.4.4.16052018 (only for vasp.5.4.4)

Below are the VASP2WANNIER90v2 part, thanks for C.C.Xiao
4. Download wannier90_v2.1, then decompress and go to the root of wannier90-2.1.0
5. cp config/make.inc.ifort ./make.inc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 #=====================================================
# For Linux with intel version 11/12 on 64bit machines
#=====================================================
F90 = ifort
COMMS=mpi
MPIF90=mpiifort
FCOPTS=-O2
LDOPTS=-O2

#========================================================
# Intel mkl libraries. Set LIBPATH if not in default path
#========================================================

LIBDIR = {MKLROOT}/mkl/lib/intel64
LIBS = -L$(LIBDIR) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread

#=======================
# ATLAS Blas and LAPACK
#=======================
#LIBDIR = {Root_vasp.5.lib}
#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas
  1. make all, then make test (you will get the wannier90.x and libwannier.a)
  2. Fix the VASP2WANNIER90v2 interface

Below is Constrained Optimization:
8. Two methods:
For Orthorhombic:
vi src/constr_cell_relax.F

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
      SUBROUTINE CONSTR_CELL_RELAX(FCELL)
USE PREC
REAL(Q) FCELL(3,3),SAVE(3)
LOGICAL FILFLG
INTEGER ICELL(3)

INQUIRE(FILE='OPTCELL',EXIST=FILFLG)
IF (FILFLG) THEN
OPEN(67,FILE='OPTCELL',FORM='FORMATTED',STATUS='OLD')
READ(67,"(3I1)") (ICELL(I),I=1,3)
CLOSE(67)
DO I=1,3
SAVE(I)=FCELL(I,I)
ENDDO
FCELL=0.0D0
DO I=1,3
IF (ICELL(I)==1) FCELL(I,I)=SAVE(I)
ENDDO
ENDIF

! just one simple example
! relaxation in x directions only
! SAVE=FCELL(1,1)
! FCELL=0 ! F90 style: set the whole array to zero
! FCELL(1,1)=SAVE
! relaxation in z direction only
! SAVE=FCELL(3,3)
! FCELL=0 ! F90 style: set the whole array to zero
! FCELL(3,3)=SAVE

RETURN
END SUBROUTINE

For example:
ISIF=3 in INCAR
and OPTCELL file with "a b c" in text

For arbitrary crystal system:

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
      !SUBROUTINE CONSTR_CELL_RELAX(FCELL)
SUBROUTINE CONSTR_CELL_RELAX(IU5,IU0,FCELL)
USE PREC
REAL(Q) FCELL(3,3)!,SAVE(3)
!LOGICAL FILFLG
!INTEGER ICELL(3)

INTEGER IU5,IU0
! local variables
INTEGER IDUM, N, IERR, I, J
REAL(q) RDUM
COMPLEX(q) CDUM
LOGICAL LOPEN,LDUM
CHARACTER (1) :: CHARAC

! just one simple example
! relaxation in x directions only
! SAVE=FCELL(1,1)
! FCELL=0 ! F90 style: set the whole array to zero
! FCELL(1,1)=SAVE
! relaxation in z direction only
! SAVE=FCELL(3,3)
! FCELL=0 ! F90 style: set the whole array to zero
! FCELL(3,3)=SAVE

LOGICAL IOPTCELL
INTEGER :: ICELL(9)=1

LOPEN=.FALSE.
OPEN(UNIT=IU5,FILE="INCAR",STATUS='OLD')

IOPTCELL=.FALSE.
CALL RDATAB(.FALSE.,"INCAR",IU5,'IOPTCELL','=','#',';','I', &
& ICELL,RDUM,CDUM,LDUM,CHARAC,N,9,IERR)
IF (((IERR/=0).AND.(IERR/=3)).OR. &
& ((IERR==0).AND.(N<1))) THEN
IF (IU0>=0) &
WRITE(IU0,*)'Error reading item ''IOPTCELL'' from file INCAR.'
ICELL(6)=1
ENDIF

! WRITE(*,*) ICELL
! set logical
IF (ANY(ICELL .NE. (/1,1,1,1,1,1,1,1,1/) )) THEN
IOPTCELL=.TRUE.
!IF (IU0>=0) WRITE(IU0,'(X,A,I1,I1,I1,I1,I1,I1,I1,I1,I1)') 'Constraining cell:',ICELL(1),ICELL(2),ICELL(3),ICELL(4),ICELL(5),ICELL(6),ICELL(7),ICELL(8),ICELL(9)
IF (IU0>=0) WRITE(IU0,'(X,A,3I3,A,3I3,A,3I3)') 'Constraining cell:',ICELL(1:3),' |',ICELL(4:6),' |',ICELL(7:9)
ENDIF
CLOSE(IU5)

IF (IOPTCELL) THEN
DO J=1,3
DO I=1,3
IF (ICELL((I-1)*3+J)==0) FCELL(I,J)=0.0
ENDDO
ENDDO
ENDIF

RETURN
END SUBROUTINE

and modify src/main.F(line 3559), replace CALL CONSTR_CELL_RELAX(D2SIF) with CALL CONSTR_CELL_RELAX(IO%IU5,IO%IU0,D2SIF)

For example:
ISIF=3
IOPTCELL = $a_{1}$ $a_{2}$ $a_{3}$ $b_{1}$ $b_{2}$ $b_{3}$ $c_{1}$ $c_{2}$ $c_{3}$ in INCAR
IOPCELL denotes the lattice matrix elements in POSCAR from line 3 to 5 whether fixed (0) or free (1)

$$
\begin{bmatrix}
a_{1} & b_{1} & c_{1} \
a_{2} & b_{2} & c_{2} \
a_{3} & b_{3} & c_{3}
\end{bmatrix}
$$

Below is VTST:
9. Download vtst and decompress
10. Install
vi src/main.F(line 3146)
replace

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

with

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

To install, download the files in vtst/src into vasp.5.4.4/src. The file chain.F is replaced, so back up the old version.

vi src/.objects

Add 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 behind chain.o

This code will only be run if IMAGES is set in the INCAR file, or if ICHAIN is set, to specify which method should be run.

ICHAIN=0: Nudged elastic band (default)
ICHAIN=1: Dynamical matrix
ICHAIN=2: Dimer
ICHAIN=3: Lanczos
11. makefile.include in vasp root

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
76
77
78
79
80
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
-DMPI -DMPI_BLOCK=8000 \
-Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Duse_bse_te \
-Dtbdyn \
-Duse_shmem -DVASP2WANNIER90v2

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
OFLAG_IN = $(OFLAG)
DEBUG = -O0

MKLROOT = {MKLROOT}
MKL_PATH = $(MKLROOT)/lib/intel64
BLAS = -L$(MKL_PATH) -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread
LAPACK = -L$(MKL_PATH) -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread
BLACS = -L$(MKL_PATH) -lmkl_blacs_intelmpi_lp64
SCALAPACK = $(MKL_PATH)/libmkl_scalapack_lp64.a $(MKL_PATH)/libmkl_scalapack_ilp64.a $(BLACS)

OBJECTS = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d.o {FFTWROOT}/lib/libfftw3_mpi.a

INCS = -I/{FFTWROOT}/include

LLIBS = {wannier90-2.1.0_ROOT}/libwannier.a $(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/
  • VASP is a commercial package, be sure you have a proper license to use it.

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!