xiaoqiugood的个人博客分享 http://blog.sciencenet.cn/u/xiaoqiugood

博文

VASP不同情形下的安装编译:自旋轨道耦合计算及wannier函数调用

已有 17984 次阅读 2014-6-11 16:26 |个人分类:软件安装及编译|系统分类:科研笔记


关注:

1) VASP编译过程中各参数的物理意义

2) 不同使用条件下的VASP编译


自旋轨道耦合情形:


     将VASP 的makefile 文件中的 CPP 选项中的 -DNGXhalf, -DNGZhalf, -DwNGXhalf, -DwNGZhalf 这4个选项去掉重新编译VASP才能计算自旋轨道耦合效应

“ If you include relativistic effects (LSORBIT), non-collinear magnetism is automatically included as well (if you have not set LNONCOLLINEAR = .True. yourself). The appropriate vasp-executable for non-collinear magnetic structures has to be generated without the -DNGXhalf,... -DwNGXhalf,... precompiler options ”


wannier调用VASP编译设置


Mind: VASP needs to be compiled with the following additional precompiler flag:

-DVASP2WANNIER90

and the variable LIB in the makefile must contain an entry that points to libwannier.a.

For instance:

LIB     = -L../vasp.5.lib -ldmy       ../vasp.5.lib/linpack_double.o (SCA) (SCA) (LAPACK) $(BLAS)

might be changed to

LIB     = -L../vasp.5.lib -ldmy  \     ../vasp.5.lib/linpack_double.o ../wannier90-1.2/libwannier.a $(SCA) (LAPACK) (LAPACK) (BLAS)

depending on where you have installed WANNIER90, obviously.


重新编译命令
make clean
make



附-编译错误摘录1

You can still use the C preprocessor, try commenting out the line
CPP_=fpp -f_com=no -free -w0 $*.F $*$(SUFFIX)
in your makefile and that might help. Also, I agree with Hunter that the Intel Fortran compiler is probably the best way to go



Dear krparam,

the first error can be ignored (read the output...), and the second one is addressed in the Makefile:
# this release should be fpp clean
# we now recommend fpp as preprocessor
# if this fails go back to cpp
CPP_=fpp -f_com=no -free -w0 $*.F $*$(SUFFIX)

...so set fpp back to cpp and try again.


Reverting to cpp, by commenting out the second CPP line in the Makefile:

CPP_ = ./preprocess <$*.F | /usr/bin/cpp -P -C -traditional >$*$(SUFFIX)

# this release should be fpp clean
# we now recommend fpp as preprocessor
# if this fails go back to cpp
#CPP_=fpp -f_com=no -free -w0 $*.F $*$(SUFFIX)    【通常这个是没有注释掉的】

fixes this.

Thanks


wannier计算错误摘录2


mlwf.o: In function `mlwf_mp_mlwf_wannier90_':
mlwf.f90:(.text+0x2de6): undefined reference to `wannier_setup_'
mlwf.f90:(.text+0x8c36): undefined reference to `wannier_run_'
mlwf.f90:(.text+0xb5cd): undefined reference to `wannier_run_'
make: *** [vasp] Error 1


(三)常规VASP的安装编译步骤  (Ubuntu为例)

1) 安装MICH

2) 安装编译器,如Intel编译器

  http://www.knowsky.com/618579.html

3) 安装VASP



可参考:

http://blog.sciencenet.cn/blog-100989-717066.html




Intel编译器安装

http://www.knowsky.com/618579.html

http://www.linuxdiyf.com/linux/18424.html


一、编译器的获取:
下载intel 非商业版的fortran和c++编译器。
下载地址:http://software.intel.com/en-us/non-commercial-software-development
点击ifort链接: Intel? Fortran Composer XE 2013 for Linux
按要求填写邮件和地址,之后,intel会给该邮件发一封邮件,内有下载链接及激活的密钥。
比如下载的ifort编译器为: l_fcompxe_ia32_2013.1.117.tgz


