surface-construct 0.9.2__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.
- {surface_construct-0.9.2/surface_construct.egg-info → surface_construct-0.9.3}/PKG-INFO +1 -1
- {surface_construct-0.9.2 → surface_construct-0.9.3}/setup.py +1 -1
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/__init__.py +1 -5
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/adsorbate.py +0 -3
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/surface_grid.py +18 -5
- {surface_construct-0.9.2 → surface_construct-0.9.3/surface_construct.egg-info}/PKG-INFO +1 -1
- {surface_construct-0.9.2 → surface_construct-0.9.3}/tests/test_surface_grid.py +10 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/LICENSE +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/README.md +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/setup.cfg +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/__init__.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/db.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/sg_sampler.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/surface.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/tasks/__init__.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/tasks/sitesampling.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/tasks/taskbase.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/tasks/terminations.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/utils/__init__.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/utils/atoms.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/utils/weight_functions.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/SOURCES.txt +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/tests/test_sampling1.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/tests/test_sampling2.py +0 -0
- {surface_construct-0.9.2 → surface_construct-0.9.3}/tests/test_task.py +0 -0
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/__init__.py
RENAMED
|
@@ -27,7 +27,7 @@ class AdsGridCombiner:
|
|
|
27
27
|
attitude = kwargs.get('attitude') # 分子姿态,分子主轴的夹角
|
|
28
28
|
internal_coord = kwargs.get('internal_coord') # 分子内坐标
|
|
29
29
|
ads_atoms = self.ads_obj.atoms.copy()
|
|
30
|
-
# TODO:
|
|
30
|
+
# TODO: 先进性 rotate and 改变分子构象
|
|
31
31
|
site = self.sg_obj.points[grid_idx]
|
|
32
32
|
# TODO: get_z 去更新 site 的坐标
|
|
33
33
|
site = self._get_z(site, ads_atoms)
|
|
@@ -46,9 +46,5 @@ class AdsGridCombiner:
|
|
|
46
46
|
事实上调整的是沿着格点法向向量的距离 xyz = xyz0 + r×d
|
|
47
47
|
:return:
|
|
48
48
|
"""
|
|
49
|
-
# 该方法仅仅适用于 slab 体系,不适合 cluster 体系
|
|
50
|
-
# 先找到grid 的最大值点,分子的最小值点,然后把分子的COM 移动到距离5A以上的点
|
|
51
|
-
# 根据 ads 不同的原子类型,计算每个原子需要移动的z值,取最小的值。
|
|
52
49
|
xyz = xyz0
|
|
53
|
-
move_z = 0
|
|
54
50
|
return xyz
|
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/adsorbate.py
RENAMED
|
@@ -25,9 +25,6 @@ class Adsorbate:
|
|
|
25
25
|
@property
|
|
26
26
|
def rads(self):
|
|
27
27
|
# 分子的半径,sg_obj 构造时作为参考
|
|
28
|
-
# 思考:这是为了生成格点的半径,格点的位置是一种参考的位置,可以尽量接近真实的吸附结构。
|
|
29
|
-
# 因而使用吸附原子的半径作为半径比较好,而不是分子的质心。当然,这是对于比较平整的slab 模型而言,对于团簇而言,也是如此吗?
|
|
30
|
-
# 可以认为是的,到时候分子的质心沿着法向向量移动就可以了。
|
|
31
28
|
# TODO: 计算分子半径
|
|
32
29
|
return self._rads
|
|
33
30
|
|
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/structures/surface_grid.py
RENAMED
|
@@ -260,9 +260,9 @@ class GridGenerator:
|
|
|
260
260
|
interval = self.interval
|
|
261
261
|
lenx, leny, lenz = atoms.cell.lengths()
|
|
262
262
|
pos_fz = atoms.get_scaled_positions()[:,2]
|
|
263
|
-
# 后面的
|
|
263
|
+
# 后面的 *2 是保证对于三斜格子保证足够厚
|
|
264
264
|
fzmax = pos_fz.max() + (np.asarray(self.rsub).max() + self.rads + interval * 2) / lenz * 2
|
|
265
|
-
fzmin = pos_fz.min()
|
|
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
267
|
Nz = int(np.around((fzmax-fzmin)*lenz/self.interval))
|
|
268
268
|
fx_list = np.linspace(0,1,Nx, endpoint=False)
|
|
@@ -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
|
|
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)
|
|
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
|
|
@@ -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)
|
|
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
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct/utils/weight_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.9.2 → surface_construct-0.9.3}/surface_construct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|