2025年4月Intel平台VASP.6.4.3的编译安装

2025年4月Intel平台VASP.6.4.3的编译安装


WSL的安装

个人对Arch Linux比较熟悉,安装后只用于学习使用,不作为稳定的生产力环境,故选择Arch Linux,洋垃圾配置如下,两颗E5 2676 v3

洋垃圾配置

打开powershell或者终端,输入wsl --install archlinux以自动安装,这一步需要使用代理(MAGIC),主机上使用Clash-Verge进行代理,终端中输入:

1
2
set http_proxy=http://127.0.0.1:7897 #自己使用的端口是7897,http代理
set https_proxy=http://127.0.0.1:7897 #自己使用的端口是7897,https代理

如果没有条件使用代理,也可以手动安装,参考Arch Wikihttps://wiki.archlinuxcn.org/wiki/在_WSL_上安装_Arch_Linux,手动下载`.wsl`镜像,然后安装

(似乎WSL的安装现在都需要使用代理了、、、)

安装成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@NAS ~]# fastfetch
-` root@NAS
.o+` --------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: Windows Subsystem for Linux - archlinux (2.4.12)
`+oooooo: Kernel: Linux 5.15.167.4-microsoft-standard-WSL2
-+oooooo+: Uptime: 5 hours, 16 mins
`/:-:++oooo+: Packages: 155 (pacman)
`/++++/+++++++: Shell: bash 5.2.37
`/++++++++++++++: WM: WSLg 1.0.65 (Wayland)
`/+++ooooooooooooo/` Terminal: xterm-256color
./ooosssso++osssssso+` CPU: Intel(R) Xeon(R) E5-2676 v3 (48) @ 2.39 GHz
.oossssso-````/ossssss+` Memory: 1.09 GiB / 15.57 GiB (7%)
-osssssso. :ssssssso. Swap: 304.95 MiB / 4.00 GiB (7%)
:osssssss/ osssso+++. Disk (/): 18.67 GiB / 1006.85 GiB (2%) - ext4
/ossssssss/ +ssssooo/- Disk (/mnt/c): 159.05 GiB / 237.01 GiB (67%) - 9p
`/ossssso+/:- -:/+osssso+- Disk (/mnt/d): 13.16 TiB / 14.55 TiB (90%) - 9p
`+sso+:-` `.-/+oso: Disk (/mnt/e): 1.70 TiB / 3.64 TiB (47%) - 9p
`++:. `-/+/ Disk (/mnt/f): 49.45 GiB / 476.94 GiB (10%) - 9p
.` `/ Disk (/mnt/g): 25.16 TiB / 29.10 TiB (86%) - 9p
Local IP (eth0): 172.31.36.99/20
Locale: en_US.UTF-8

编译器的安装

1
2
3
4
5
6
7
8
9
10
11
pacman -S make
pacman -S cmake
pacman -S gcc
pacman -S gcc-fortran
####发现gcc和gfortran编译器太新,会编报错(C23),故降级软件包
#添加中科大源来安装yay
pacman -Syy yay
yay -S downgrade #安装降级工具
downgrade -S gcc-libs #选择12.1.0版本,安装gcc的依赖
downgrade -S gcc #安装gcc,选择12.1.0版本
downgrade -S gcc-fortran #安装gforran,选择12.1.0版本

前往Intel官网下载oneAPI BaseTool kithttps://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?packages=oneapi-toolkit&oneapi-toolkit-os=linux&oneapi-lin=online

1
2
chmod +x ./xxxxxxxxxx.sh #赋予下载下来的sh文件可执行权限
./xxxx.sh #运行sh文件

oneAPI BaseTool kit不需要全部安装,只需安装MKL部分,博主忘了哪些是必须的了、、、

HPC也只需安装一部分

此处博主踩了较多的坑:

  • 编译器采用2022版,不可采用过新编译器
    • 2024年10月后,Intel删除了ifort编译器
  • gcc编译器不可太新,否则编译某些fortran模块会报错,博主从14降级到了12.1.0

VASP.6.4.3的编译安装

源码包可以去各大私密性较强的论坛或者微信公众号获取,仅供个人学习使用,不用于学术、商业用途

选择arch/目录中的模板makefile.include.intel,复制到../(上一层目录),并修改名称为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
61
62
63
64
65
66
67
68
69
70
# 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

FREE = -free -names lowercase

FFLAGS = -assume byterecl -w

OFLAG = -O2 -xhost #添加-xhost标记
OFLAG_IN = $(OFLAG)
DEBUG = -O0

OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
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/intel/oneapi/mkl/2022.1.0 #一定要添加MKLROOT的目录,否则会报错
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

然后开始编译

发现使用命令make all -j48会编译报错

于是改为官方wiki的命令make DEPS=1 -j48,编译成功

测试

make test进行测试,有一些报错,懒得管了、、、能跑就行


2025年4月Intel平台VASP.6.4.3的编译安装
https://hydrogen1222.xyz/2025/04/21/科研/VASP/2025-04-21-2025年4月Intel平台VASP.6.4.3的编译安装/
作者
Storm Talia
发布于
2025年4月21日
许可协议