二、具体安装过程
下载完成之后,将文件复制在住文件夹下,在终端中完成安装,具体步骤如下:
1、sudo apt-get install g++ 首先要安装g++
2、tar -vxzf l_fcompxe_ia32_2013.1.117.tgz
3、cd l_fcompxe_ia32_2013.1.117
4、sudo ./install.sh 回车
5、第4步之后,安装过程会要求输入accept 、密钥等,照实输入,其他回车即可,安装过程可能有个java错误,忽略。
6、路径的设置:sudo gedit ~/.bashrc
在.bashrc末尾加入ifort变量
source /opt/intel/composer_xe_2013.1.117/bin/ifortvars.sh ia32
source /opt/intel/composer_xe_2011.1.117/bin/ifortvars.sh intel64
安装icc步骤和上面一样,重新下载icc的编译器,最后环境变量稍微不同
source /opt/intel/composer_xe_2011.1.117/bin/iccvars.sh ia32
source /opt/intel/composer_xe_2011.1.117/bin/icctvars.sh intel64
7、查看是否安装成功。注销,在终端输入:which ifort
本例子会显示:/opt/intel/composer_xe_2013.1.117/bin/ia32/ifort
8、安装成功
注:(环境变量的路径获取,打开ubuntu文件系统,依次进入opt/intel/composer_xe_2011.1.117/bin,在bin下找一个文件,右键查看属性,有位置提示,复制即可)。




朝花夕拾

安装vasp.libvasp
     vasp.lib的安装跟往常一样,只要最后生成libdmy.a就可以了.
     然后进入vasp目录,根据实际平台和编译器选择相应的makefile进行编辑,譬如我们用makefile.linux_ifc_opt复制成makefile,下面我们对这个makefile进行编辑,主要修改的几个地方如下:
     FC = mpif90
     #选择我们用mpich下重新编译的fortran90
     OFLAG=-O2 -xW -tpp7
     #编译优化参数,根据我们实际平台选择
     BLAS  = -L/home/[your_mkl_library_directory] -lmkl_em64t -lguide -lpthread
     LAPACK= -lmkl_lapack
     LINK  = -lsvml -L/home/[your_mkl_library_directory]
     CPP   = $(CPP_) -DMPI  -DHOST=\"LinuxIFC\" -DIFC -Dkind8 -DNGZhalf -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc -DMPI_BLOCK=2000 -Duse_cray_ptr
     FFT3D = fftmpi.o fftmpi_map.o fft3dlib.o
    修改完后,保存一下
     make && make install就可以了
     
     另外,如果用的是自己编译的FFTW库的话,记得把fftw3.f也拷贝到当前目录.

     如果按上面执行顺利的话,我们就可以得到并行版的vasp.




4 Vasp.5.lib

  tar  zxvf vasp.5.lib.tar.gz
  cd vasp.5.lib
  cp makefile.linux_ifc_P4 makefile
  Vi makefile
      CPP     = /home/ljzhou86/intel/composer_xe_2011_sp1.9.293/bin/intel64/icc -E -P -C .F>∗.F>*.f
  FC=ifort
  make

5 VASP5.3的安装

vi makefile

  CPP_ =  ./preprocess <<span class="MathJax" id="MathJax-Element-2-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML">&#x2217;.F<mrow class="MJX-TeXAtom-ORD"><mo stretchy="false">|<mrow class="MJX-TeXAtom-ORD">/usr<mrow class="MJX-TeXAtom-ORD">/bin<mrow class="MJX-TeXAtom-ORD">/cpp&#x2212;P&#x2212;C&#x2212;traditional&gt;" role="presentation" style="margin:0px;padding:0px;word-wrap:normal;display:inline;line-height:normal;word-spacing:normal;float:none;direction:ltr;max-width:none;max-height:none;min-width:0px;min-height:0px;border:0px;position:relative;">.F|/usr/bin/cppPCtraditional>∗.F|/usr/bin/cpp−P−C−traditional>*$(SUFFIX)

  CPP_=fpp -f_com=no -free -w0 <span class="MathJax" id="MathJax-Element-3-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML">&#x2217;.F" role="presentation" style="margin:0px;padding:0px;word-wrap:normal;display:inline;line-height:normal;word-spacing:normal;float:none;direction:ltr;max-width:none;max-height:none;min-width:0px;min-height:0px;border:0px;position:relative;">.F∗.F*$(SUFFIX)

 

  OFLAG=-O3  

 

  FFLAGS = -I /home/ljzhou86/app/fftw -FR

 

  BLAS=  -L/home/ljzhou86/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_blacs_lp64 -lmkl_intel_thread  -liomp5 -lpthread   -lmkl_sequential -lmkl_core -i-static


  LAPACK= -L/home/ljzhou86/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64  -lmkl_intel_lp64  -lmkl_blacs_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lmkl_lapack95_lp64 -lpthread

 

  FC=mpif90
FCL=$(FC)

  CPP    = $(CPP_) -DMPI  -DHOST=\"LinuxIFC\" -DIFC \
   -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc -DNGZhalf \
   -DMPI_BLOCK=8000 -Duse_collective
