surface-construct 0.10.1__tar.gz → 0.10.2__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 (30) hide show
  1. {surface_construct-0.10.1/surface_construct.egg-info → surface_construct-0.10.2}/PKG-INFO +5 -7
  2. {surface_construct-0.10.1 → surface_construct-0.10.2}/README.md +4 -6
  3. {surface_construct-0.10.1 → surface_construct-0.10.2}/setup.py +1 -1
  4. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/structures/surface_grid.py +27 -14
  5. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/utils/__init__.py +1 -1
  6. {surface_construct-0.10.1 → surface_construct-0.10.2/surface_construct.egg-info}/PKG-INFO +5 -7
  7. {surface_construct-0.10.1 → surface_construct-0.10.2}/tests/test_simple_surface.py +1 -1
  8. {surface_construct-0.10.1 → surface_construct-0.10.2}/tests/test_surface_grid.py +1 -1
  9. {surface_construct-0.10.1 → surface_construct-0.10.2}/LICENSE +0 -0
  10. {surface_construct-0.10.1 → surface_construct-0.10.2}/setup.cfg +0 -0
  11. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/__init__.py +0 -0
  12. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/db.py +0 -0
  13. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/default_parameter.py +0 -0
  14. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/sg_sampler.py +0 -0
  15. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/structures/__init__.py +0 -0
  16. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/structures/adsorbate.py +0 -0
  17. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/structures/surface.py +0 -0
  18. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/tasks/__init__.py +0 -0
  19. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/tasks/sitesampling.py +0 -0
  20. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/tasks/taskbase.py +0 -0
  21. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/tasks/terminations.py +0 -0
  22. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/utils/atoms.py +0 -0
  23. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct/utils/weight_functions.py +0 -0
  24. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct.egg-info/SOURCES.txt +0 -0
  25. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct.egg-info/dependency_links.txt +0 -0
  26. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct.egg-info/requires.txt +0 -0
  27. {surface_construct-0.10.1 → surface_construct-0.10.2}/surface_construct.egg-info/top_level.txt +0 -0
  28. {surface_construct-0.10.1 → surface_construct-0.10.2}/tests/test_sampling1.py +0 -0
  29. {surface_construct-0.10.1 → surface_construct-0.10.2}/tests/test_sampling2.py +0 -0
  30. {surface_construct-0.10.1 → surface_construct-0.10.2}/tests/test_task.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: surface_construct
3
- Version: 0.10.1
3
+ Version: 0.10.2
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
@@ -34,16 +34,10 @@ Dynamic: summary
34
34
 
35
35
  本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
36
36
 
37
-
38
-
39
37
  <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
40
38
 
41
-
42
-
43
39
  ## 程序流程图 Program Workflow
44
40
 
45
-
46
-
47
41
  ![flowchart](docs/modules-计算流程.jpg)
48
42
 
49
43
  ## 重要的概念 Glossary
@@ -155,11 +149,14 @@ $$
155
149
  * v 0.8: 孔材料体系格点构造
156
150
  * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
157
151
  * v 0.9.2: debug 支持三斜晶系的表面格点化
152
+ * v 0.9.3: debug GridGenerator
153
+ * v 0.10: 表面终结生成完整并入
158
154
 
159
155
  **TODO**
160
156
 
161
157
  * 计算位点 SALI (Structure-Activity Landscape Index),量化 activity cliffs,SALI = |ΔActivity| / (1 − Similarity)
162
158
  * 新增 PathSampler,用于在相邻的关键格点之间的扩散路径进行采样,使用 ase.neb.idpp 方法进行采样,使用 Delaunay 剖分找到相邻位点的路径。
159
+ * Low-Energy Region Explorer 方法借鉴[^LoreX]: 划分能量区域, 进行 Delaunay 划分,合并较小的区域为较大的区域。然后针对低能的区域进行额外采样。也可以适用不同的方法,低精度进行低能高能区域识别,然后高精度方法加强。
163
160
  * 表面位点数据库
