surface-construct 0.5.9__tar.gz → 0.5.10__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.10}/PKG-INFO +1 -1
- {surface_construct-0.5.9 → surface_construct-0.5.10}/setup.py +1 -1
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/surface_grid.py +20 -15
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/PKG-INFO +2 -2
- {surface_construct-0.5.9 → surface_construct-0.5.10}/LICENSE +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/README.md +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/setup.cfg +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/__init__.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/atoms.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/db.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/sampling.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/structure.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/surface.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct/utils.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/SOURCES.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/tests/test_surface_grid.py +0 -0
- {surface_construct-0.5.9 → surface_construct-0.5.10}/tests/test_systematic_opt.py +0 -0
|
@@ -156,6 +156,15 @@ class SurfaceGrid:
|
|
|
156
156
|
# 格点向量化
|
|
157
157
|
self.vectorize(pca=self.lpca)
|
|
158
158
|
|
|
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
|
+
|
|
159
168
|
def gridize(self):
|
|
160
169
|
"""
|
|
161
170
|
格点化。
|
|
@@ -172,14 +181,10 @@ 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
|
|
@@ -197,11 +202,10 @@ class SurfaceGrid:
|
|
|
197
202
|
nonbond_index = nonbond_index & (~np.any(grid_dist - R0 <= 0, axis=1))
|
|
198
203
|
|
|
199
204
|
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)
|
|
205
|
+
z_index = xyz[:, 2] > z
|
|
206
|
+
xyz = xyz[z_index] # exclude the points that lower than zmin
|
|
207
|
+
grid_dist_array = grid_dist_array[z_index]
|
|
208
|
+
grid_dist = grid_dist[z_index]
|
|
205
209
|
break
|
|
206
210
|
self.points = xyz
|
|
207
211
|
self._Dga = grid_dist
|
|
@@ -340,7 +344,7 @@ class SurfaceGrid:
|
|
|
340
344
|
"""
|
|
341
345
|
nsample = 10
|
|
342
346
|
rng = np.random.default_rng()
|
|
343
|
-
idx = rng.choice(range(self.
|
|
347
|
+
idx = rng.choice(range(len(self.points)), size=nsample)
|
|
344
348
|
d_grid = [get_distances(self.points[i], self.points[i+1], cell=self.atoms.cell, pbc=self.atoms.pbc)[1][0, 0]
|
|
345
349
|
for i in idx]
|
|
346
350
|
idx_filtered = [i for i, d in zip(idx, d_grid) if d < 1.2 * self.interval] # 去掉不相邻的格点对
|
|
@@ -541,7 +545,7 @@ class SurfaceGrid:
|
|
|
541
545
|
|
|
542
546
|
def plot_property(self, key='energy', sample=True, figname=None, vmax=None, vmin=None):
|
|
543
547
|
"""
|
|
544
|
-
|
|
548
|
+
TODO: 支持 cluster 作图。保存原始 meshgrid 和 id?或者重新插值?
|
|
545
549
|
:param key: 画图的内容,对应于 grid_property 中的 key
|
|
546
550
|
:param sample: 是否画上 sample 点,默认是
|
|
547
551
|
:param figname: 图片名字,默认 key_iter_niter.png
|
|
@@ -640,6 +644,7 @@ class SurfaceGrid:
|
|
|
640
644
|
return line_x, line_values
|
|
641
645
|
|
|
642
646
|
def plot_sigma(self, key='energy', figname=None, vmax=None, vmin=None):
|
|
647
|
+
# TODO: 支持 cluster 作图。保存原始 meshgrid 和 id?或者重新插值?
|
|
643
648
|
assert key in self.grid_property_sigma
|
|
644
649
|
|
|
645
650
|
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.10
|
|
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
|
|
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
|
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/requires.txt
RENAMED
|
File without changes
|
{surface_construct-0.5.9 → surface_construct-0.5.10}/surface_construct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|