#    -DRPROMU_DGEMV  -DRACCMU_DGEMV

 

  FFT3D   = fftmpi.o fftmpi_map.o fft3dfurth.o fft3dlib.o

 
LIB     =  -limf -lm -L../vasp.5.lib -ldmy  \
    ../vasp.5.lib/linpack_double.o <span class="MathJax" id="MathJax-Element-4-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mo stretchy="false">(LAPACK<mo stretchy="false">)&#xA0;" role="presentation" style="margin:0px;padding:0px;word-wrap:normal;display:inline;line-height:normal;word-spacing:normal;float:none;direction:ltr;max-width:none;max-height:none;min-width:0px;min-height:0px;border:0px;position:relative;">(LAPACK) (LAPACK)
(SCA) $(BLAS)

警告:/…/libimf.so: warning: warning: feupdateenv is not implemented and will always fail
对于VASP的解决办法是把系统的math libraries加入,即-limf –lm

1.1. 编译 vasp.4.lib

i. tar zxvf vasp.4.lib.tar.gz

ii. cd vasp.4.lib

iii. cp makefile.linux_ifc_P4 Makefile

iv. 修改Makefile

vim Makefile

19 行  FC=ifc  改为 FC=ifort

22行为FFLAGS = -O0 -FI 改为FFLAGS = -O2 -FI

v. 编译库文件

make

1.2. 编译vasp 主程序

i. tar xvzf vasp.4.6.tar.gz

ii. cd vasp.4.6

iii. cp makefile.linux_ifc_P4 Makefile

iv. 修改Makefile文件

50行   FC=ifc 改为 FC=ifort

102行  OFLAG=-O3 -xW -tpp7 改为OFLAG=-O3 -xhost -ip -funroll-loops

136  修改blas库的的位置

对于amd平台 修改为

BLAS=  /public/software/mathlib/goto2/libgoto2.a

对于intel平台 修改为如下2

MKLHOME/public/software/intel/Compiler/11.1/059/mkl/lib/em64t/

BLAS=  -L$(MKLHOME) -lmkl_intel_lp64 -lmkl_sequential -lmkl_lapack -lmkl_core

201#FC=mpif77  改为FC=mpif90

202 #FCL=$(FC) 改为FCL=$(FC)

211 行 去掉# 改为

CPP    = $(CPP_) -DMPI  -DHOST=\"LinuxIFC\" -DIFC \

212 行 去掉#,并删除 -Dkind8 -DNGZhalf ,改为

      -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc \

213 行 去掉# 改为 -DMPI_BLOCK=500  \

233 235 行 去掉#号,改为

   LIB     = -L../vasp.4.lib -ldmy  \

    ../vasp.4.lib/linpack_double.o $(LAPACK) \

$(SCA) $(BLAS)

            238 行 去掉#号,改为

                FFT3D   = fftmpi.o fftmpi_map.o fft3dlib.o

            343

$(FC) -FR -lowercase -O1 -tpp7 -xW -prefetch- -unroll0 -e95 -vec_report3 -c $*$(SUFFIX)

改为   $(FC) -FR -lowercase -O2  -xhost  -c $*$(SUFFIX)

         

v. 载入使用的mpi的环境变量

source /public/software/mpi/openmpi1.3.4-intel.sh

vi. 编译

make

生成vasp文件即为可执行文件

vii. 复制可执行文件到/public/software

cp vasp /public/software/vasp/vasp-openmpi-ifort

2. 手动运行vasp

i. 准备算例,使用普通用户test运行算例

su - test

cp /public/sourcecode/benchmark.Hg.tar.gz ./

tar xvzf benchmark.Hg.tar.gz

cd vasp.Hg

cp IN-short INCAR

ii. 载入使用的mpi的环境变量

source /public/software/mpi/openmpi1.3.4-intel.sh

iii. 手动运行vasp

mpirun -np 32 -machinefile ma /public/software/vasp/vasp-openmpi-ifort

openmpi 程序运行方式参见《曙光HPC调试手册》

iv. 建立运行脚本run.sh,脚本内容为

mpirun -np 32 -machinefile ma /public/software/vasp/vasp-openmpi-ifort

修改run.sh 的权限为可执行

chmod +x run.sh





https://blog.sciencenet.cn/blog-567091-802515.html

上一篇:GW计算带隙-来自VASP官网的算例分析
下一篇:google不能访问之如何搜索英文信息
收藏 IP: 125.67.186.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (4 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-7-24 18:30

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部