debian9下VASP的安装

操作系统:debian 9
vasp版本:5.4.4
parallel_studio_xe_2018_cluster_edition

本站不提供任何关于vasp的源代码,请自行寻找。


2019-5-9更新, 请用”su –“切换到root用户,而不要用”su root” ,默认全是在管理员权限下操作


1.准备

vasp5.4.4源码,官网
Intel®ParallelStudio XE,下载地址

为什么要使用Intel的 Fortran 编译器,而非 gfortran ,主要考虑以下两点

1.inter的 Fortran 编译器对Intel的CPU肯定优化的更好,听说对AMD的是负优化。对于像我们这种弄着玩的也无关紧要,但在科研中就不一样了。

2.gfortran在编译过程会出现大量错误信息。本人深受其害。解决了这一个,下一个问题又出来了。而且REAME中也是以Intel composer suite (Fortan compiler + MKL libraries)进行说明。

Intel的Fortran编译器是收费的,但是有学生版的,请看这里

在强调一遍,除非你对你自己非常有自信,否则请用ifort(Intel Fortran)。

2.安装并行编译器

你可以用源码进安装openmpi,也可以安装Intel® Parallel Studio XE并行开发套件(会自动安装mpif90,mpirun)。

使用源码安装也并不复杂,但是中间会出现一些小问题,谷歌一下就能找到解决方案,因为安装Intel并行开发套件时会安装mpirun,也为了教程的简洁。就不介绍如何使用源码安装了,因为本人刚开始用 gfortran 编译时,曾用源码安装过openmpi,安装时还是需要一定的能力的(包括如何从互联网上获的有用的信息)。

对于Intel®ParallelStudio XE,可以解压后以gui的方式安装,也就是执行那个install_GUI.sh

3.加载英特尔编译器和编译英特尔FFTW包装器

请将下面的路径改为你自己安装Intel®ParallelStudio XE时的路径。

source /opt/intel/compilers_and_libraries_2018.0.128/linux/bin/compilervars.sh intel64
cd /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/interfaces/fftw3xf/
make libintel64 compiler=gnu

    2018-5-18 更新,不建议采用以下划掉的方法,原因见这里

在/etc/profile.d/下面新建一个文件

cd /etc/profile.d/
vim Intel_Path.sh

并加入下面内容

#       begin   2018-5-18       add intel PATH
 export PATH=$PATH:/opt/intel/compilers_and_libraries/linux/bin/intel64:/opt/intel/compilers_and_libraries_2018.0.128/linux/mpi/intel64/bin
#       end     2018-5-18       add intel PATH

export PATH=$PATH=/xx1/:/xx2/ 是添加新的路径到PATH里面

保存退出,只有用户有读的权限就行。

在 /etc/ld.so.conf.d/ 下新建一个文件

cd /etc/ld.so.conf.d/
vim intel-share-lib.conf

填写下面内容(根据实际情况填写)

#       begin   2018-5-18       share-lib
/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin/
#       end     2018-5-18       share-lib

让动态链接库为系统所共享,执行

ldconfig

刷新

source /etc/profile.d/Intel_Path.sh

这样应该就行了,我本人安装时是按照划掉的部分安装的,等到重启后执行命令发现有报错,才发现这个问题。不过,这样做从理论上是行的通的。不外乎把相关的命令写入到PATH变量中。


编辑profile

vim /etc/profile

在PATH中加入

/opt/intel/compilers_and_libraries/linux/bin/intel64/opt/intel/compilers_and_libraries_2018.0.128/linux/mpi/intel64/bin,请改为你自己对应的路径。最终,PATH路径应该类似这样

if [ "`id -u`" -eq 0 ]; then
   PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/intel/compilers_and_libraries/linux/bin/intel64:/opt/intel/compilers_and_libraries_2018.0.128/linux/mpi/intel64/bin"
else
   PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/altera/17.1/modelsim_ase/bin:/opt/intel/compilers_and_libraries/linux/bin/intel64:/opt/intel/compilers_and_libraries_2018.0.128/linux/mpi/intel64/bin"
fi
export PATH

在后面添加如下内容,并将相应路径改为你自己的

# begin 2018-5-17 add fortran_LD_LIBRARY_PATH
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin"
else
LD_LIBRARY_PATH="/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
#end 2018-5-17 add fortran_LD_LIBRARY_PATH

刷新

source /etc/profile

4.编译VASP

将VASP源码解压到/usr/local/src/,并进入到解压后的目录。

tar -zxvf vasp.5.4.4.tar.gz -C /usr/local/src/
cd /usr/local/src/vasp.5.4.4/
cp /opt/intel/mkl/include/fftw/fftw3.f .

然后

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

这里说明一下,官方的REDME中说的是复制最适合你系统的那个文件,但是复制makefile.include.linux_gnu后面会遇到大量问题,因此并不推荐(视具体情况判断)。

用8核来进行编译

make veryclean
make -j8 all

参数 all 是安装所有的版本(std版,gamma版,non-collinear版),对于它们的区别,由于不是专业的,并不知道它们的差异,你也可以使用

make std 之只安装std版,make gam 安装gamma版和 make ncl 安装non-collinear版

如果不出意外的话,vasp到此就算是安装完成了。

为了方便使用vasp这个命令,我们可以把它添加到PATH中,编辑/etc/profile,在PATH中加入vasp的路径(在/usr/local/src/vasp.5.4.4/build/下的三个文件中都有vasp这个命令),可以将不同文件夹下的vasp改为不同的名字以便区分。

5.测试

vasp源代码由四个文件组成,什么意思呢,就是说在一个文件夹中,必须有INCAR  KPOINTS  POSCAR  POTCAR这四个文件,可以从官网下载,点击哪些Example Files就是,下载完后,解压,进入到解压后的文件夹,直到有上面这四个文件,执行

/usr/local/src/vasp.5.4.4/build/std/vasp > out &

“ > out ”为输出为out文件,也就是最后数据保存的地方,& 表示在后台执行,你也可以不加去掉” > out &”,查看vasp是否安装成功,这个对于懂Linux的都不陌生。

更多用法,这里有一些可供参考的命令,可以自己上网搜索一下,包括如何使用并行计算,如何优化等。更多vasp的教程,可以参考这里

查看重启后命令执行是否正常。

6.总结

虽然这篇教程写出来看着很简单,但是却是花费了我大量的时间,一步一步尝试,遇到错误,看看出错日志,简单的就自己解决,复杂一点的就上网查资料,而且不一定能查到,因为你很难想象会在哪一步出错,网上的解决方案也不一定适合你,因为你不能保证和它的环境一模一样。就算你跟着这个教程一步一步做,也并不能保证就一定会成功。

如果在这个过程中遇到了其它问题,欢迎在评论区留言,或者Google一下,也欢迎把具体的解决方法留在评论区,以供后来者参考

参考:

Subscribe
提醒
guest
7 评论
最旧
最新
内联反馈
查看所有评论
ufabet911

I do not even understand how I ended up here, but I assumed this publish used to be great

ufabet911 ทางเข้า

I just like the helpful information you provide in your articles

ufaland

I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.

UFABET

I do not even understand how I ended up here, but I assumed this publish used to be great

ufabet

I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.

ufabet

I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

ufabet

Good post! We will be linking to this particularly great post on our site. Keep up the great writing