简介
CP2K is a quantum chemistry and solid state physics software package that can perform atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems. CP2K provides a general framework for different modeling methods such as DFT using the mixed Gaussian and plane waves approaches GPW and GAPW.
编译环境
cp2k 支持 multi-threading, MPI, and CUDA
单线程版本只需要串行编译器即可,多线程版本需要编译器支持例如-fopenmp参数,MPI版本需要MPI编译器,CUDA版本需要CUDA编译器。
本文仅介绍前两种,针对CUDA的编译暂略。
设置编译环境举例:
# 设置intel编译器环境
source /opt/intel/composer_xe_2013.0.079/bin/iccvars.sh intel64
source /opt/intel/composer_xe_2013.0.079/bin/ifortvars.sh intel64
source /opt/intel/composer_xe_2013.0.079/mkl/bin/mklvars.sh intel64
# 设置mpi编译环境
export PATH=/usr/local/mpi-intel2013/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/mpi-intel2013/lib:$LD_LIBRARY_PATH
一些依赖库
BLAS/LAPACK
使用Intel编译器,直接用MKL库即可。
LIBINT
Libint is a software stack for computing integrals used in molecular quantum mechanics.
# 下载:https://sourceforge.net/projects/libint/files/v1-releases/
./configure CC=icc CXX=icpc FC=ifort \
--prefix=$HOME/software/libint-1.1.5 --enable-deriv
make
make install
LIBXC
Libxc is a library of exchange-correlation functionals for density-functional theory. The aim is to provide a portable, well tested and reliable set of exchange and correlation functionals that can be used by all the ETSF codes and also other codes.
# 下载:http://octopus-code.org/wiki/Libxc:download
tar zxvf libxc-2.2.3.tar.gz
cd libxc-2.2.3
./configure CC=icc CXX=icpc FC=ifort --prefix=$HOME/libxc/2.2.3
make
make install
编译cp2k
tar zxvf cp2k-4.1.tar.gz
cd cp2k-4.1
# 因为用的是mpich,所以修改mpi的编译命令
sed -i "s/mpiicpc/mpicxx/g" arch/Linux-x86-64-intel-mic.psmp
sed -i "s/mpiicc/mpicc/g" arch/Linux-x86-64-intel-mic.psmp
sed -i "s/mpiifort/mpif90/g" arch/Linux-x86-64-intel-mic.psmp
cd makefiles/
make -j 12 ARCH=Linux-x86-64-intel-host \
VERSION=popt \
LIBINTROOT=$HOME/software/libint/1.1.5 \
LIBXCROOT=$HOME/software/libxc/2.2.3 \
MKL_STATIC=2
说明:
参数 | 含义 |
---|---|
-j 12 | 用 12 个核同时编译 |
ARCH=Linux-x86-64-intel-host | 指定ARCH为linux系统,x86_64架构,用intel编译器 |
VERSION=popt | 指定为mpi版本 |
LIBINTROOT=$HOME/software/libint/1.1.5 | 给出libint路径,不给出则不支持该库 |
LIBXCROOT=$HOME/software/libxc/2.2.3 | 给出libxc路径,不给出则不支持该库 |
MKL_STATIC=2 | 选择动态MKL库的支持 |
备注:
1. 可以依据需求编译各种版本:
- sopt 串行
- ssmp 多线程
- popt mpi版本
- psmp mpi+多线程
2. 网络上有一个非常详细的教程,可以参考:
- cp2k4.x-5.x 最新多进程并行版(host.popt版)超详细完美安装教程
我的个人网站:传送门