164
161
  * 多原子体系(内坐标受限体系)
165
162
  * 完善用户界面、例子、教程
@@ -171,4 +168,5 @@ $$
171
168
  [^BASC]: Shane Carr, Roman Garnett, Cynthia LoBASC: Applying Bayesian Optimization to the Search for Global Minima on Potential Energy Surfaces.
172
169
 
173
170
  [^向量空间转化]: 计算实空间和向量空间的相邻格点距离的映射系数,根据此系数将实空间的距离转化为向量空间距离。
171
+ [^LoreX]: Chuan-Nan Li, Han-Pu Liang, Siyuan Xu, Haochen Wang, Bai-Qing Zhao, Jingxiu Yang, Xie Zhang, Zijing Lin, Su-Huai Wei, LoreX: A Low-Energy Region Explorer Boosts Efficient Crystal Structure Prediction, J. Am. Chem. Soc. 2025, 147, 11, 9544–9555.
174
172
 
@@ -4,16 +4,10 @@
4
4
 
5
5
  本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
6
6
 
7
-
8
-
9
7
  <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
10
8
 
11
-
12
-
13
9
  ## 程序流程图 Program Workflow
14
10
 
15
-
16
-
17
11
  ![flowchart](docs/modules-计算流程.jpg)
18
12
 
19
13
  ## 重要的概念 Glossary
@@ -125,11 +119,14 @@ $$
125
119
  * v 0.8: 孔材料体系格点构造
126
120
  * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
127
121
  * v 0.9.2: debug 支持三斜晶系的表面格点化
122
+ * v 0.9.3: debug GridGenerator
123
+ * v 0.10: 表面终结生成完整并入
128
124
 
129
125
  **TODO**
130
126
 
131
127
  * 计算位点 SALI (Structure-Activity Landscape Index),量化 activity cliffs,SALI = |ΔActivity| / (1 − Similarity)
132
128
  * 新增 PathSampler,用于在相邻的关键格点之间的扩散路径进行采样,使用 ase.neb.idpp 方法进行采样,使用 Delaunay 剖分找到相邻位点的路径。
129
+ * Low-Energy Region Explorer 方法借鉴[^LoreX]: 划分能量区域, 进行 Delaunay 划分,合并较小的区域为较大的区域。然后针对低能的区域进行额外采样。也可以适用不同的方法,低精度进行低能高能区域识别,然后高精度方法加强。
133
130
  * 表面位点数据库
134
131
  * 多原子体系(内坐标受限体系)
135
132
  * 完善用户界面、例子、教程
@@ -141,4 +138,5 @@ $$
141
138
  [^BASC]: Shane Carr, Roman Garnett, Cynthia LoBASC: Applying Bayesian Optimization to the Search for Global Minima on Potential Energy Surfaces.
142
139
 
143
140
  [^向量空间转化]: 计算实空间和向量空间的相邻格点距离的映射系数,根据此系数将实空间的距离转化为向量空间距离。
141
+ [^LoreX]: Chuan-Nan Li, Han-Pu Liang, Siyuan Xu, Haochen Wang, Bai-Qing Zhao, Jingxiu Yang, Xie Zhang, Zijing Lin, Su-Huai Wei, LoreX: A Low-Energy Region Explorer Boosts Efficient Crystal Structure Prediction, J. Am. Chem. Soc. 2025, 147, 11, 9544–9555.
144
142
 
