Bohrium
robot
新建

空间站广场

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

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
Gamma line calculation via APEX
Alloy
APEX
English
Workflow
AlloyAPEXEnglishWorkflow
zhuoyli@connect.hku.hk
发布于 2023-08-19
推荐镜像 :Basic Image:bohrium-notebook:2023-04-07
推荐机型 :c2_m4_cpu
Gamma line calculation via APEX
Introduction
Hands-on example
Install APEX
Preperation
Submit a joint workflow (relaxation + property-test)

Gamma line calculation via APEX

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.

The Bohrium notebook demonstrates how to calculate Gamma line (stacking fault energy) with help of 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.

For general introduction and hands-on of APEX, please refer to Hands-on to APEX.

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

代码
文本

Introduction

Fig1

Figure 1. Schematic diagram of Gamma line calculation

The Gamma line (generalized stacking fault energy) function of APEX calculates energy of a series slab structures of specific crystal plane, which displaced in the middle along a slip vector. As illustrated in Figure 2, the slab structrures in APEX are defined by a plane miller index and two orthogonal directions (primary and secondary) on the plane. The slip vector is always along the primary directions with slip length defined by user or default settings. Thus, by indicating plane_miller and the slip_direction (AKA, primary direction), a slip system can be defined.

The parameters related to Gamma line calculation are listed below:

Key words Data structure Default Description
plane_miller Sequence[Int] None Miller index of the target slab
slip_direction Sequence[Int] None Miller index of slip (primary) direction of the slab
slip_length Int|Float; Sequence[Int|Float, Int|Float, Int|Float] Refer to specific slip system as the table shows above, or 1 if not indicated Slip length along the primary direction with default unit set by user or default setting. As for format of [x, y, z], the length equals to
plane_shift Int|Float 0 Shift of displacement plane with unit of lattice parameter (positive for upwards). This allows creating slip plane within narrowly-spaced planes (see ref).
n_steps Int 10 Number of steps to displace slab along the slip vector
vacuum_size Int|Float 0 Thickness of vacuum layer added around the slab with unit of Angstrom
supercell_size Sequence[Int, Int, Int] [1, 1, 5] Size of generated supper cell based on slab structure
add fix Sequence[Str, Str, Str] ["true","true","false"] Whether to add fix position constraint along x, y and z direction during calculation

Here is an example:

{
    "type":            "gamma",
    "skip":            false,
    "plane_miller":    [0,0,1],
    "slip_direction":  [1,0,0],
    "hcp": {
          "plane_miller":    [0,1,-1,1],
          "slip_direction":  [-2,1,1,0],
        "slip_length":     [1,0,1],
        "plane_shift": 0.25
      },
    "supercell_size":   [1,1,6],
    "vacuum_size": 10,
    "add_fix": ["true","true","false"],
    "n_steps":         10
  }

It should be noted that for various crystal structures, users can further define slip parameters within the respective nested dictionaries, which will be prioritized for adoption. In the previously mentioned example, the slip system configuration within the "hcp" dictionary will be utilized.

代码
文本

Hands-on example

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.

代码
文本
[ ]
cd APEX
代码
文本
[ ]
!pip install .
代码
文本

check if apex is installed

代码
文本
[ ]
!which apex
代码
文本

Preperation

Here we take an example of APEX workflow based on molecular dynamic simulation tool: LAMMPS, testing Gamma Line of slip along 1/2<> for BCC molybdenum using a DP potential. This process will be running on Bohrium.

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

Here is a example of local working direction prepared for LAMMPS

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

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

代码
文本
[ ]
!cat global.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.json')

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

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

For most common slip systems in respect to FCC, BCC and HCP crystal structures, slip direction, secondary direction and default fractional slip lengths are already documented and listed below (Users are strongly advised to follow those pre-defined slip system, or may need to double-check the generated slab structure, as unexpected results may occur especially for system like HCP):

  • FCC

    Plane miller index Slip direction Secondary direction Default slip length
  • BCC

    Plane miller index Slip direction Secondary direction Default slip length
  • HCP (Bravais lattice)

    Plane miller index Slip direction Secondary direction Default slip length

Now let's revise the settings inside param_joint.json to turn on Gamma function:

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

jf = 'param_joint.json'

d = loadfn(jf)

# set structure to be std-bcc
d['structures'] = ['confs/std-bcc']

# settings for Gamma line
d['properties'] = [
{
"type": "gamma",
"skip": False,
"plane_miller": [1,1,0],
"slip_direction": [-1,1,1],
"supercell_size": [2,2,60],
"vacuum_size": 15,
"add_fix": ["true","true","false"],
"n_steps": 12
}
]

with open(jf, 'w') as f: json.dump(d, f, indent=4)
代码
文本
[ ]
!cat param_joint.json
代码
文本

By this setting, we will be calculating gamma line along on plane as being default to be slip length. You can also specify it inside json.

代码
文本

Submit a joint workflow (relaxation + property-test)

代码
文本

Now we can submit an overall joint workflow to obtain the stacking fault results by:

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

It may takes a few minutes to submit to Bohrium depending on one's network connection...

Once submitted, we can monitor this workflow on the workflow link appearing above.

代码
文本

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

代码
文本
[ ]
!tree
代码
文本
[ ]
!cat confs/std-bcc/gamma_00/result.out
代码
文本

We can now plot the Gamma line results:

代码
文本
[ ]
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, usecols=[3,4])
x = line[:, 0]
y = line[:, 1]
return x, y

gamma = 'confs/std-bcc/gamma_00/result.out'
x, y = prep(gamma)
# plot figures
plt.plot(x, y, 'bo-')
plt.xlabel('Fault displacement along 1/2[111]')
plt.ylabel('Fault energy E (J/$m^2$)')
代码
文本
Alloy
APEX
English
Workflow
AlloyAPEXEnglishWorkflow
点个赞吧
推荐阅读
公开
Hands-on to APEX (v1.2) on Bohrium
APEXWorkflowMaterialEnglishsimulation
APEXWorkflowMaterialEnglishsimulation
zhuoyli@connect.hku.hk
更新于 2024-08-08
4 赞5 转存文件
公开
Hands-on to APEX (Alloy Properties EXplorer using simulations)
EnglishAPEXWorkflowAlloy
EnglishAPEXWorkflowAlloy
zhuoyli@connect.hku.hk
发布于 2023-08-19
1 赞