|||
gpaw 是一款效率比较高的第一性原理计算软件,在接近vasp的计算精度情况下,只消耗20%的时间。官网为:
安装介绍:Installation - GPAW
这个可以安装在自己的电脑,用来作为测试使用。
下载必要依赖包:
yum install epel-release #有些程序包在这里面 yum install libxc-devel openblas-devel openmpi-devel fftw-devel yum install blacs-openmpi-devel scalapack-openmpi-devel
.bashrc 加入:
OPENMPI=/usr/lib64/openmpi
export PATH=$OPENMPI/bin/:$PATH
export LD_LIBRARY_PATH=$OPENMPI/lib:$LD_LIBRARY_PATH
export GPAW_SETUPPATH=/home/yourusername/gpaw_setups/gpaw-setups-0.9.20000.tar.gz
其中setups文件从官网下载:https://wiki.fysik.dtu.dk/gpaw/setups/setups.html#installation-of-paw-datasets。
2. 安装gpaw:
pip install gpaw
结果如上图所示,这种安装方式功能有限,并且因为为了方便,配置内容都放在了.bashrc,比较混乱。
下载必要依赖包,(在线安装如下,离线rpm包,在此安装不做展开):
yum install epel-release #有些程序包在这里面 yum install libxc-devel openblas-devel openmpi-devel fftw-devel yum install blacs-openmpi-devel scalapack-openmpi-devel
从gitlab下载gpaw.tar.gz,,解压并修改配置文件siteconfig.py。(若没有可创建,或者更改已存在的siteconfig_exapmle.py 为siteconfig.py):
tar -xf gpaw***.tar.gz cd pgaw vim siteconfig.py
写入:
# FFTW3:
fftw = True
if fftw:
libraries = ['fftw3']
# openblas
openblas = True
if openblas :
libraries +=['openblas']
# mpiblacs
mpiblacs = True
if mpiblacs :
libraries +=['mpiblacs']
# ScaLAPACK (version 2.0.1+ required):
scalapack = True
if scalapack:
libraries += ['scalapack']
# xc:
xc = True
if xc:
libraries += ['xc']
# openmp
openmp = False
if openmp:
extra_compile_args += ['-fopenmp']
extra_link_args += ['-fopenmp']
保存文件,其中 openmp 在并行安装时使用。
2. 安装gpaw:
python setup.py install
结果如下图所示,推荐,其他辅助功能可按照类似方式配置。
ubuntu
注:ubuntu同centos,第一步依赖程序换成:
sudo apt install libopenblas-dev libxc-dev libscalapack-mpi-dev libfftw3-dev
对于能够联网intel服务器来说这里,可以参考第二种方式。关闭其中的openmp,同时需要在.bashrc文件中加入:
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/intel64/bin/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/:$PATH
intel mpi下载请自行百度,一般使用过一段时间的服务器都已经安装好了,对应位置请自行设置。
对于不能联网服务器,比如某些使用intel cpu的超算,安装最为麻烦,其他种类的cpu请参考他们的文档。
需要先编译几个基本库
Inter MPI:(不使用openmp)
intel mpi下载请自行百度,一般使用过一段时间的服务器都已经安装好了,对应位置请自行设置。在.bashrc文件中加入:
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/intel64/bin/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/:$PATH
libxc:
wget http://www.tddft.org/programs/octopus/down.php?file=libxc/4.2.3/libxc-4.2.3.tar.gz -O libxc-4.2.3.tar.gz
tar -xf libxc-4.2.3.tar.gz
cd libxc-4.2.3
./configure --enable-shared --disable-fortran --prefix=$HOME/libxc-4.2.3
make -j 10
make install
添加文件.bashrc:
XC=~/libxc-4.2.3
export C_INCLUDE_PATH=$XC/include
export LIBRARY_PATH=$XC/lib
export LD_LIBRARY_PATH=$XC/lib
(这个过程中,可能会需要设置添加-std=c99, 或者直接更改xc-theshold.c文件第800+行,把i定义放在for循环外。不知道是不是bug? )
openblas (非必须):
tar -xf openblas.tar.gz
cd openblas
./configure --prefix=$HOME/openblas
make -j 10
make install
libraries = ['openblas']
library_dirs = ['path_to_myblas']
添加文件.bashrc:
export C_INCLUDE_PATH=$HOME/openblas/include/:$C_INCLUDE_PATH
export LD_LIBRARY_PATH=$HOME/openblas/lib/:$LD_LIBRARY_PATH
export LIBRARY_PATH=/$HOME/openblas/lib/:$LIBRARY_PATH
export PATH=$HOME/openblas/bin/:$PATH
fftw:
FFTW Download Pagewww.fftw.org/download.html
没啥说的,和上面一样,编译安装,其中配置参数注意:
(并行版本)
./configure MPICC=mpicc --prefix=$HOME/fftw --disable-fortran --enable-mpi --enable-shared
(非并行版本)
./configure --prefix=$HOME/fftw --disable-fortran
添加文件.bashrc:
export LD_LIBRARY_PATH=/$HOME/fftw/lib/:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$HOME/fftw/include/:$C_INCLUDE_PATH
export LIBRARY_PATH=$HOME/fftw/lib/:$LIBRARY_PATH
其他的库请按照该方式自行安装。
2. gpaw:
tar -xf gpaw***.tar.gz cd gpaw vim siteconfig.py
siteconfig.py 写入:
libraries += ['openblas']
library_dirs += ['/data/home/wa/openblas/lib/']
include_dirs +=["/data/home/wa/anaconda3/include/python3.8"]
include_dirs +=["/data/home/wa/anaconda3/lib/python3.8/site-packages/numpy/core/include"]
# FFTW3:
fftw=True
libraries += ['fftw3']
ff = '/data/home/wa/gpaw/fftw/'
include_dirs += [ff + 'include']
library_dirs += [ff + 'lib']
extra_link_args += ['-Wl,-rpath={ff}lib'.format(ff=ff)]
# LibXC:
xc = '/data/home/wa/gpaw/libxc/'
include_dirs += [xc + 'include']
library_dirs += [xc + 'lib']
# You can use rpath to avoid changing LD_LIBRARY_PATH:
extra_link_args += ['-Wl,-rpath={xc}lib'.format(xc=xc)]
if 'xc' not in libraries:
libraries.append('xc')
setup.py 文件写入:
extra_compile_args = ['-Wall', '-Wno-unknown-pragmas', '-std=c99',"-Xlinker",]
运行:
python setup.py build_ext install
这样装完,基本都是动态链接。所以谨慎删除文件。
编辑于 2021-09-18 18:02
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-20 00:36
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社