surface-construct 0.5.9__tar.gz → 0.5.11__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.
- {surface_construct-0.5.9 → surface_construct-0.5.11}/PKG-INFO +6 -1
- {surface_construct-0.5.9 → surface_construct-0.5.11}/README.md +5 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/setup.py +1 -1
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/surface_grid.py +30 -21
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/PKG-INFO +7 -2
- {surface_construct-0.5.9 → surface_construct-0.5.11}/LICENSE +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/setup.cfg +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/__init__.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/atoms.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/db.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/sampling.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/structure.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/surface.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct/utils.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/SOURCES.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/tests/test_surface_grid.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.11}/tests/test_systematic_opt.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: surface_construct
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.11
|
|
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
|
|
@@ -67,6 +67,11 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
|
|
|
67
67
|
|
|
68
68
|
`pip install -U surface-construct`
|
|
69
69
|
|
|
70
|
+
## 发布新版本 (only for 管理员)
|
|
71
|
+
|
|
72
|
+
python -m build
|
|
73
|
+
twine upload --verbose dist/*
|
|
74
|
+
|
|
70
75
|
## 使用方法 Manual
|
|
71
76
|
|
|
72
77
|
### 所需文件 Required Files
|
|
@@ -44,6 +44,11 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
|
|
|
44
44
|
|
|
45
45
|
`pip install -U surface-construct`
|
|
46
46
|
|
|
47
|
+
## 发布新版本 (only for 管理员)
|
|
48
|
+
|
|
49
|
+
python -m build
|
|
50
|
+
twine upload --verbose dist/*
|
|
51
|
+
|
|
47
52
|
## 使用方法 Manual
|
|
48
53
|
|
|
49
54
|
### 所需文件 Required Files
|
|
@@ -156,7 +156,16 @@ class SurfaceGrid:
|
|
|
156
156
|
# 格点向量化
|
|
157
157
|
self.vectorize(pca=self.lpca)
|
|
158
158
|
|
|
159
|
-
def
|
|
159
|
+
def structure_boundary(self):
|
|
160
|
+
result = np.zeros((3, 2)) # [[xmin, xmax], [ymin, ymax], [zmin, zmax]]
|
|
161
|
+
for dim in (0, 1, 2):
|
|
162
|
+
for func, sign in zip((np.argmin, np.argmax), (-1, 1)):
|
|
163
|
+
atom_idx = func(self.atoms.positions[:, dim])
|
|
164
|
+
v = self.atoms.positions[atom_idx, dim] + sign * (self.radii[self.atoms.numbers[atom_idx]] + self.rads)
|
|
165
|
+
result[dim, int((sign+1)/2)] = v
|
|
166
|
+
return np.concatenate(result) # [xmin, xmax, ymin, ymax, zmin, zmax]
|
|
167
|
+
|
|
168
|
+
def gridize(self, surface_index=None):
|
|
160
169
|
"""
|
|
161
170
|
格点化。
|
|
162
171
|
这种方法仅仅适用于无孔的材料,表面为z方向,且方向向上。
|
|
@@ -172,36 +181,35 @@ class SurfaceGrid:
|
|
|
172
181
|
fxyz[:, 0] = fgrid_x.reshape(nx * ny)
|
|
173
182
|
fxyz[:, 1] = fgrid_y.reshape(nx * ny)
|
|
174
183
|
xyz = self.atoms.cell.cartesian_positions(fxyz)
|
|
175
|
-
|
|
176
|
-
zmax = self.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
# z 最小值
|
|
180
|
-
atom_idx_zmin = np.argmin(self.atoms.positions[:, 2])
|
|
181
|
-
atom_zmin = self.atoms.positions[atom_idx_zmin, 2]
|
|
182
|
-
zmin = atom_zmin - self.radii[self.atoms.numbers[atom_idx_zmin]] - self.rads
|
|
184
|
+
|
|
185
|
+
xmin, xmax, ymin, ymax, zmin, zmax = self.structure_boundary()
|
|
186
|
+
condition = (xyz[:, 0] > xmin) * (xyz[:, 0] < xmax) * (xyz[:, 1] > ymin) * (xyz[:, 1] < ymax)
|
|
187
|
+
xyz = xyz[condition]
|
|
183
188
|
|
|
184
189
|
xyz[:, 2] = zmax
|
|
185
190
|
z = zmax
|
|
186
191
|
nonbond_index = np.ones(len(xyz), bool)
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
atoms_pos = self.atoms.positions
|
|
193
|
+
atoms_num = self.atoms.numbers
|
|
194
|
+
if surface_index is not None:
|
|
195
|
+
atoms_pos = atoms_pos[surface_index]
|
|
196
|
+
atoms_num = atoms_num[surface_index]
|
|
197
|
+
grid_dist_array = np.zeros((len(xyz), len(atoms_pos), 3))
|
|
198
|
+
grid_dist = np.zeros((len(xyz), len(atoms_pos)))
|
|
189
199
|
while np.any(nonbond_index):
|
|
190
200
|
z -= self.interval / 10.0
|
|
191
201
|
xyz[nonbond_index, 2] = z
|
|
192
202
|
grid_dist_array[nonbond_index], grid_dist[nonbond_index] = get_distances(
|
|
193
|
-
xyz[nonbond_index], self.atoms.
|
|
194
|
-
|
|
195
|
-
R0 = np.asarray([self.radii[i] for i in self.atoms.numbers]) + self.rads
|
|
203
|
+
xyz[nonbond_index], atoms_pos, cell=self.atoms.cell, pbc=self.atoms.pbc)
|
|
204
|
+
R0 = np.asarray([self.radii[i] for i in atoms_num]) + self.rads
|
|
196
205
|
# 判断最小距离是否小于共价半径之和
|
|
197
206
|
nonbond_index = nonbond_index & (~np.any(grid_dist - R0 <= 0, axis=1))
|
|
198
207
|
|
|
199
208
|
if z < zmin:
|
|
200
|
-
z_index = xyz[:, 2]
|
|
201
|
-
xyz[z_index]
|
|
202
|
-
grid_dist_array
|
|
203
|
-
|
|
204
|
-
cell=self.atoms.cell, pbc=self.atoms.pbc)
|
|
209
|
+
z_index = xyz[:, 2] > z
|
|
210
|
+
xyz = xyz[z_index] # exclude the points that lower than zmin
|
|
211
|
+
grid_dist_array = grid_dist_array[z_index]
|
|
212
|
+
grid_dist = grid_dist[z_index]
|
|
205
213
|
break
|
|
206
214
|
self.points = xyz
|
|
207
215
|
self._Dga = grid_dist
|
|
@@ -340,7 +348,7 @@ class SurfaceGrid:
|
|
|
340
348
|
"""
|
|
341
349
|
nsample = 10
|
|
342
350
|
rng = np.random.default_rng()
|
|
343
|
-
idx = rng.choice(range(self.
|
|
351
|
+
idx = rng.choice(range(len(self.points)), size=nsample)
|
|
344
352
|
d_grid = [get_distances(self.points[i], self.points[i+1], cell=self.atoms.cell, pbc=self.atoms.pbc)[1][0, 0]
|
|
345
353
|
for i in idx]
|
|
346
354
|
idx_filtered = [i for i, d in zip(idx, d_grid) if d < 1.2 * self.interval] # 去掉不相邻的格点对
|
|
@@ -541,7 +549,7 @@ class SurfaceGrid:
|
|
|
541
549
|
|
|
542
550
|
def plot_property(self, key='energy', sample=True, figname=None, vmax=None, vmin=None):
|
|
543
551
|
"""
|
|
544
|
-
|
|
552
|
+
TODO: 支持 cluster 作图。保存原始 meshgrid 和 id?或者重新插值?
|
|
545
553
|
:param key: 画图的内容,对应于 grid_property 中的 key
|
|
546
554
|
:param sample: 是否画上 sample 点,默认是
|
|
547
555
|
:param figname: 图片名字,默认 key_iter_niter.png
|
|
@@ -640,6 +648,7 @@ class SurfaceGrid:
|
|
|
640
648
|
return line_x, line_values
|
|
641
649
|
|
|
642
650
|
def plot_sigma(self, key='energy', figname=None, vmax=None, vmin=None):
|
|
651
|
+
# TODO: 支持 cluster 作图。保存原始 meshgrid 和 id?或者重新插值?
|
|
643
652
|
assert key in self.grid_property_sigma
|
|
644
653
|
|
|
645
654
|
X = self.points[:, 0].reshape((self.grid_ny, self.grid_nx))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.5.
|
|
2
|
+
Name: surface_construct
|
|
3
|
+
Version: 0.5.11
|
|
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
|
|
@@ -67,6 +67,11 @@ A Method with Stratified Sampling Strategy for Comprehensive Analysis of Catalys
|
|
|
67
67
|
|
|
68
68
|
`pip install -U surface-construct`
|
|
69
69
|
|
|
70
|
+
## 发布新版本 (only for 管理员)
|
|
71
|
+
|
|
72
|
+
python -m build
|
|
73
|
+
twine upload --verbose dist/*
|
|
74
|
+
|
|
70
75
|
## 使用方法 Manual
|
|
71
76
|
|
|
72
77
|
### 所需文件 Required Files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/requires.txt
RENAMED
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.11}/surface_construct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|