@@ -15,7 +15,7 @@ install_requires = [
15
15
 
16
16
  setup(
17
17
  name='surface_construct',
18
- version='0.10.1',
18
+ version='0.10.2',
19
19
  packages=find_packages(),
20
20
  url='https://gitee.com/pjren/surface_construct/',
21
21
  license='GPL',
@@ -5,30 +5,17 @@ TODO: 双结合位点情况。表面位点采样[(x1, y1, z1), (x2, y2, z2)]。
5
5
  TODO: 构效关系建立。将不同的位点向量合并,然后进行性能分布的关联,投影到二维平面(PCA)。
6
6
  """
7
7
  import itertools
8
- import pickle
9
-
10
8
  import ase
11
- import matplotlib.tri as mtri
12
9
  import networkx as nx
13
10
  import numpy as np
14
11
  from ase.data import covalent_radii, vdw_radii, chemical_symbols
15
- from ase.geometry import find_mic
16
12
  from ase.neighborlist import natural_cutoffs, primitive_neighbor_list
17
- from ase.visualize import view
18
- from matplotlib import pyplot as plt
19
- from scipy.interpolate import griddata
20
13
  from scipy.sparse import coo_matrix
21
14
  from scipy.spatial import cKDTree
22
15
  from scipy.spatial.distance import euclidean
23
16
  from sklearn.decomposition import PCA
24
- from sklearn.gaussian_process import GaussianProcessRegressor
25
- from sklearn.gaussian_process.kernels import RBF, ConstantKernel, WhiteKernel
26
- from sklearn.preprocessing import StandardScaler
27
-
28
- from surface_construct.sg_sampler import InitialSGSampler, addition_samples
29
17
  from surface_construct.utils import get_calc_info, get_distances, get_graph_core, wrap_grid, \
30
18
  filter_index_label, rattle, iso_surface, extended_points
31
- from surface_construct.utils.weight_functions import vb_weight
32
19
 
33
20
 
34
21
  class DoNothing:
@@ -353,6 +340,8 @@ class GridGenerator:
353
340
  return self._grid
354
341
 
355
342
  def view(self, tag=None):
343
+ from ase.visualize import view
344
+
356
345
  if len(self.grid) > 10000:
357
346
  print("Too much grid number, it will be very slow.")
358
347
  atoms = ase.Atoms(symbols=['X'] * len(self.grid), positions=self.grid)
@@ -696,12 +685,16 @@ class SurfaceGrid:
696
685
  :param grid_idx:
697
686
  :return:
698
687
  """
688
+ from ase.geometry import find_mic
689
+
699
690
  order = np.argsort(self._Dga[grid_idx])
700
691
  p1, p2 = self.atoms.positions[order[0:2]]
701
692
  v, _ = find_mic(p2-p1, cell=self.atoms.cell, pbc=self.atoms.pbc)
702
693
  return v
703
694
 
704
695
  def view_grid(self, tag=None):
696
+ from ase.visualize import view
697
+
705
698
  if len(self.points) > 10000:
706
699
  print("Too much grid number, it will be very slow.")
707
700
 
@@ -719,7 +712,7 @@ class SurfaceGrid:
719
712
  else:
720
713
  return None
721
714
 
722
- def vectorize(self, wf=vb_weight, pca_ratio=0.9, **kwargs):
715
+ def vectorize(self, wf=None, pca_ratio=0.9, **kwargs):
723
716
  """
724
717
  TODO: 使用 DScribe 来进行向量化,并进行测试。如何测试?测试什么内容?
725
718
  TODO: 产生 cluster_mesh, 生成 cluster_mesh_id 与 point_id 之间的正反向 dict
@@ -728,6 +721,10 @@ class SurfaceGrid:
728
721
  :param kwargs:
729
722
  :return:
730
723
  """
724
+ if wf is None:
725
+ from surface_construct.utils.weight_functions import vb_weight
726
+ wf = vb_weight
727
+
731
728
  kwargs['pbc'] = kwargs.get('pbc',self.pbc)
732
729
  kwargs['r0_dict'] = kwargs.get('r0_dict', {atomnum:self.rads+r
733
730
  for atomnum,r in zip(self.atoms.numbers, self.rsub)})
@@ -799,6 +796,8 @@ class SurfaceGrid:
799
796
  :param figname:
800
797
  :return:
801
798
  """
799
+ from matplotlib import pyplot as plt
800
+
802
801
  if figname is None:
803
802
  figname = 'site_cluster.png'
804
803
  print("Plot the site verctor and cluster ...")
@@ -873,6 +872,10 @@ class SurfaceGrid:
873
872
  self.sample_dct[idx]['calculated'] = True
874
873
 
875
874
  def fit(self, key='energy'):
875
+ from sklearn.gaussian_process import GaussianProcessRegressor
876
+ from sklearn.gaussian_process.kernels import RBF, ConstantKernel, WhiteKernel
877
+ from sklearn.preprocessing import StandardScaler
878
+
876
879
  # Standardization of y
877
880
  scaler = StandardScaler()
878
881
  y = np.atleast_2d([self.sample_dct[idx][key] for idx in self.calculated_sample]).T
@@ -958,6 +961,8 @@ class SurfaceGrid:
958
961
  :param key:
959
962
  :return:
960
963
  """
964
+ from scipy.interpolate import griddata
965
+
961
966
  if key not in self.grid_property:
962
967
  raise KeyError
963
968
  if len(path) < 2:
@@ -995,6 +1000,9 @@ class SurfaceGrid:
995
1000
  :param vmin: colorbar 最小值,默认自动
996
1001
  :return:
997
1002
  """
1003
+ from matplotlib import pyplot as plt
1004
+ import matplotlib.tri as mtri
1005
+
998
1006
  assert key in self.grid_property
999
1007
  fig, ax = plt.subplots()
1000
1008
  ax.set_aspect('equal')
@@ -1027,6 +1035,9 @@ class SurfaceGrid:
1027
1035
 
1028
1036
  def plot_sigma(self, key='energy', figname=None, vmax=None, vmin=None):
1029
1037
  # TODO: 支持 cluster 作图。保存原始 meshgrid 和 id?或者重新插值?
1038
+ from matplotlib import pyplot as plt
1039
+ import matplotlib.tri as mtri
1040
+
1030
1041
  assert key in self.grid_property_sigma
1031
1042
  fig, ax = plt.subplots()
1032
1043
  ax.set_aspect('equal')
@@ -1067,6 +1078,7 @@ class SurfaceGrid:
1067
1078
  return None
1068
1079
 
1069
1080
  def to_pkl(self, pkl_file="surface_grid.pkl"):
1081
+ import pickle
1070
1082
  file_pi = open(pkl_file, 'wb')
1071
1083
  pickle.dump(self, file_pi)
1072
1084
  file_pi.close()
@@ -1084,6 +1096,7 @@ class SurfaceGrid:
1084
1096
 
1085
1097
  @classmethod
1086
1098
  def from_pkl(cls, pkl_file="surface_grid.pkl"):
1099
+ import pickle
1087
1100
  filehandler = open(pkl_file, 'rb')
1088
1101
  obj = pickle.load(filehandler)
1089
1102
  filehandler.close()
@@ -88,7 +88,7 @@ def get_distances(p1, p2=None, cutoff=10.0, cell=None, ncell=None, pbc=None, use
88
88
  """
89
89
  if not use_ase:
90
90
  if ncell is None:
91
- ncell = np.floor((cutoff * 2) / cell.lengths())
91
+ ncell = [max([i,1]) for i in np.floor((cutoff * 2) / cell.lengths())] # 至少拓展+1,-1, 保证边缘周期性
92
92
  for ip,p in enumerate(pbc):
93
93
  if not p: # 如果不是周期性的,则不要重复
94
94
  ncell[ip] = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: surface_construct
3
- Version: 0.10.1
3
+ Version: 0.10.2
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
@@ -34,16 +34,10 @@ Dynamic: summary
34
34
 
35
35
  本软件同时进行表面位点的构建、采样、计算、分析,和反应过程的分析采样,即过渡态和分子构象,由此可以实现分子在表面反应的全过程采样。其中的技术关键是采样的效率,我们针对性地使用综合使用了多样化的采样策略,保证表面各类型位点和关键位点的充分采样。
36
36
 
37
-
38
-
39
37
  <img src="docs/birds_view.png" alt="表面位点全局分析" style="zoom:50%;" />
40
38
 
41
-
42
-
43
39
  ## 程序流程图 Program Workflow
44
40
 
45
-
46
-
47
41
  ![flowchart](docs/modules-计算流程.jpg)
48
42
 
49
43
  ## 重要的概念 Glossary
@@ -155,11 +149,14 @@ $$
155
149
  * v 0.8: 孔材料体系格点构造
156
150
  * v 0.9: 重新梳理软件的模块,优化软件使用逻辑
157
151
  * v 0.9.2: debug 支持三斜晶系的表面格点化
152
+ * v 0.9.3: debug GridGenerator
153
+ * v 0.10: 表面终结生成完整并入
158
154
 
159
155
  **TODO**
160
156
 
161
157
  * 计算位点 SALI (Structure-Activity Landscape Index),量化 activity cliffs,SALI = |ΔActivity| / (1 − Similarity)
162
158
  * 新增 PathSampler,用于在相邻的关键格点之间的扩散路径进行采样,使用 ase.neb.idpp 方法进行采样,使用 Delaunay 剖分找到相邻位点的路径。
159
+ * Low-Energy Region Explorer 方法借鉴[^LoreX]: 划分能量区域, 进行 Delaunay 划分,合并较小的区域为较大的区域。然后针对低能的区域进行额外采样。也可以适用不同的方法,低精度进行低能高能区域识别,然后高精度方法加强。
163
160
  * 表面位点数据库
164
161
  * 多原子体系(内坐标受限体系)
165
162
  * 完善用户界面、例子、教程
@@ -171,4 +168,5 @@ $$
171
168
  [^BASC]: Shane Carr, Roman Garnett, Cynthia LoBASC: Applying Bayesian Optimization to the Search for Global Minima on Potential Energy Surfaces.
172
169
 
173
170
  [^向量空间转化]: 计算实空间和向量空间的相邻格点距离的映射系数,根据此系数将实空间的距离转化为向量空间距离。
171
+ [^LoreX]: Chuan-Nan Li, Han-Pu Liang, Siyuan Xu, Haochen Wang, Bai-Qing Zhao, Jingxiu Yang, Xie Zhang, Zijing Lin, Su-Huai Wei, LoreX: A Low-Energy Region Explorer Boosts Efficient Crystal Structure Prediction, J. Am. Chem. Soc. 2025, 147, 11, 9544–9555.
174
172
 
@@ -11,7 +11,7 @@ class TestSimpleSurface:
11
11
  slab1 = Slab(s)
12
12
  superslab1 = slab1.supercell((3,3))
13
13
  terms = superslab1.get_all_terminations(unique=True)
14
- atoms_list = [t.atoms for t in terms]
14
+ atoms_list = [t.atoms for t in terms.values]
15
15
 
16
16
  slab2 = Slab(s, from_last=True)
17
17
  superslab2 = slab2.supercell((3,3))
@@ -111,7 +111,7 @@ class TestSurfaceGrid:
111
111
  # This a large surface, contain about 75K points.
112
112
  atoms = ase.io.read('atoms_files/POSCAR_In2O3_110')
113
113
  superatoms = atoms.repeat([2,2,1])
114
- sg_obj = SurfaceGrid(superatoms, interval=0.1, ads_num=6, lpca=False)
114
+ sg_obj = SurfaceGrid(superatoms, interval=0.2, ads_num=6, lpca=False)
115
115
  sg_obj.gridize(subtype='slab')
116
116
  Lga = sg_obj._Lga
117
117
  print(Lga.shape)