Eastsheng's Wiki

VASP安装与编译

2022-09-18 18:11:28

[toc]

VASP5.4.4安装

一、安装 Intel® oneAPI Base Toolkit 和 Intel® oneAPI HPC来替代

  • 在安装之前需要安装一系列依赖包:

    1
    2
    sudo apt-get install libgtk-3-0 libxss1 libnss3 libgtk2.0 libpango-1.0-0 libasound2 
    sudo apt-get install xorg openbox
  • intel® oneAPI Base Toolkit 安装:

    1
    2
    wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18673/l_BaseKit_p_2022.2.0.262_offline.sh
    sudo sh ./l_BaseKit_p_2022.2.0.262_offline.sh
  • Intel® oneAPI HPC 安装

    1
    2
    wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191_offline.sh
    sudo sh ./l_HPCKit_p_2022.2.0.191_offline.sh
  • 添加环境变量并查看是否安装好:

    最好把source /opt/intel/oneapi/setvars.sh intel64写进~/.bashrc中

    1
    2
    3
    4
    5
    source /opt/intel/oneapi/setvars.sh intel64
    icc -v
    ifort -v
    mpiicc -v
    mpiifort -v

二、编译

1
2
3
4
5
6
7
8
tar -zxvf vasp.5.4.4.tar.gz
cd vasp.5.4.4
cp -r /opt/intel/oneapi/mkl/2022.1.0/interfaces/fftw3xf . # cp MKL中的fftw库到vasp文件夹中
cd fftw3xf/
make libintel64
cd ..
cp arch/makefile.include.linux_intel makefile.include # 修改makefile.include,在OFLAG后添加-xAVX,如:OFLAG = -xAVX -O2
make all

VASP6.3.2安装

一、安装 Intel® oneAPI Base Toolkit 和 Intel® oneAPI HPC来替代

  • 在安装之前需要安装一系列依赖包:
1
2
sudo apt-get install libgtk-3-0 libxss1 libnss3 libgtk2.0 libpango-1.0-0 libasound2 
sudo apt-get install xorg openbox
1
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/e6ff8e9c-ee28-47fb-abd7-5c524c983e1c/l_BaseKit_p_2024.2.1.100_offline.sh
1
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d461a695-6481-426f-a22f-b5644cd1fa8b/l_HPCKit_p_2024.2.1.79_offline.sh
  • 添加环境变量并查看是否安装好:

    最好把source /opt/intel/oneapi/setvars.sh intel64写进~/.bashrc中

1
2
3
4
5
6
source /opt/intel/oneapi/setvars.sh intel64
icx -v
icpx -v
ifort -v
mpiicc -v
mpiifort -v

二、编译

1
2
3
4
5
6
7
8
9
10
11
12
unzip vasp.6.3.2.zip
cd vasp.6.3.2
cp -r /opt/intel/oneapi/mkl/2024.2/share/mkl/interfaces/fftw3xf . # cp MKL中的fftw库到vasp文件夹中
cd fftw3xf/
make libintel64
cd ..
cp arch/makefile.include.intel makefile.include
vim makefile.include
# 修改makefile.include,如下
# CC_LIB = icx
# CXX_PARS = icpx
make all

make[2]: Leaving directory ‘/home/xxx/softwares/vasp/vasp.6.3.2/build/ncl’
make[1]: Leaving directory ‘/home/xxx/softwares/vasp/vasp.6.3.2/build/ncl’

三、环境变量

1
2
3
4
5
6
cd bin
ls
# vasp_gam vasp_ncl vasp_std
sudo vim ~/.bashrc
# export PATH=/home/xxx/softwares/vasp/vasp.6.3.2/bin:$PATH

VASP6.3.2安装:快速安装

如果上述安装不成功,可以试试下面这个

http://bbs.keinsci.com/thread-33640-1-1.html

  • 安装必要库:

    1
    2
    3
    sudo apt update
    sudo apt upgrade
    sudo apt install build-essential gfortran libopenblas-dev libopenmpi-dev libscalapack-openmpi-dev libfftw3-dev libhdf5-openmpi-dev libfftw3-mpi-dev cmake pkg-config
  • 解压:

    1
    2
    3
    4
    unzip vasp.6.3.2.zip
    cd vasp.6.3.2

    cp arch/makefile.include.gnu_omp makefile.include
  • 修改 makefile.include:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    # BLAS and LAPACK (mandatory)
    #OPENBLAS_ROOT ?= /path/to/your/openblas/installation
    BLASPACK = -lopenblas

    # scaLAPACK (mandatory)
    #SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
    SCALAPACK = -lscalapack-openmpi

    # FFTW (mandatory)
    #FFTW_ROOT ?= /path/to/your/fftw/installation
    LLIBS += -lfftw3 -lfftw3_omp
    INCS += -I/usr/include

    # HDF5-support (optional but strongly recommended)
    CPP_OPTIONS+= -DVASP_HDF5
    #HDF5_ROOT ?= /path/to/your/hdf5/installation
    LLIBS += -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi/ -lhdf5_fortran
    INCS += -I/usr/include/hdf5/openmpi/
  • 编译:

    1
    make DEPS=1 -j

官网H2O例子

  • H2O VASP官网例子
    • POSCAR
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    H2O _2
    0.52918 ! scaling parameter
    15 0 0
    0 15 0
    0 0 15
    1 2
    select
    cart
    0.00 0.00 0.00 F F F
    1.10 -1.43 0.00 T T F
    1.10 1.43 0.00 T T F
  • INCAR
1
2
3
4
5
6
7
PREC = Normal    ! standard precision 
ENMAX = 400 ! cutoff should be set manually
ISMEAR = 0 ; SIGMA = 0.1
IBRION = 1 ! use DIIS algorithm to converge
NFREE = 2 ! 2 independent degrees of freedom
NSW = 10 ! 10 ionic steps
EDIFFG = -0.02 ! forces smaller 0.02 A/eV
  • KPOINTS
1
2
3
4
5
Gamma-point only
0
Monkhorst Pack
1 1 1
0 0 0
  • POTCAR
  • 官网自带的有,也可以从赝势库中自己手动生成:
1
cat ~/softwares/VASP/PAW_PBE/O/POTCAR ~/softwares/VASP/PAW_PBE/H/POTCAR >POTCAR
  • 运行命令:mpirun -np 16 vasp_std

参考与可视化以及后处理程序资源: