DP-GEN
本文介绍如何在 Bohrium 平台运行典型的 DP-GEN 任务。
简介
DP-GEN( Deep Potential Generator,深度势能生成器),致力于解决以下两个问题:
- 如何对势能面充分采样,有效覆盖训练可靠模型所需的样本空间?
- 如何高效筛选样本,选取训练价值高的构象进行第一性原理计算?
工作流程如下所示:“探索-标记-训练”循环迭代,直至势函数精度达预期要求。
为了方便生成数据以及监测势函数的精度,DP-GEN 还集成了 init_bulk、init_surf、autotest、simplify 等模块。
更多 DP-GEN 介绍请参考 https://github.com/deepmodeling/dpgen
如何在 Bohrium 上运行 DP-GEN 任务
本案例运行完成约需 60 min
步骤一,准备输入数据
首先需要开启管理节点,本案例中镜像选择 dpgen:0.10.6。通过 Web Shell 连接管理节点,执行以下语句确保 DP-GEN 及其依赖已经正确安装:
DeepModeling ------------ Version: 0.11.1 Path: /opt/conda/lib/python3.8/site-packages/dpgen Dependency ------------ numpy 1.22.4 /opt/conda/lib/python3.8/site-packages/numpy dpdata 0.2.14 /opt/conda/lib/python3.8/site-packages/dpdata pymatgen unknown version or path monty 2022.9.9 /opt/conda/lib/python3.8/site-packages/monty ase 3.22.1 /opt/conda/lib/python3.8/site-packages/ase paramiko 3.0.0 /opt/conda/lib/python3.8/site-packages/paramiko custodian 2022.5.26 /opt/conda/lib/python3.8/site-packages/custodian Reference ------------ Please cite: Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and Weinan E, DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models, Computer Physics Communications, 2020, 107206. ------------ Description ------------ usage: dpgen [-h] {init_surf,init_bulk,auto_gen_param,init_reaction,run,run/report,collect,simplify,autotest,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,autotest,db} init_surf Generating initial data for surface systems. init_bulk Generating initial data for bulk systems. auto_gen_param auto gen param.json init_reaction Generating initial data for reactive systems. 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. autotest Auto-test for Deep Potential. db Collecting data from DP-GEN. optional arguments: -h, --help show this help message and exit
若一切正常会打印出 DP-GEN 版本以及依赖的一些库的信息。
示例如下:
Version: 0.10.6
Date: Nov-01-2022
Path: /opt/miniconda/lib/python3.7/site-packages/dpgen
Dependency
------------
numpy 1.21.6 /opt/miniconda/lib/python3.7/site-packages/numpy
dpdata 0.2.10 /opt/miniconda/lib/python3.7/site-packages/dpdata
pymatgen unknown version or path
monty 2022.9.9 /opt/miniconda/lib/python3.7/site-packages/monty
ase 3.22.1 /opt/miniconda/lib/python3.7/site-packages/ase
paramiko 2.11.0 /opt/miniconda/lib/python3.7/site-packages/paramiko
custodian 2022.5.26 /opt/miniconda/lib/python3.7/site-packages/custodian
Reference
------------
Please cite:
Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and Weinan E,
DP-GEN: A concurrent learning platform for the generation of reliable deep learning
based potential energy models, Computer Physics Communications, 2020, 107206.
------------
Description
------------
usage: dpgen [-h]
{init_surf,init_bulk,auto_gen_param,init_reaction,run,run/report,collect,simplify,autotest,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,autotest,db}
init_surf Generating initial data for surface systems.
init_bulk Generating initial data for bulk systems.
auto_gen_param auto gen param.json
init_reaction Generating initial data for reactive systems.
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.
autotest Auto-test for Deep Potential.
db Collecting data from DP-GEN.
optional arguments:
-h, --help show this help message and exit
确认无误后便可进行输入文件的准备。以甲烷为例,DP-GEN 的输入文件均已存储至 Bohrium_DP-GEN_run_example
文件夹内,(你可以在左侧点击数据集查看相应文件):
当前路径为:/data/bohr/bohrium-dpgen-1e75/v1/Bohrium_DP-GEN_run_example
使用 tree . -L 2
命令可以查看输入文件,主要包含以下的内容:
. ├── CH4.POSCAR ├── CH4.POSCAR.01x01x01 │ ├── 00.place_ele │ ├── 01.scale_pert │ ├── 02.md │ └── param.json ├── INCAR_methane ├── INCAR_methane.md ├── INCAR_methane.rlx ├── POTCAR_C ├── POTCAR_H ├── init.json ├── machine.json └── run_param.json 4 directories, 10 files
DP-GEN 运行需要的文件说明:
文件/文件夹名称 | 说明 |
---|---|
CH4.POSCAR.01x01x01文件夹 | VASP结构文件 |
machine.json | 机器配置文件;包括计算资源、日志等 |
INCAR_methane | VASP计算参数文件;单点能,本教程run过程采用 |
POTCAR_C、POTCAR_H | VASP赝势文件;根据体系元素种类设置 |
run_param.json | 计算参数文件 |
步骤二,准备配置文件
文件夹内已经包含配置文件 machine.json
,您也可以通过以下 Python 代码创建或编辑 machine.json
:
已生成 /data/bohr/bohrium-dpgen-1e75/v1/Bohrium_DP-GEN_run_example/machine.json, 参数为: { "api_version": "1.0", "deepmd_version": "2.1.5", "train": [ { "command": "dp", "machine": { "batch_type": "Bohrium", "context_type": "BohriumContext", "local_root": "./", "remote_profile": { "email": "", "password": "", "program_id": 0, "keep_backup": true, "input_data": { "log_file": "00*/train.log", "grouped": true, "job_name": "dpgen_train_job", "disk_size": 100, "scass_type": "c8_m32_1 * NVIDIA V100", "checkpoint_files": [ "00*/checkpoint", "00*/model.ckpt*" ], "checkpoint_time": 30, "platform": "ali", "job_type": "container", "image_address": "registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6", "on_demand": 0 } } }, "resources": { "number_node": 1, "cpu_per_node": 8, "gpu_per_node": 1, "queue_name": "V100_8_32", "group_size": 1, "custom_flags": [], "strategy": { "if_cuda_multi_devices": true }, "para_deg": 3, "source_list": [] } } ], "model_devi": [ { "command": "lmp -i input.lammps -v restart 0", "machine": { "batch_type": "Bohrium", "context_type": "BohriumContext", "local_root": "./", "remote_profile": { "email": "", "password": "", "program_id": 0, "keep_backup": true, "input_data": { "log_file": "*/model_devi.log", "grouped": true, "job_name": "dpgen_model_devi_job", "disk_size": 200, "scass_type": "c8_m32_1 * NVIDIA V100", "platform": "ali", "job_type": "container", "image_address": "registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6", "on_demand": 0 } } }, "resources": { "number_node": 1, "cpu_per_node": 8, "gpu_per_node": 1, "queue_name": "V100_8_32", "group_size": 250, "source_list": [] } } ], "fp": [ { "command": "ulimit -s unlimited; mpirun -np 32 vasp_std", "machine": { "batch_type": "Bohrium", "context_type": "BohriumContext", "local_root": "./", "remote_profile": { "email": "", "password": "", "program_id": 0, "input_data": { "api_version": 2, "log_file": "task*/fp.log", "grouped": true, "job_name": "dpgen_fp_job", "disk_size": 100, "scass_type": "c32_m64_cpu", "platform": "ali", "job_type": "container", "image_address": "您需提供授权凭证到 bohrium@dp.tech 邮箱获取 VASP 镜像", "on_demand": 0 } } }, "resources": { "number_node": 4, "cpu_per_node": 8, "gpu_per_node": 0, "queue_name": "CPU", "group_size": 10, "source_list": [ "/opt/intel/oneapi/setvars.sh" ] } } ] }
注意:
"project_id"
:后的0000
需要替换为您自己的项目ID,可在“项目管理”页查看,共三处位置需要替换。emails
和password
需要填入自己的 Bohrium 账户邮箱和密码,共三处位置需要修改。- 根据需要调整
image_address
处填入的镜像地址,在本次示例中训练部分使用registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6
,探索部分使用registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6
,标记部分使用 VASP 镜像(如需使用 VASP 镜像,请提供您的 VASP 授权凭证至 bohrium@dp.tech 邮箱)。
步骤三,提交任务
第一次使用 Lebesgue Utility 需要配置,若您还未配置,请参阅 Bohrium 帮助文档|Lebesgue Utility)
使用 Lebesgue Utility 提交任务(Lebesgue Utility 是 Bohrium 平台的作业管理系统):
注意:DP-GEN 进程需要等待任务完成后进行后续轮次任务的提交,因此请不要关闭管理节点。
查看任务
您可以在监控任务文档中了解如何在 Bohrium 平台查看任务状态。
下载结果
您可以在结果下载文档中了解如何在 Bohrium 平台下载任务结果。
更多 DP-GEN 参数介绍
如果您想在 model_devi 步骤使用自定义的 input.lammps 模板,以实现 plumed 等功能,可参考文档 DP-GEN model_devi步骤 LAMMPS自定义模板
更多DP-GEN参数的详细设定可以参考 DP-GEN源码仓库 与 DP-GEN官方文档