Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
Hands-on to APEX (Alloy Properties EXplorer using simulations)
English
APEX
Workflow
Alloy
EnglishAPEXWorkflowAlloy
zhuoyli@connect.hku.hk
发布于 2023-08-19
推荐镜像 :Basic Image:bohrium-notebook:2023-04-07
推荐机型 :c2_m4_cpu
赞 1
Hands-on to APEX (Alloy Properties EXplorer using simulations)
Background
Install APEX
LAMMPS example
Submit relaxation workflow
APEX Introduction
Overall framework of APEX:
Three types of workflow achieved on the Argo UI:
Submit property-test workflow
Basics for property tests
Submit a joint workflow (relaxation + property-test)

Hands-on to APEX (Alloy Properties EXplorer using simulations)

Open In Bohrium

©️ Copyright 2023 @ Authors
作者: zhuoyli@outlook.com 📨
日期:2023-07-25
共享协议:本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
快速开始:点击上方的 开始连接 按钮,选择 bohrium-notebook:2023-05-31镜像 和任意配置机型即可开始。

📖 Getting Started Guide
This document can be executed directly on the Bohrium Notebook. To begin, click the Connect button located at the top of the interface, then select the bohrium-notebook:2023-05-31 Image and choose your desired machine configuration to proceed.

This Bohrium notebook demonstrates how to perform alloy properties test flow with different simulation tools via APEX. The related computational tasks are submitted to the Bohrium platform, so you need to have a Bohrium account to start the workflow. Then you can monitor the workflow process on the website.

If you have any problems about the APEX, issues are welcomed in https://github.com/deepmodeling/APEX/

代码
文本

Background

After obtaining a DP model for an alloy, it is important to not only calibrate the model's energies, forces, and virials using dp test, but also to test its accuracy in describing other properties. This requires a convenient software package (workflow) to compute and compare a series of properties computed with DFT and existing interatomic potential functions (such as EAM and MEAM). The agreement between DP and DFT in various properties reflects the accuracy of DP and guides training strategies and parameter settings.

The previous version of alloy property test package autotest is integrated inside the DP-GEN that has following drawbacks:

  1. Inefficiency when testing multiple models simultaneously. For each model, the testing process involves make, run, and post, with each test waiting for the previous step to finish before the user's intervention to kick off the following step, which significantly reduces the efficiency of model testing.

  2. Difficulty in locating specific tasks when errors occur during the running process, indicating weak error handling capabilities.

With the help of recently developed tools such as dflow and fpop, these issues can be effectively addressed. Thus, based on the previous codes, the new Python package: APEX (Alloy Properties Explorer using simulations) is introduced to provide an integrated alloy property test tool-kits based on cloud-native workflow with high efficiency.

Fig1

代码
文本

Install APEX

Download APEX packedge via git clone

代码
文本
[ ]
!if [ -e APEX ];then rm -rf APEX; fi;
代码
文本
[ ]
!git clone https://github.com/deepmodeling/APEX
代码
文本

APEX can be easily installed via pip, as well as other dependencies such as pydflow.

代码
文本
[ ]
!pip install apex-flow
代码
文本

check if apex is installed

代码
文本
[ ]
!apex -v
代码
文本

LAMMPS example

Here we take a case study example for demonstration. This test is to evaluate preformance of a recently published pre-trained Deep Potential model: DPA-1 on description of interatomic interation of HCP Titanium metal through MD simulation using LAMMPS.

Fig1

Figure 1. DPA model

代码
文本

Firstly, go to the prepared case directory:

代码
文本
[ ]
cd APEX/examples/lammps_demo/
代码
文本

tree to check current local working directory:

代码
文本
[ ]
!tree
代码
文本

global_bohrium.json contains necessary config for Bohrium platform (e.g. account infomation; machine type; image address et al.), and should be prepared under current work directory in the first place.

代码
文本
[ ]
!cat global_bohrium.json
代码
文本

Please replace with your own Borium username, password and program_id via following code:

代码
文本
[ ]
import json
from monty.serialization import loadfn, dumpfn

j = loadfn('global_bohrium.json')

# please replace following three lines
j['email'] = 'YOUR_EMAIL'
j['password'] = 'YOUR_PASSWD'
j['program_id'] = 1234

with open('global_bohrium.json', 'w') as f: json.dump(j, f, indent=4)
代码
文本

A complete APEX framework to test alloy properties contains two individual workflows (relaxation and property) joint together.

Three types of test parameters json files are prepared here for demonstration:

  1. param_relax.json contains structures path, interaction infomation and relaxation parameters:
代码
文本
[ ]
!cat param_relax.json
代码
文本
  1. param_props.json contains structures path, interaction infomation and property test parameters:
代码
文本
[ ]
!cat param_props.json
代码
文本

As can be seen, the eos and elastic have been turned on by indicating value of "skip" to be false.

  1. param_joint.json contains all the information including parameters regarding relaxation and property test:
代码
文本
[ ]
!cat param_joint.json
代码
文本

Submit relaxation workflow

This can be done via any of following commands, for example:

  • apex param_relax.json
  • apex param_joint.json --relax
  • apex param_relax.json param_props.json --relax

