surface-construct 0.12.1__tar.gz → 0.12.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.
- {surface_construct-0.12.1/surface_construct.egg-info → surface_construct-0.12.2}/PKG-INFO +1 -1
- {surface_construct-0.12.1 → surface_construct-0.12.2}/setup.py +1 -1
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/surface_grid.py +17 -39
- {surface_construct-0.12.1 → surface_construct-0.12.2/surface_construct.egg-info}/PKG-INFO +1 -1
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_surface_grid.py +19 -1
- {surface_construct-0.12.1 → surface_construct-0.12.2}/LICENSE +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/README.md +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/setup.cfg +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/__init__.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/db.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/sg_sampler.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/__init__.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/adsorbate.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/combiner.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/pymsym_test.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/surface.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/__init__.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/afm.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/sitesampling.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/taskbase.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/terminations.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/__init__.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/atoms.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/geometry.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/pymsym_wrapper.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/spglib_wrapper.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/weight_functions.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/SOURCES.txt +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_adsorbate.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_combiner.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_sampling1.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_sampling2.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_simple_surface.py +0 -0
- {surface_construct-0.12.1 → surface_construct-0.12.2}/tests/test_task.py +0 -0
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/surface_grid.py
RENAMED
|
@@ -1143,45 +1143,23 @@ def combine_sg_vector(*sg_lst):
|
|
|
1143
1143
|
elif len(sg_lst) == 1:
|
|
1144
1144
|
return sg_lst[0]._raw_vector
|
|
1145
1145
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
vlen_max = species_default_dct.copy()
|
|
1146
|
+
species_lst = sorted({s[0] for sg in sg_lst for s in sg.species})
|
|
1147
|
+
vlen = max([sg.vlen for sg in sg_lst])
|
|
1148
|
+
vectors_lst = []
|
|
1150
1149
|
for sg in sg_lst:
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
new_vector = []
|
|
1166
|
-
for num, cnt in species_lst:
|
|
1167
|
-
new_vlen = vlen_max[num]
|
|
1168
|
-
new_v = np.zeros([nvector, new_vlen])
|
|
1169
|
-
new_v += 1.0 * raw_vector.min() # 超过截断的使用最小值的三分之二,从而减小不同表面之间的结构差异
|
|
1170
|
-
# 判断长度是不是 0
|
|
1171
|
-
if cnt == 0:
|
|
1172
|
-
new_vector.append(new_v)
|
|
1173
|
-
continue
|
|
1174
|
-
# 取出对应的 vector 列
|
|
1175
|
-
old_v = raw_vector[:, pointer:pointer+cnt]
|
|
1176
|
-
# 判断是不是要补齐
|
|
1177
|
-
if cnt == new_vlen:
|
|
1178
|
-
new_vector.append(old_v)
|
|
1179
|
-
else:
|
|
1180
|
-
new_v[:, :cnt] = old_v
|
|
1181
|
-
new_vector.append(new_v)
|
|
1182
|
-
pointer += cnt
|
|
1183
|
-
new_vector = np.concatenate(new_vector, axis=1)
|
|
1184
|
-
new_vector_lst.append(new_vector)
|
|
1185
|
-
vector_combine = np.concatenate(new_vector_lst, axis=0)
|
|
1150
|
+
sp0 = [s[0] for s in sg.species] # 所有的物种
|
|
1151
|
+
if species_lst == sp0 and sg.vlen==vlen: #如果元素相同,vlen相同,直接合并
|
|
1152
|
+
vectors_lst.append(sg._raw_vector)
|
|
1153
|
+
else: # 如果元素或者vlen不同,都要重新定义 vector
|
|
1154
|
+
vector = np.zeros((len(sg.vector), vlen*len(species_lst)))
|
|
1155
|
+
for old_idx, atomnum in enumerate(sp0):
|
|
1156
|
+
new_idx = species_lst.index(atomnum)
|
|
1157
|
+
idx_up = new_idx*vlen
|
|
1158
|
+
idx_down = idx_up + sg.vlen
|
|
1159
|
+
old_idx_up, old_idx_down = old_idx*sg.vlen, (old_idx+1)*sg.vlen
|
|
1160
|
+
vector[:, idx_up:idx_down] = sg._raw_vector[:, old_idx_up:old_idx_down]
|
|
1161
|
+
vectors_lst.append(vector)
|
|
1162
|
+
|
|
1163
|
+
vector_combine = np.concatenate(vectors_lst, axis=0)
|
|
1186
1164
|
|
|
1187
1165
|
return vector_combine
|
|
@@ -6,6 +6,8 @@ import ase
|
|
|
6
6
|
from surface_construct import GridGenerator
|
|
7
7
|
from ase.cluster.cubic import FaceCenteredCubic
|
|
8
8
|
from surface_construct import SurfaceGrid
|
|
9
|
+
from surface_construct.structures.surface_grid import combine_sg_vector
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
class TestSurfaceGrid:
|
|
11
13
|
def test_Cu_cluster(self):
|
|
@@ -126,4 +128,20 @@ class TestSurfaceGrid:
|
|
|
126
128
|
sg_obj.gridize(subtype='slab')
|
|
127
129
|
sg_obj.vectorize()
|
|
128
130
|
assert sg_obj.vector.shape==(6582, 40)
|
|
129
|
-
|
|
131
|
+
|
|
132
|
+
def test_sg_combiner(self):
|
|
133
|
+
atoms1 = ase.io.read('atoms_files/C4H4O_Cu.vasp')
|
|
134
|
+
sg_obj1 = SurfaceGrid(atoms1, interval=0.2, ads_num=6, lpca=False)
|
|
135
|
+
sg_obj1.gridize(subtype='slab')
|
|
136
|
+
sg_obj1.vectorize()
|
|
137
|
+
assert sg_obj1.vector.shape[1] == 40
|
|
138
|
+
|
|
139
|
+
atoms2 = ase.io.read('atoms_files/Fe28C12_115_12_POSCAR')
|
|
140
|
+
sg_obj2 = SurfaceGrid(atoms2, interval=0.2, ads_num=6, lpca=False, vlen=15)
|
|
141
|
+
sg_obj2.gridize(subtype='slab')
|
|
142
|
+
sg_obj2.vectorize()
|
|
143
|
+
|
|
144
|
+
assert sg_obj2.vector.shape[1] == 30
|
|
145
|
+
|
|
146
|
+
comb_vector = combine_sg_vector(sg_obj1, sg_obj2)
|
|
147
|
+
assert comb_vector.shape[1] == 75
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/default_parameter.py
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/__init__.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/adsorbate.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/combiner.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/pymsym_test.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/structures/surface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/sitesampling.py
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/tasks/terminations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/pymsym_wrapper.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/spglib_wrapper.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct/utils/weight_functions.py
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/surface_construct.egg-info/requires.txt
RENAMED
|
File without changes
|
{surface_construct-0.12.1 → surface_construct-0.12.2}/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
|