surface-construct 0.9.1__tar.gz → 0.9.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {surface_construct-0.9.1/surface_construct.egg-info → surface_construct-0.9.3}/PKG-INFO +16 -131
  2. {surface_construct-0.9.1 → surface_construct-0.9.3}/README.md +15 -130
  3. {surface_construct-0.9.1 → surface_construct-0.9.3}/setup.py +1 -1
  4. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/structures/surface_grid.py +22 -9
  5. {surface_construct-0.9.1 → surface_construct-0.9.3/surface_construct.egg-info}/PKG-INFO +16 -131
  6. {surface_construct-0.9.1 → surface_construct-0.9.3}/tests/test_surface_grid.py +16 -0
  7. {surface_construct-0.9.1 → surface_construct-0.9.3}/LICENSE +0 -0
  8. {surface_construct-0.9.1 → surface_construct-0.9.3}/setup.cfg +0 -0
  9. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/__init__.py +0 -0
  10. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/db.py +0 -0
  11. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/default_parameter.py +0 -0
  12. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/sg_sampler.py +0 -0
  13. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/structures/__init__.py +0 -0
  14. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/structures/adsorbate.py +0 -0
  15. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/structures/surface.py +0 -0
  16. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/tasks/__init__.py +0 -0
  17. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/tasks/sitesampling.py +0 -0
  18. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/tasks/taskbase.py +0 -0
  19. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/tasks/terminations.py +0 -0
  20. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/utils/__init__.py +0 -0
  21. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/utils/atoms.py +0 -0
  22. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct/utils/weight_functions.py +0 -0
  23. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct.egg-info/SOURCES.txt +0 -0
  24. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct.egg-info/dependency_links.txt +0 -0
  25. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct.egg-info/requires.txt +0 -0
  26. {surface_construct-0.9.1 → surface_construct-0.9.3}/surface_construct.egg-info/top_level.txt +0 -0
  27. {surface_construct-0.9.1 → surface_construct-0.9.3}/tests/test_sampling1.py +0 -0
  28. {surface_construct-0.9.1 → surface_construct-0.9.3}/tests/test_sampling2.py +0 -0
  29. {surface_construct-0.9.1 → surface_construct-0.9.3}/tests/test_task.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: surface_construct
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: Surface termination construction especially for complex model, such as oxides or carbides.
5
5
  Home-page: https://gitee.com/pjren/surface_construct/
6
6
  Author: ren
@@ -28,13 +28,15 @@ Dynamic: license-file
28
28
  Dynamic: requires-dist
29
29
  Dynamic: summary
30
30
 
31
- # 基于分层采样策略的催化剂表面位点全局分析
31
+ # 催化剂表面位点和反应分子构象综合采样
32
32
 
33
- A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalyst Surface Composed of Multiple Sites
33
+ 催化剂构效关系是建立表面位点结构和反应过程势能面的关联关系,这依赖对表面上各种可能位点的充分分析和采样,找到这些位点对关键反应步骤的影响情况。从催化剂的角度看,研究的目标是从表面上存在的位点中找到表面最适合反应的位点,即使反应势能面最低的位点;从反应的角度看,研究目标是对于一系列反应通道,找到反应势能面上的卡点,找到能够突破卡点的催化环境。
34
34
 
35
+ 本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
35
36
 
36
37
 
37
- ![表面位点全局分析](docs/surface_distribution_3d.jpg)
38
+
39
+ <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
38
40
 
39
41
 
40
42
 
@@ -42,7 +44,7 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
42
44
 
43
45
 
44
46
 
45
- ![flowchart](docs/flowchart2.jpg)
47
+ ![flowchart](docs/modules-计算流程.jpg)
46
48
 
47
49
  ## 重要的概念 Glossary
48
50
 
@@ -60,143 +62,23 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
60
62
 
61
63
  * 当前我们使用多点定位 Multilateration 进行向量化
62
64
 
63
- ![multilateration](docs/multilateration.jpg)
65
+ <img src="docs/multilateration.jpg" alt="multilateration" style="zoom:50%;" />
64
66
 
65
67
  * 分层采样 Stratified sampling。根据“相似结构具有相似性质”的原理采样分层采样的策略对表面位点进行采样,降低计算量。
