如何在座机及计算机集群上安装DPGEN及DeePMD-kit曾是笔者十分苦恼的问题(如今也是),需要熟悉anaconda的调用及虚拟环境的使用,本文简单记录一下两者及lammps的安装过程,详细步骤以Github及Manual为准。因为DPGEN及DeepMD-kit都需要调用tensorflow等python库,安装anaconda及miniconda是最好的选择,安装好anaconda后,为避免各软件调用库的过程间出现问题,建立只用于运行DPGEN的虚拟环境:conda create -n dpgen python=3.8.5
这一步可任意指定python版本,指定后该虚拟环境自动适配建立虚拟环境后,开始从github上下载dpgen源码包:
进入安装环节,需要注意的是,github上给的安装步骤是:
这一步安装会在用户文件夹下新建一个".local"文件并把源码安装在此处,但我们已建立虚拟环境,不需要此步,所以安装命令应为:
DeepModeling
------------
Version: 0.8.1
Date: Dec-05-2020
Path: /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/dpgen
Dependency
------------
numpy 1.19.4 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/numpy
dpdata 0.1.19 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/dpdata
pymatgen 2020.12.3 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/pymatgen
monty 4.0.2 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/monty
ase 3.20.1 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/ase
paramiko 2.7.2 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/paramiko
custodian 2020.4.7 /home/zpou/anaconda3/envs/dpgen/lib/python3.8/site-packages/custodian
Description
------------
usage: dpgen [-h] {init_surf,init_bulk,run,run/report,test,db} ...
dpgen is a convenient script that uses DeepGenerator to prepare initial data,
drive DeepMDkit and analyze results. This script works based on several sub-commands with their own options. To see the options for the sub-commands, type "dpgen sub-command -h".
positional arguments:
{init_surf,init_bulk,auto_gen_param,init_reaction,run,run/report,collect,simplify,test,db} ...
init_surf Generating initial data for surface systems.
init_bulk Generating initial data for bulk systems.
auto_gen_param auto gen param.json.
run Main process of Deep Potential Generator.
run/report Report the systems and the thermodynamic conditions of the labeled frames.
collect Collect data.
simplify Simplify data.
test Auto-test for Deep Potential.
db Collecting data from Deep Generator.
optional arguments:
-h, --help show this help message and exit
conda create -n deepmd-1.2.2 libprotobuf == 3.8.0
为什么指定libprotubuf的版本,下文lammps安装会说明,因为没有指定python版本,所以该环境下python版本为3.7.9由于团队已经DeepMD-kit各接口打包到conda中,所以DeepMD-kit的安装十分简单,一句命令即可:
conda install deepmd-kit=*=*cpu lammps-dp=*=*cpu -c deepmodeling
笔者计算机集群上使用CPU版本,稍等片刻安装完后,输入命令
DeePMD-kit: A deep learning package for many-body potential energy representation and molecular dynamics
optional arguments:
-h, --help show this help message and exit
Valid subcommands:
{transform,train,freeze,test}
transform pass parameters to another model
train train a model
freeze freeze the model
test test the model
其实DPGEN这一集成的软件包中已经帮我们编译好了lammps,但为了看得顺眼和后续方便,我们还是单独安装一个lammps,我们已经预先从lammps官网下载并解压好了lammps源码文件“lammps”由于我们是利用conda安装的DeePMD-kit,所以在DeePMD-kit文件中已经帮我们编译好了lammps的模块文件,我们只需要将其复制到lammps的制定文件夹中即可:cd lammmps/src/
cp -r ~/anaconda3/envs/deepmd-1.2.2/share/USER-DEEPMD .
复制到了lammps制定文件夹后,我们需要进行make操作,但进行make操作前,按照师姐的说法,由于某些bug原因,我们需要执行一条命令
此步目的是在lammps运行中可以调用deepmd类型的势函数文件,同理,如果我们想调用meamc势函数文件,我们可使用如下命令来编译文件
在编译好势函数需要的文件后,我们还需要对lammps进行整体编译,我们以后每新增编译一个库函数文件后都需要对lammps进行整体编译。在编译过程中,笔者和师姐曾被protobuf版本困扰很久,原因是anaconda里的protobuf版本太高了,lammps编译不需要这么高的版本,在尝试多次利用conda安装旧版本protobuf失败后,我们使用了制定protobuf版本的虚拟环境的办法,成功编译了lammps至此,DPGEN、DeePMD-kit及lammps已顺利安装完毕,可以进行后续的工作。