GPAW 在个人电脑上的安装

来源:互联网 发布:比价软件推荐 编辑:程序博客网 时间:2024/06/05 12:07

GPAW 是一款开源DFT的科学计算软件,其官网地址,可以解TDDFT问题,类似于OCTOPUS。GPAW基于projector-augmented wave(PAW)方法和atomic simulation environment(ASE)。少见的与python库相关的第一性原理软件,大多数第一性原理软件都是用FORTRAN写成。本文介绍如何在个人电脑上安装GPAW的具体过程。

1. 安装前提(Requirement)

  • Python 2.6-3.5

  • NumPy 1.6.1 or later (base N-dimensional array package)

  • ASE 3.13 or later (atomic simulation environment)

  • a C-compiler

  • LibXC 2.0.1 or later

  • BLAS and LAPACK libraries

由于自己电脑已经安装anaconda2(python2.7) 和 anaconda3(python3.6). GPAW只支持到3.5前的版本,所以计划用Python2.7 版。

1.1 失败的尝试

应用virtualenv创建一个专门服务于GPAW的环境,不至于改动电脑配置的python大环境。

$ mkdir GPAW$ cd GPAW$ ~/anaconda2/bin/virtualenv --no-site-packages venv

这样在GPAW目录下就创建了python2.7环境,当然在shell中激活它:

$ source venv/bin/activate

接下来就是安装numpy,scipy, matplotlib这类python科学计算库,用pip工具下载,默认下载源速度很慢,经常Readtime out 的错误,所有要用国内的镜像:

$ pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ numpy$ pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ scipy$ pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ matplotlib

速度很快,这就把numpy,scipy安装好了。
再接下来是安装ASE工具:

$ pip install --upgrade  ase

安装成功,不过在最后测试:

$ ase test

出现了问题:

TclError: Can't find a usable init.tcl in the following directories: 

貌似是even环境引起的,目前还没解决…

1.2 anaconda2 环境下安装

因为在这环境下已经安装numpy,scipy,matplotlib等,所以直接安装ase:

$ pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ ase$ ase test

这次显示成功了!
接下来安装libxc-3.0.0,编译共享库,下载libxc-3.0.0:

$ ./configure --enable-shared --prefix=$HOME/xc$ make$ make install

然后在~/.bashrc中添加:

export C_INCLUDE_PATH=~/xc/includeexport LIBRARY_PATH=~/xc/libexport LD_LIBRARY_PATH=~/xc/lib

当然还要

source ~/.bashrc

2. 安装GPAW

这里先不安装并行版本
首先用git下载源代码

git clone https://gitlab.com/gpaw/gpaw.git

这里要用到blas,lapack库,直接编译会出错:libblas.a(dgemm.o): relocation R_X86_64_32 against '.rodata' can not be used when making a shared ob. 如果在 customize.py 中修改blas、lapack路径,指定自己编译的blas及lapack库,因为我编译的是静态,也会出错。直接用系统的:

$ cd /usr/lib$ sudo ln -sv libblas.so.3 libblas.so$ sudo ln -sv liblapack.so.3 liblapack.so

编译GPAW:

python setup.py install --user

运行结果没有报错,接下来就是测试是否成功安装:

$ cd gpaw/tools$ ./gpaw test

结果好多failed,原因是没有下载 PAW datasets:

$ tar -xf gpaw-setups-0.9.20000.tar.gz$ export GPAW_SETUP_PATH=/home/zkj/software/GPAW_new/gpaw/gpaw-setups-0.9.20000 $ export PYTHONPATH=~/your_install_path/gpaw:$PYTHONPATH$ export PATH=~/your_install_path/gpaw/tools:$PATH

export这几句加入~/.bashrc
这下在运行./gpaw test, 就ok啦~

原创粉丝点击