For example: (it may takes a few minutes to submit to Bohrium depending on one's network connection)

代码
文本
[ ]
!apex param_relax.json
代码
文本

Once Workflow has been submitted (ID: ... appears, you can monitor the workflow on website.

代码
文本

While waiting...

APEX Introduction

APEX inherits the functionality of the second version of alloy properties calculations and is developed based on the dflow. By incorporating the advantages of cloud-native workflow features, APEX simplifies the complex process to automatically test multiple configurations and properties within one workflow. It offers users an more intuitive and easy-to-use interaction, making the overall user experience more straightforward.

Overall framework of APEX:

Fig1

Figure 1|A illustrtion of APEX workflow

Three types of workflow achieved on the Argo UI:

  • relaxation mode:
Fig1
  • property mode:
Fig1
  • joint mode:
Fig1
  • The architechture of relaxation and property-test workflows follows the similar three-steps style of previous codes:
Fig1

Figure 2|Three steps in Relaxation flow

代码
文本

When the workflow finished, the work directory will be downloaded automatically, containing finished relaxation tasks:

代码
文本
[ ]
!tree
代码
文本

Submit property-test workflow

Then, we can continue submiting a property-test workflow. This could be realized via one of following commands (note that you should have the relaxation workflow finished in the first place before continue this step):

  • apex param_props.json
  • apex param_joint.json --props
  • apex param_relax.json param_props.json --props

for example: (it may takes a few minutes to submit to Bohrium depending on one's network connection)

代码
文本
[ ]
!apex param_joint.json --props
代码
文本

you can monitor this workflow on website once submitted.

代码
文本

Basics for property tests

  • The equation of state (EOS):
Fig1

Figure 3|Three steps in EOS calculation

Fig1

Figure 4|Example of EOS plot (from Computer Physics Communications 253 (2020) 107206)

  • The elastic modulus:
Fig1
Fig1

Figure 5|Three steps in elastic constants calculation

  • The surface energy:

    Fig1
  • The point defect energy:

    Fig1
  • The stacking fault energy (Gamma line):

    Fig1
代码
文本

When the workflow completed, the work directory, together with property results, will be downloaded automatically to current directory:

代码
文本
[ ]
!tree
代码
文本

Submit a joint workflow (relaxation + property-test)

代码
文本

You can also submit an overall joint workflow to complete equivalent jobs of above two workflow.

Let's start over by reset the work direction:

代码
文本
[ ]
!for ii in confs/std-?cc; do cd $ii; rm -rf relaxation eos_00 elastic_00; cd ../..; done
!tree
代码
文本

Submit a joint workflow by:

  • apex param_joint.json
  • apex param_relax.json param_props.json

for example: (it may takes a few minutes to submit to Bohrium depending on one's network connection)

代码
文本
[ ]
!apex param_relax.json param_props.json
代码
文本

you can monitor this workflow on website once submitted.

代码
文本

When the workflow completed, the work directory, together with property results, will be downloaded automatically to current directory:

代码
文本
[ ]
!tree
代码
文本

We can now extract the results of EOS and elastic tensor corresponding to each configuration:

代码
文本
[ ]
elastic_bcc = 'confs/std-bcc/elastic_00/result.out'
elastic_fcc = 'confs/std-fcc/elastic_00/result.out'
with open(elastic_bcc, 'r') as f1: print(f1.read())
with open(elastic_fcc, 'r') as f1: print(f1.read())
代码
文本
[ ]
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate

# read & prepare data
def prep(l):
line = np.loadtxt(l, dtype=float, skiprows=2)
x = line[:, 0]
y = line[:, 1]
x_m = np.linspace(line[0, 0], line[-1, 0], 100)
Spline = interpolate.make_interp_spline(x, y)
y_m = Spline(x_m)
return x_m, y_m

eos_bcc = 'confs/std-bcc/eos_00/result.out'
eos_fcc = 'confs/std-fcc/eos_00/result.out'
bcc_x, bcc_y = prep(eos_bcc)
fcc_x, fcc_y = prep(eos_fcc)
# plot figures
plt.subplot(1,2,1)
plt.plot(bcc_x, bcc_y, 'ro-')
plt.xlabel('volume per atom $(\AA^3)$')
plt.ylabel('Energy per atom E (eV/atom)')
plt.title('BCC EOS')
plt.subplot(1,2,2)
plt.plot(fcc_x, fcc_y, 'bo-')
plt.xlabel('volume per atom $(\AA^3)$')
plt.title('FCC EOS')
代码
文本
English
APEX
Workflow
Alloy
EnglishAPEXWorkflowAlloy
已赞1
本文被以下合集收录
App related
Charmy Niu
更新于 2024-01-17
10 篇3 人关注
推荐阅读
公开
Hands-on to APEX (v1.2) on Bohrium
APEXWorkflowMaterialEnglishsimulation
APEXWorkflowMaterialEnglishsimulation
zhuoyli@connect.hku.hk
更新于 2024-08-08
4 赞5 转存文件
公开
Gamma line calculation via APEX
AlloyAPEXEnglishWorkflow
AlloyAPEXEnglishWorkflow
zhuoyli@connect.hku.hk
发布于 2023-08-19