surface-construct 0.12.6__tar.gz → 0.12.7__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.12.6/surface_construct.egg-info → surface_construct-0.12.7}/PKG-INFO +1 -1
- {surface_construct-0.12.6 → surface_construct-0.12.7}/setup.py +1 -1
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/sg_sampler.py +12 -5
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/sitesampling.py +5 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/vipsitetask.py +29 -25
- {surface_construct-0.12.6 → surface_construct-0.12.7/surface_construct.egg-info}/PKG-INFO +1 -1
- {surface_construct-0.12.6 → surface_construct-0.12.7}/LICENSE +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/README.md +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/setup.cfg +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/__init__.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/db.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/__init__.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/adsorbate.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/combiner.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/pymsym_test.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/surface.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/surface_grid.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/__init__.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/afm.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/taskbase.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/terminations.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/__init__.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/atoms.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/geometry.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/pymsym_wrapper.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/spglib_wrapper.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/weight_functions.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/SOURCES.txt +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_adsorbate.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_combiner.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_sampling1.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_sampling2.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_simple_surface.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_surface_grid.py +0 -0
- {surface_construct-0.12.6 → surface_construct-0.12.7}/tests/test_task.py +0 -0
|
@@ -174,10 +174,12 @@ class MaxSigmaSGSampler(SGSamplerBase):
|
|
|
174
174
|
else:
|
|
175
175
|
delta = 0.01
|
|
176
176
|
idx_list = []
|
|
177
|
-
while len(idx_list)
|
|
177
|
+
while len(idx_list) < size:
|
|
178
178
|
idx_list = np.argwhere(sigma_array > sigma0-delta).flatten().tolist()
|
|
179
|
+
# 排除掉已经采过的点
|
|
180
|
+
idx_list = [i for i in idx_list if i not in self.sg_obj.calculated_sample]
|
|
179
181
|
delta += 0.01
|
|
180
|
-
idx = random.sample(idx_list, size)
|
|
182
|
+
idx = random.sample(idx_list, min(size, len(idx_list)))
|
|
181
183
|
return idx
|
|
182
184
|
else:
|
|
183
185
|
raise "No energy for all population, pls do initial sampling first!"
|
|
@@ -194,10 +196,15 @@ class MinEnergySGSampler(SGSamplerBase):
|
|
|
194
196
|
raise ValueError("Number of points should greater than sample!")
|
|
195
197
|
elif len(E_array) == size:
|
|
196
198
|
return np.asarray(range(len(E_array)))
|
|
197
|
-
# 如果已经读入了一些能量,则返回能量最低的点 (<0.1eV 以内,然后随机选一个)
|
|
198
199
|
E0 = E_array.min()
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
delta = 0.1
|
|
201
|
+
idx_list = []
|
|
202
|
+
while len(idx_list) < size:
|
|
203
|
+
# 如果已经读入了一些能量,则返回能量最低的点 (<delta eV 以内,然后随机选一个)
|
|
204
|
+
idx_list = np.argwhere(E_array <= E0+0.1).flatten().tolist()
|
|
205
|
+
idx_list = [i for i in idx_list if i not in self.sg_obj.calculated_sample]
|
|
206
|
+
delta += 0.1
|
|
207
|
+
idx = random.sample(idx_list, min(size, len(idx_list)))
|
|
201
208
|
return idx
|
|
202
209
|
else:
|
|
203
210
|
raise "No energy for all population, pls do initial sampling first!"
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/sitesampling.py
RENAMED
|
@@ -171,6 +171,11 @@ class SurfaceSiteSampleTask(TaskBase):
|
|
|
171
171
|
self.sg_obj.del_sample(grid_idx)
|
|
172
172
|
|
|
173
173
|
def run(self):
|
|
174
|
+
# 在新的采样之前先进行已经采到但是未计算的点
|
|
175
|
+
uncalc_samples = [idx for idx in self.sg_obj.sample_idx if not self.sg_obj.sample_dct[idx]['calculated']]
|
|
176
|
+
for grid_idx in uncalc_samples:
|
|
177
|
+
self.irun(grid_idx, fit=False)
|
|
178
|
+
|
|
174
179
|
for isampler in self.sampler:
|
|
175
180
|
size = isampler.get("size", 1)
|
|
176
181
|
sg_sampler = isampler.get("surface")
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/vipsitetask.py
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
1
3
|
from matplotlib import pyplot as plt
|
|
2
4
|
from matplotlib.patches import Circle
|
|
3
5
|
|
|
@@ -6,41 +8,43 @@ from .sitesampling import SurfaceSiteSampleTask
|
|
|
6
8
|
class VIPSiteTask(SurfaceSiteSampleTask):
|
|
7
9
|
def __init__(self, exclude=None, include=None, **kwargs):
|
|
8
10
|
super().__init__(**kwargs)
|
|
11
|
+
if not os.path.isfile(self.hist_pkl):
|
|
12
|
+
vip_id = self.sg_obj.vip_id
|
|
13
|
+
grid_site_type, site_type_dict = self.sg_obj.get_grid_site_type()
|
|
14
|
+
if exclude is None and include is None:
|
|
15
|
+
msg = [f"Either exclude or include must be specified"]
|
|
16
|
+
msg += [f"Possible site types are {len(site_type_dict)} in total:"]
|
|
17
|
+
msg += [f"{k}: {v}" for k,v in site_type_dict.items() if type(k) in (int,)]
|
|
18
|
+
raise ValueError('\n'.join(msg))
|
|
19
|
+
elif exclude is not None and include is not None:
|
|
20
|
+
raise ValueError("Can not specified exclude and include at the same time")
|
|
21
|
+
elif exclude is not None and include is None:
|
|
22
|
+
filtered = [i for i in vip_id if site_type_dict[grid_site_type[i]] not in exclude]
|
|
23
|
+
else:
|
|
24
|
+
filtered = [i for i in vip_id if site_type_dict[grid_site_type[i]] in include]
|
|
9
25
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
raise ValueError("Can not specified exclude and include at the same time")
|
|
19
|
-
elif exclude is not None and include is None:
|
|
20
|
-
filtered = [i for i in vip_id if site_type_dict[grid_site_type[i]] not in exclude]
|
|
21
|
-
else:
|
|
22
|
-
filtered = [i for i in vip_id if site_type_dict[grid_site_type[i]] in include]
|
|
23
|
-
|
|
24
|
-
points = self.sg_obj.points[filtered]
|
|
25
|
-
vector = self.sg_obj.vector[filtered]
|
|
26
|
-
raw_vector = self.sg_obj._raw_vector[filtered]
|
|
27
|
-
_ = self.sg_obj.vector_interval # 此处call 一下,用于后面的 fit 中的参数
|
|
28
|
-
self.sg_obj.points = points
|
|
29
|
-
self.sg_obj.vector = vector
|
|
30
|
-
self.sg_obj._raw_vector = raw_vector
|
|
31
|
-
self.sg_obj.vectorgen = None
|
|
26
|
+
points = self.sg_obj.points[filtered]
|
|
27
|
+
vector = self.sg_obj.vector[filtered]
|
|
28
|
+
raw_vector = self.sg_obj._raw_vector[filtered]
|
|
29
|
+
_ = self.sg_obj.vector_interval # 此处call 一下,用于后面的 fit 中的参数
|
|
30
|
+
self.sg_obj.points = points
|
|
31
|
+
self.sg_obj.vector = vector
|
|
32
|
+
self.sg_obj._raw_vector = raw_vector
|
|
33
|
+
self.sg_obj.vectorgen = None
|
|
32
34
|
|
|
33
|
-
sampler_size =
|
|
35
|
+
sampler_size = len(self.sg_obj.calculated_sample)
|
|
34
36
|
new_sampler = []
|
|
35
37
|
for isampler in self.sampler: # 不需要初始采样和key 点采样
|
|
36
38
|
if isampler['surface'] not in ('InitialSGSampler', 'KeyPointSGSampler'):
|
|
37
39
|
sampler_size += isampler.get('size', 0)
|
|
38
40
|
new_sampler.append(isampler)
|
|
41
|
+
else:
|
|
42
|
+
print("Warning: InitialSGSampler or KeyPointSGSampler should not applied in VIP sampling.")
|
|
39
43
|
|
|
40
44
|
# 如果 filter 之后的点小于等于 self.sampler['size'], 重新定义sampler
|
|
41
|
-
if sampler_size >= len(points):
|
|
45
|
+
if sampler_size >= len(self.sg_obj.points):
|
|
42
46
|
self.sampler = [{
|
|
43
|
-
'size': len(points), # 采样大小
|
|
47
|
+
'size': len(self.sg_obj.points)-len(self.sg_obj.calculated_sample), # 采样大小
|
|
44
48
|
'surface': "RandomSGSampler", # 表面采样方法
|
|
45
49
|
}]
|
|
46
50
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/default_parameter.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/__init__.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/adsorbate.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/combiner.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/pymsym_test.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/surface.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/structures/surface_grid.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/tasks/terminations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/pymsym_wrapper.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/spglib_wrapper.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct/utils/weight_functions.py
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/requires.txt
RENAMED
|
File without changes
|
{surface_construct-0.12.6 → surface_construct-0.12.7}/surface_construct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|