66
68
 
67
69
  ![stratified sampling](docs/stratified_sampling.jpg)
68
70
 
69
- * 吸附结构
71
+ * 表面分子结构采样。表面的分子自由度分解为表面位点+分子姿态+分子內自由度。针对它们采用不同的采样策略。
70
72
 
71
- ![adsorption structure](docs/adsorption_structure.jpg)
73
+ <img src="docs/adsorption_structure.jpg" alt="adsorption structure" style="zoom:50%;" />
72
74
 
73
- ## 安装
75
+ ## 安装 Installation
74
76
 
75
77
  `pip install -U surface-construct`
76
78
 
77
- ## 发布新版本 (only for 管理员)
78
-
79
- python -m build
80
- twine upload --verbose dist/*
81
-
82
- ## 使用方法 Manual
83
-
84
- ### 所需文件 Required Files
85
-
86
- * `surface_reaction_sample.py`: 主流程文件
87
-
88
- * `parameter.py`: 参数定义文件
89
-
90
- * `POSCAR.0`: 表面结构文件
91
-
92
- * 注意:名字可以修改,与 `parameter.py` 设置一致
93
- * 设置需要固定的原子
94
-
95
- * bsub 文件。在公司集群上提交,以下面的为例
96
-
97
- ```Bash
98
- #/bin/bash
99
- #BSUB -J Sampling
100
- #BSUB -q short
101
- #BSUB -n 28
102
- #BSUB -o out.%J.txt
103
- #BSUB -e error.%J.txt
104
- #BSUB -R span[ptile=28]
105
- module load old/intel18u4
106
- export OMP_NUM_THREADS=1
107
- export I_MPI_ADJUST_REDUCE=3
108
- workdir=`pwd`
109
- date
110
-
111
- export PATH="/export/home/renpengju/miniconda3/bin:$PATH"
112
- export VASP_PP_PATH=$HOME/vasp/mypps
113
- export VASP_SCRIPT=$workdir/run_vasp.py
114
-
115
- cat > run_vasp.py << EOF
116
- import os
117
- exitcode = os.system('mpirun -PSM2 /export/soft_old/vasp541/vasp.5.4.1/bin/vasp_gam')
118
- EOF
119
-
120
- python surface_reaction_sample.py > surface_reaction_sample.py.log
121
-
122
- date
123
- ```
124
-
125
- ### 参数设置
126
-
127
- 注意:所有的参数均在 `parameter.py` 进行设置
128
-
129
- ```python
130
- from ase.calculators.vasp import Vasp
131
- import numpy as np
132
-
133
- # 用户参数,以下参数必须设定,没有默认值
134
- poscar = 'ru_0001_POSCAR'
135
- atomnum = [7, 7] # 吸附的原子序号, 第一个原子靠近表面
136
- bondlength = 1.65 # 初始的键长
137
- angle = [np.pi / 2, 0.0] # 分子吸附的角度,[theta, phi_x]: [与 z 轴的角度,绕 z 轴的旋转角度(相对于x)]
138
-
139
- # 以下参数可选,具有默认值
140
- calc = Vasp(
141
- xc='PBE',
142
- gga='PE',
143
- kpts=(1, 1, 1),
144
- encut=400,
145
- setups='recommended',
146
- ncore=4,
147
- gamma=True,
148
- nelm=200,
149
- algo='fast',
150
- ismear=0,
151
- sigma=0.05,
152
- ibrion=-1, # 不使用 vasp 自身的优化,必须是 -1
153
- ediff=1e-4,
154
- prec='normal',
155
- nsw=0, # 不使用 vasp 优化,必须是 0
156
- lreal='Auto',
157
- lwave=True, # 保存 WAVECAR 可以加速
158
- lcharg=False,
159
- ispin=1)
160
-
161
- scan_type = 'transition_state' # 扫描类型:'optimization','transition_state'
162
- grid_interval = 0.1 # angstrom, 格点的间距
163
- Nsample = 5 # 第一次采样的点
164
- Niter = 3 # 最大迭代次数
165
- fmax = 0.1 # 结构优化 force 的收敛标准
166
- max_error = 0.01 # 表面采样的收敛标准
167
- radii_type = 'covalent_radii' # 半径选项:'vdw_radii','covalent_radii'
168
- radii_factor = 1.1 # 原子半径系数
169
- sampleproperty = {'phi_x': np.linspace(0, np.pi/3, 2, endpoint=False)}
170
- ```
171
-
172
- ### 手动添加格点能量信息
173
-
174
- 通过脚本 `append_sample.py`实现,打开之后,修改以下信息
175
-
176
- ```python
177
- pkl_filename = 'surface_grid.pkl'
178
- keep_old_sample = True # 判断是否保留原有的采样的点
179
- results = [
180
- '0_opt.traj', # 支持 ase.traj, vasprun.xml 文件,仅读取最后优化后的结果
181
- '1_opt.traj',
182
- '2_opt.traj',
183
- '3_opt.traj',
184
- '4_opt.traj',
185
- '5_opt.traj',
186
- '6_opt.traj',
187
- '7_opt.traj',
188
- '8_opt.traj',
189
- '9_opt.traj',
190
- ]
191
- ```
192
-
193
- 运行: `python append_sample.py`
194
-
195
- 注意:文件夹下必须有 `parameter.py` 和相应的表面结构文件
196
-
197
- 注意:为了避免失误,再运行前对 `surface_grid.pkl` 进行备份
198
-
79
+ ## 使用方法 Tutorial
199
80
 
81
+ 参考例子 CuO_Cu_interface_LASP
200
82
 
201
83
  ### [其他 ASE 优化算法](https://wiki.fysik.dtu.dk/ase/ase/optimize.html)
202
84
 
@@ -271,8 +153,11 @@ $$
271
153
  * v 0.6: 新的高效表面格点构造,支持表面和团簇
272
154
  * v 0.7: 新的 grid_sample 方法,包含 Hull.vertices VIP 位点。
273
155
  * v 0.8: 孔材料体系格点构造
156
+ * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
157
+ * v 0.9.2: debug 支持三斜晶系的表面格点化
274
158
 
275
159
  **TODO**
160
+
276
161
  * 表面位点数据库
277
162
  * 多原子体系(内坐标受限体系)
278
163
  * 完善用户界面、例子、教程
@@ -1,10 +1,12 @@
1
- # 基于分层采样策略的催化剂表面位点全局分析
1
+ # 催化剂表面位点和反应分子构象综合采样
2
2
 
3
- A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalyst Surface Composed of Multiple Sites
3
+ 催化剂构效关系是建立表面位点结构和反应过程势能面的关联关系,这依赖对表面上各种可能位点的充分分析和采样,找到这些位点对关键反应步骤的影响情况。从催化剂的角度看,研究的目标是从表面上存在的位点中找到表面最适合反应的位点,即使反应势能面最低的位点;从反应的角度看,研究目标是对于一系列反应通道,找到反应势能面上的卡点,找到能够突破卡点的催化环境。
4
4
 
5
+ 本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
5
6
 
6
7
 
7
- ![表面位点全局分析](docs/surface_distribution_3d.jpg)
8
+
9
+ <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
8
10
 
9
11
 
10
12
 
@@ -12,7 +14,7 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
12
14
 
13
15
 
14
16
 
15
- ![flowchart](docs/flowchart2.jpg)
17
+ ![flowchart](docs/modules-计算流程.jpg)
16
18
 
17
19
  ## 重要的概念 Glossary
18
20
 
@@ -30,143 +32,23 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
30
32
 
31
33
  * 当前我们使用多点定位 Multilateration 进行向量化
32
34
 
33
- ![multilateration](docs/multilateration.jpg)
35
+ <img src="docs/multilateration.jpg" alt="multilateration" style="zoom:50%;" />
34
36
 
35
37
  * 分层采样 Stratified sampling。根据“相似结构具有相似性质”的原理采样分层采样的策略对表面位点进行采样,降低计算量。
36
38
 
37
39
  ![stratified sampling](docs/stratified_sampling.jpg)
38
40
 
39
- * 吸附结构
41
+ * 表面分子结构采样。表面的分子自由度分解为表面位点+分子姿态+分子內自由度。针对它们采用不同的采样策略。
40
42
 
41
- ![adsorption structure](docs/adsorption_structure.jpg)
43
+ <img src="docs/adsorption_structure.jpg" alt="adsorption structure" style="zoom:50%;" />
42
44
 
43
- ## 安装
45
+ ## 安装 Installation
44
46
 
45
47
  `pip install -U surface-construct`
46
48
 
47
- ## 发布新版本 (only for 管理员)
48
-
49
- python -m build
50
- twine upload --verbose dist/*
51
-
52
- ## 使用方法 Manual
53
-
54
- ### 所需文件 Required Files
55
-
56
- * `surface_reaction_sample.py`: 主流程文件
57
-
58
- * `parameter.py`: 参数定义文件
59
-
60
- * `POSCAR.0`: 表面结构文件
61
-
62
- * 注意:名字可以修改,与 `parameter.py` 设置一致
63
- * 设置需要固定的原子
64
-
65
- * bsub 文件。在公司集群上提交,以下面的为例
66
-
67
- ```Bash
68
- #/bin/bash
69
- #BSUB -J Sampling
70
- #BSUB -q short
71
- #BSUB -n 28
72
- #BSUB -o out.%J.txt
73
- #BSUB -e error.%J.txt
74
- #BSUB -R span[ptile=28]
75
- module load old/intel18u4
76
- export OMP_NUM_THREADS=1
77
- export I_MPI_ADJUST_REDUCE=3
78
- workdir=`pwd`
79
- date
80
-
81
- export PATH="/export/home/renpengju/miniconda3/bin:$PATH"
82
- export VASP_PP_PATH=$HOME/vasp/mypps
83
- export VASP_SCRIPT=$workdir/run_vasp.py
84
-
85
- cat > run_vasp.py << EOF
86
- import os
87
- exitcode = os.system('mpirun -PSM2 /export/soft_old/vasp541/vasp.5.4.1/bin/vasp_gam')
88
- EOF
89
-
90
- python surface_reaction_sample.py > surface_reaction_sample.py.log
91
-
92
- date
93
- ```
94
-
95
- ### 参数设置
96
-
97
- 注意:所有的参数均在 `parameter.py` 进行设置
98
-
99
- ```python
100
- from ase.calculators.vasp import Vasp
101
- import numpy as np
102
-
103
- # 用户参数,以下参数必须设定,没有默认值
104
- poscar = 'ru_0001_POSCAR'
105
- atomnum = [7, 7] # 吸附的原子序号, 第一个原子靠近表面
106
- bondlength = 1.65 # 初始的键长
107
- angle = [np.pi / 2, 0.0] # 分子吸附的角度,[theta, phi_x]: [与 z 轴的角度,绕 z 轴的旋转角度(相对于x)]
108
-
109
- # 以下参数可选,具有默认值
110
- calc = Vasp(
111
- xc='PBE',
112
- gga='PE',
113
- kpts=(1, 1, 1),
114
- encut=400,
115
- setups='recommended',
116
- ncore=4,
117
- gamma=True,
118
- nelm=200,
119
- algo='fast',
120
- ismear=0,
121
- sigma=0.05,
122
- ibrion=-1, # 不使用 vasp 自身的优化,必须是 -1
123
- ediff=1e-4,
124
- prec='normal',
125
- nsw=0, # 不使用 vasp 优化,必须是 0
126
- lreal='Auto',
127
- lwave=True, # 保存 WAVECAR 可以加速
128
- lcharg=False,
129
- ispin=1)
130
-
131
- scan_type = 'transition_state' # 扫描类型:'optimization','transition_state'
132
- grid_interval = 0.1 # angstrom, 格点的间距
133
- Nsample = 5 # 第一次采样的点
134
- Niter = 3 # 最大迭代次数
135
- fmax = 0.1 # 结构优化 force 的收敛标准
136
- max_error = 0.01 # 表面采样的收敛标准
137
- radii_type = 'covalent_radii' # 半径选项:'vdw_radii','covalent_radii'
138
- radii_factor = 1.1 # 原子半径系数
139
- sampleproperty = {'phi_x': np.linspace(0, np.pi/3, 2, endpoint=False)}
140
- ```
141
-
142
- ### 手动添加格点能量信息
143
-
144
- 通过脚本 `append_sample.py`实现,打开之后,修改以下信息
145
-
146
- ```python
147
- pkl_filename = 'surface_grid.pkl'
148
- keep_old_sample = True # 判断是否保留原有的采样的点
149
- results = [
150
- '0_opt.traj', # 支持 ase.traj, vasprun.xml 文件,仅读取最后优化后的结果
151
- '1_opt.traj',
152
- '2_opt.traj',
153
- '3_opt.traj',
154
- '4_opt.traj',
155
- '5_opt.traj',
156
- '6_opt.traj',
157
- '7_opt.traj',
158
- '8_opt.traj',
159
- '9_opt.traj',
160
- ]
161
- ```
162
-
163
- 运行: `python append_sample.py`
164
-
165
- 注意:文件夹下必须有 `parameter.py` 和相应的表面结构文件
166
-
167
- 注意:为了避免失误,再运行前对 `surface_grid.pkl` 进行备份
168
-
49
+ ## 使用方法 Tutorial
169
50
 
51
+ 参考例子 CuO_Cu_interface_LASP
170
52
 
171
53
  ### [其他 ASE 优化算法](https://wiki.fysik.dtu.dk/ase/ase/optimize.html)
172
54
 
@@ -241,8 +123,11 @@ $$
241
123
  * v 0.6: 新的高效表面格点构造,支持表面和团簇
242
124
  * v 0.7: 新的 grid_sample 方法,包含 Hull.vertices VIP 位点。
243
125
  * v 0.8: 孔材料体系格点构造
126
+ * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
127
+ * v 0.9.2: debug 支持三斜晶系的表面格点化
244
128
 
245
129
  **TODO**
130
+
246
131
  * 表面位点数据库
247
132
  * 多原子体系(内坐标受限体系)
248
133
  * 完善用户界面、例子、教程
@@ -15,7 +15,7 @@ install_requires = [
15
15
 
16
16
  setup(
17
17
  name='surface_construct',
18
- version='0.9.1',
18
+ version='0.9.3',
19
19
  packages=find_packages(),
20
20
  url='https://gitee.com/pjren/surface_construct/',
21
21
  license='GPL',
@@ -257,17 +257,17 @@ class GridGenerator:
257
257
 
258
258
  def slab_grid(self):
259
259
  atoms = self.atoms
260
- pos = atoms.positions
261
260
  interval = self.interval
262
- posz = pos[:,2]
263
- zmax = (posz + np.asarray(self.rsub)).max() + self.rads + interval * 2
264
- zmin = (posz.max() + posz.min())/2 # 从层中心开始
265
261
  lenx, leny, lenz = atoms.cell.lengths()
262
+ pos_fz = atoms.get_scaled_positions()[:,2]
263
+ # 后面的 *2 是保证对于三斜格子保证足够厚
264
+ fzmax = pos_fz.max() + (np.asarray(self.rsub).max() + self.rads + interval * 2) / lenz * 2
265
+ fzmin = (pos_fz.max() + pos_fz.min()) / 2
266
266
  Nx, Ny = np.asarray(np.around([lenx/self.interval ,leny/self.interval]), dtype=int)
267
- Nz = int(np.around((zmax-zmin)/self.interval))
267
+ Nz = int(np.around((fzmax-fzmin)*lenz/self.interval))
268
268
  fx_list = np.linspace(0,1,Nx, endpoint=False)
269
269
  fy_list = np.linspace(0,1,Ny, endpoint=False)
270
- fz_list = np.linspace(zmin/lenz,zmax/lenz,Nz, endpoint=False)
270
+ fz_list = np.linspace(fzmin, fzmax, Nz, endpoint=True)
271
271
  fgrid_x, fgrid_y, fgrid_z = np.meshgrid(fx_list, fy_list, fz_list, indexing='ij')
272
272
  fxyz = np.asarray([fgrid_x.ravel(), fgrid_y.ravel(), fgrid_z.ravel()]).T
273
273
  xyz = atoms.cell.cartesian_positions(fxyz)
@@ -495,8 +495,18 @@ class SurfaceGrid:
495
495
  self.subtype = subtype
496
496
  gridgen = GridGenerator(self.atoms,
497
497
  interval=self.interval, subtype=subtype, rads=self.rads, rsub=self.rsub)
498
- self.points = gridgen.grid
499
498
  self._gridgen = gridgen
499
+ self.points = gridgen.grid
500
+ remove_unconnected = kwargs.get('remove_unconnected', False)
501
+ if remove_unconnected:
502
+ self.remove_unconnected()
503
+
504
+ def remove_unconnected(self):
505
+ graph = self.grid_graph
506
+ if not nx.is_connected(graph):
507
+ largest_cc = max(nx.connected_components(graph), key=len)
508
+ self._grid_graph = graph.subgraph(largest_cc)
509
+ self.points = self.points[list(largest_cc)]
500
510
 
501
511
  def _get_grid_tree(self, extend=False):
502
512
  if self.subtype == 'cluster' and extend:
@@ -504,7 +514,7 @@ class SurfaceGrid:
504
514
  extend = False
505
515
  if self._grid_tree is not None:
506
516
  l_extend = len(self.points) != self._grid_tree.n
507
- if l_extend != extend: # need recalculate
517
+ if l_extend != extend: # need to be recalculated
508
518
  self._grid_tree = None
509
519
  if self._grid_tree is None:
510
520
  if extend:
@@ -524,10 +534,13 @@ class SurfaceGrid:
524
534
  cutoff = self.interval * 2
525
535
  dlist, ilist = self._get_grid_tree(extend=True).query(self.points, k=7, distance_upper_bound=cutoff) # 最近邻的原子最多为6, 包含自身则为7
526
536
  ilist = ilist % ngrid # 折叠格点的序号
527
- pairs = [(ii[0], i, d) for ii, dd in zip(ilist, dlist) for i, d in zip(ii[1:], self.interval / dd[1:])]
537
+ pairs = [(ii[0], i, d) for ii, dd in zip(ilist, dlist)
538
+ for i, d in zip(ii[1:], self.interval / dd[1:]) if d > 0]
528
539
  graph = nx.Graph()
529
540
  graph.add_weighted_edges_from(pairs)
530
541
  self._grid_graph = graph
542
+ if not nx.is_connected(graph):
543
+ print("Warning: the surface grids are not fully connected!")
531
544
  return self._grid_graph
532
545
 
533
546
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: surface_construct
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: Surface termination construction especially for complex model, such as oxides or carbides.
5
5
  Home-page: https://gitee.com/pjren/surface_construct/
6
6
  Author: ren
@@ -28,13 +28,15 @@ Dynamic: license-file
28
28
  Dynamic: requires-dist
29
29
  Dynamic: summary
30
30
 
31
- # 基于分层采样策略的催化剂表面位点全局分析
31
+ # 催化剂表面位点和反应分子构象综合采样
32
32
 
33
- A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalyst Surface Composed of Multiple Sites
33
+ 催化剂构效关系是建立表面位点结构和反应过程势能面的关联关系,这依赖对表面上各种可能位点的充分分析和采样,找到这些位点对关键反应步骤的影响情况。从催化剂的角度看,研究的目标是从表面上存在的位点中找到表面最适合反应的位点,即使反应势能面最低的位点;从反应的角度看,研究目标是对于一系列反应通道,找到反应势能面上的卡点,找到能够突破卡点的催化环境。
34
34
 
35
+ 本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
35
36
 
36
37
 
37
- ![表面位点全局分析](docs/surface_distribution_3d.jpg)
38
+
39
+ <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
38
40
 
39
41
 
40
42
 
@@ -42,7 +44,7 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
42
44
 
43
45
 
44
46
 
45
- ![flowchart](docs/flowchart2.jpg)
47
+ ![flowchart](docs/modules-计算流程.jpg)
46
48
 
47
49
  ## 重要的概念 Glossary
48
50
 
@@ -60,143 +62,23 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
60
62
 
61
63
  * 当前我们使用多点定位 Multilateration 进行向量化
62
64
 
63
- ![multilateration](docs/multilateration.jpg)
65
+ <img src="docs/multilateration.jpg" alt="multilateration" style="zoom:50%;" />
64
66
 
65
67
  * 分层采样 Stratified sampling。根据“相似结构具有相似性质”的原理采样分层采样的策略对表面位点进行采样,降低计算量。
66
68
 
67
69
  ![stratified sampling](docs/stratified_sampling.jpg)
68
70
 
69
- * 吸附结构
71
+ * 表面分子结构采样。表面的分子自由度分解为表面位点+分子姿态+分子內自由度。针对它们采用不同的采样策略。
70
72
 
71
- ![adsorption structure](docs/adsorption_structure.jpg)
73
+ <img src="docs/adsorption_structure.jpg" alt="adsorption structure" style="zoom:50%;" />
72
74
 
73
- ## 安装
75
+ ## 安装 Installation
74
76
 
75
77
  `pip install -U surface-construct`
76
78
 
77
- ## 发布新版本 (only for 管理员)
78
-
79
- python -m build
80
- twine upload --verbose dist/*
81
-
82
- ## 使用方法 Manual
83
-
84
- ### 所需文件 Required Files
85
-
86
- * `surface_reaction_sample.py`: 主流程文件
87
-
88
- * `parameter.py`: 参数定义文件
89
-
90
- * `POSCAR.0`: 表面结构文件
91
-
92
- * 注意:名字可以修改,与 `parameter.py` 设置一致
93
- * 设置需要固定的原子
94
-
95
- * bsub 文件。在公司集群上提交,以下面的为例
96
-
97
- ```Bash
98
- #/bin/bash
99
- #BSUB -J Sampling
100
- #BSUB -q short
101
- #BSUB -n 28
102
- #BSUB -o out.%J.txt
103
- #BSUB -e error.%J.txt
104
- #BSUB -R span[ptile=28]
105
- module load old/intel18u4
106
- export OMP_NUM_THREADS=1
107
- export I_MPI_ADJUST_REDUCE=3
108
- workdir=`pwd`
109
- date
110
-
111
- export PATH="/export/home/renpengju/miniconda3/bin:$PATH"
112
- export VASP_PP_PATH=$HOME/vasp/mypps
113
- export VASP_SCRIPT=$workdir/run_vasp.py
114
-
115
- cat > run_vasp.py << EOF
116
- import os
117
- exitcode = os.system('mpirun -PSM2 /export/soft_old/vasp541/vasp.5.4.1/bin/vasp_gam')
118
- EOF
119
-
120
- python surface_reaction_sample.py > surface_reaction_sample.py.log
121
-
122
- date
123
- ```
124
-
125
- ### 参数设置
126
-
127
- 注意:所有的参数均在 `parameter.py` 进行设置
128
-
129
- ```python
130
- from ase.calculators.vasp import Vasp
131
- import numpy as np
132
-
133
- # 用户参数,以下参数必须设定,没有默认值
134
- poscar = 'ru_0001_POSCAR'
135
- atomnum = [7, 7] # 吸附的原子序号, 第一个原子靠近表面
136
- bondlength = 1.65 # 初始的键长
137
- angle = [np.pi / 2, 0.0] # 分子吸附的角度,[theta, phi_x]: [与 z 轴的角度,绕 z 轴的旋转角度(相对于x)]
138
-
139
- # 以下参数可选,具有默认值
140
- calc = Vasp(
141
- xc='PBE',
142
- gga='PE',
143
- kpts=(1, 1, 1),
144
- encut=400,
145
- setups='recommended',
146
- ncore=4,
147
- gamma=True,
148
- nelm=200,
149
- algo='fast',
150
- ismear=0,
151
- sigma=0.05,
152
- ibrion=-1, # 不使用 vasp 自身的优化,必须是 -1
153
- ediff=1e-4,
154
- prec='normal',
155
- nsw=0, # 不使用 vasp 优化,必须是 0
156
- lreal='Auto',
157
- lwave=True, # 保存 WAVECAR 可以加速
158
- lcharg=False,
159
- ispin=1)
160
-
161
- scan_type = 'transition_state' # 扫描类型:'optimization','transition_state'
162
- grid_interval = 0.1 # angstrom, 格点的间距
163
- Nsample = 5 # 第一次采样的点
164
- Niter = 3 # 最大迭代次数
165
- fmax = 0.1 # 结构优化 force 的收敛标准
166
- max_error = 0.01 # 表面采样的收敛标准
167
- radii_type = 'covalent_radii' # 半径选项:'vdw_radii','covalent_radii'
168
- radii_factor = 1.1 # 原子半径系数
169
- sampleproperty = {'phi_x': np.linspace(0, np.pi/3, 2, endpoint=False)}
170
- ```
171
-
172
- ### 手动添加格点能量信息
173
-
174
- 通过脚本 `append_sample.py`实现,打开之后,修改以下信息
175
-
176
- ```python
177
- pkl_filename = 'surface_grid.pkl'
178
- keep_old_sample = True # 判断是否保留原有的采样的点
179
- results = [
180
- '0_opt.traj', # 支持 ase.traj, vasprun.xml 文件,仅读取最后优化后的结果
181
- '1_opt.traj',
182
- '2_opt.traj',
183
- '3_opt.traj',
184
- '4_opt.traj',
185
- '5_opt.traj',
186
- '6_opt.traj',
187
- '7_opt.traj',
188
- '8_opt.traj',
189
- '9_opt.traj',
190
- ]
191
- ```
192
-
193
- 运行: `python append_sample.py`
194
-
195
- 注意:文件夹下必须有 `parameter.py` 和相应的表面结构文件
196
-
197
- 注意:为了避免失误,再运行前对 `surface_grid.pkl` 进行备份
198
-
79
+ ## 使用方法 Tutorial
199
80
 
81
+ 参考例子 CuO_Cu_interface_LASP
200
82
 
201
83
  ### [其他 ASE 优化算法](https://wiki.fysik.dtu.dk/ase/ase/optimize.html)
202
84
 
@@ -271,8 +153,11 @@ $$
271
153
  * v 0.6: 新的高效表面格点构造,支持表面和团簇
272
154
  * v 0.7: 新的 grid_sample 方法,包含 Hull.vertices VIP 位点。
273
155
  * v 0.8: 孔材料体系格点构造
156
+ * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
157
+ * v 0.9.2: debug 支持三斜晶系的表面格点化
274
158
 
275
159
  **TODO**
160
+
276
161
  * 表面位点数据库
277
162
  * 多原子体系(内坐标受限体系)
278
163
  * 完善用户界面、例子、教程
@@ -62,6 +62,9 @@ class TestSurfaceGrid:
62
62
  atoms = ase.io.read('atoms_files/POSCAR_In2O3_110')
63
63
  sg_obj = SurfaceGrid(atoms, interval=0.1, ads_num=6, lpca=False)
64
64
  sg_obj.gridize(subtype='slab')
65
+ print(f"Number of points before remove_unconnected: {len(sg_obj.points)}")
66
+ sg_obj.remove_unconnected()
67
+ print(f"Number of points after remove_unconnected: {len(sg_obj.points)}")
65
68
  sg_obj.vectorize()
66
69
  graph = sg_obj.grid_graph
67
70
  vip = sg_obj.vip_id
@@ -80,6 +83,13 @@ class TestSurfaceGrid:
80
83
  print(len(vip))
81
84
  print(list(site_dict.keys()))
82
85
 
86
+ def test_Fe3C_slab2(self):
87
+ atoms = ase.io.read('atoms_files/Fe3C_001.vasp')
88
+ sg_obj = SurfaceGrid(atoms, interval=0.1, ads_num=6, lpca=False)
89
+ sg_obj.gridize(subtype='slab')
90
+ atoms = sg_obj.atoms
91
+ print(len(sg_obj.points))
92
+
83
93
  def test_ZSM5(self):
84
94
  atoms = ase.io.read('atoms_files/zsm5.cif')
85
95
  gridgen = GridGenerator(atoms, interval=0.2, subtype='bulk', rsub='vdw_radii', scale=1.0)
@@ -103,3 +113,9 @@ class TestSurfaceGrid:
103
113
  sg_obj.gridize(subtype='slab')
104
114
  Lga = sg_obj._Lga
105
115
  print(Lga.shape)
116
+
117
+ def test_triclinic(self):
118
+ atoms = ase.io.read('atoms_files/Fe28C12_115_12_POSCAR')
119
+ sg_obj = SurfaceGrid(atoms, interval=0.1, ads_num=6, lpca=False)
120
+ sg_obj.gridize(subtype='slab')
121
+ print(sg_obj.points.shape)