surface-construct 0.9__tar.gz → 0.9.1__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/surface_construct.egg-info → surface_construct-0.9.1}/PKG-INFO +1 -1
- {surface_construct-0.9 → surface_construct-0.9.1}/setup.py +3 -3
- surface_construct-0.9.1/surface_construct/structures/__init__.py +50 -0
- surface_construct-0.9.1/surface_construct/structures/adsorbate.py +38 -0
- surface_construct-0.9.1/surface_construct/structures/surface.py +738 -0
- surface_construct-0.9.1/surface_construct/structures/surface_grid.py +1131 -0
- surface_construct-0.9.1/surface_construct/tasks/__init__.py +14 -0
- surface_construct-0.9.1/surface_construct/tasks/sitesampling.py +191 -0
- surface_construct-0.9.1/surface_construct/tasks/taskbase.py +43 -0
- surface_construct-0.9.1/surface_construct/tasks/terminations.py +0 -0
- surface_construct-0.9.1/surface_construct/utils/__init__.py +196 -0
- surface_construct-0.9.1/surface_construct/utils/atoms.py +567 -0
- surface_construct-0.9.1/surface_construct/utils/weight_functions.py +65 -0
- {surface_construct-0.9 → surface_construct-0.9.1/surface_construct.egg-info}/PKG-INFO +1 -1
- surface_construct-0.9.1/surface_construct.egg-info/SOURCES.txt +27 -0
- surface_construct-0.9/surface_construct.egg-info/SOURCES.txt +0 -16
- {surface_construct-0.9 → surface_construct-0.9.1}/LICENSE +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/README.md +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/setup.cfg +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct/__init__.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct/db.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct/default_parameter.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct/sg_sampler.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct.egg-info/dependency_links.txt +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct.egg-info/requires.txt +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/surface_construct.egg-info/top_level.txt +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/tests/test_sampling1.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/tests/test_sampling2.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/tests/test_surface_grid.py +0 -0
- {surface_construct-0.9 → surface_construct-0.9.1}/tests/test_task.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from setuptools import setup
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
3
|
with open("README.md", "r", encoding='utf-8') as f:
|
|
4
4
|
long_description = f.read()
|
|
@@ -15,8 +15,8 @@ install_requires = [
|
|
|
15
15
|
|
|
16
16
|
setup(
|
|
17
17
|
name='surface_construct',
|
|
18
|
-
version='0.9',
|
|
19
|
-
packages=
|
|
18
|
+
version='0.9.1',
|
|
19
|
+
packages=find_packages(),
|
|
20
20
|
url='https://gitee.com/pjren/surface_construct/',
|
|
21
21
|
license='GPL',
|
|
22
22
|
author='ren',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class AdsGridCombiner:
|
|
2
|
+
def __init__(self, sg_obj, ads_obj,
|
|
3
|
+
**kwargs):
|
|
4
|
+
"""
|
|
5
|
+
:param sg_obj: 表面格点
|
|
6
|
+
:param ads_obj: 吸附分子,包含Atoms,主轴,内坐标列表,根据这些参数可以得到分子坐标
|
|
7
|
+
:param kwargs:
|
|
8
|
+
"""
|
|
9
|
+
self.atoms = None
|
|
10
|
+
self.sg_obj = sg_obj
|
|
11
|
+
self.ads_obj = ads_obj
|
|
12
|
+
self.kwargs = kwargs
|
|
13
|
+
if self.sg_obj.atoms.calc is not None:
|
|
14
|
+
self.calc = self.sg_obj.atoms.calc
|
|
15
|
+
else:
|
|
16
|
+
if self.ads_obj.atoms.calc is not None:
|
|
17
|
+
self.calc = self.ads_obj.atoms.calc
|
|
18
|
+
else:
|
|
19
|
+
self.calc = None
|
|
20
|
+
|
|
21
|
+
def get_atoms(self, grid_idx=None,**kwargs):
|
|
22
|
+
"""
|
|
23
|
+
将分子放置于 grid_idx 格点上
|
|
24
|
+
:param grid_idx: 格点序号。默认是随机idx。
|
|
25
|
+
:return: 组合后的 Atoms
|
|
26
|
+
"""
|
|
27
|
+
attitude = kwargs.get('attitude') # 分子姿态,分子主轴的夹角
|
|
28
|
+
internal_coord = kwargs.get('internal_coord') # 分子内坐标
|
|
29
|
+
ads_atoms = self.ads_obj.atoms.copy()
|
|
30
|
+
# TODO: 先进性 rotate and 改变分子构象
|
|
31
|
+
site = self.sg_obj.points[grid_idx]
|
|
32
|
+
# TODO: get_z 去更新 site 的坐标
|
|
33
|
+
site = self._get_z(site, ads_atoms)
|
|
34
|
+
ads_atoms.set_positions(ads_atoms.get_positions() +
|
|
35
|
+
(site - ads_atoms.get_center_of_mass()))
|
|
36
|
+
|
|
37
|
+
atoms = self.sg_obj.atoms.copy()
|
|
38
|
+
atoms += ads_atoms
|
|
39
|
+
atoms.calc = self.calc
|
|
40
|
+
self.atoms = atoms
|
|
41
|
+
return atoms
|
|
42
|
+
|
|
43
|
+
def _get_z(self, xyz0, ads_atoms):
|
|
44
|
+
"""
|
|
45
|
+
由于分子可能会与表面冲突,调整分子的高度可以避免
|
|
46
|
+
事实上调整的是沿着格点法向向量的距离 xyz = xyz0 + r×d
|
|
47
|
+
:return:
|
|
48
|
+
"""
|
|
49
|
+
xyz = xyz0
|
|
50
|
+
return xyz
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ase import Atoms
|
|
3
|
+
|
|
4
|
+
class Adsorbate:
|
|
5
|
+
"""
|
|
6
|
+
吸附分子的类,包含质心,内坐标,主轴
|
|
7
|
+
"""
|
|
8
|
+
def __init__(self, atoms, **kwargs):
|
|
9
|
+
# TODO:加上半径的参数,计算分子半径
|
|
10
|
+
self.atoms = atoms
|
|
11
|
+
self.internal_coords = dict()
|
|
12
|
+
self.kwargs = kwargs
|
|
13
|
+
self._rads = 0.76 # 默认是碳原子的共价半径
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def com(self):
|
|
17
|
+
return self.atoms.center_of_mass()
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def principal_axis(self):
|
|
21
|
+
# 分子主轴向量
|
|
22
|
+
evals, evecs = self.atoms.get_moments_of_inertia(vectors=True)
|
|
23
|
+
return evecs[np.argmin(np.abs(evals))]
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def rads(self):
|
|
27
|
+
# 分子的半径,sg_obj 构造时作为参考
|
|
28
|
+
# TODO: 计算分子半径
|
|
29
|
+
return self._rads
|
|
30
|
+
|
|
31
|
+
@rads.setter
|
|
32
|
+
def rads(self, value):
|
|
33
|
+
self._rads = value
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def natoms(self):
|
|
37
|
+
return len(self.atoms)
|
|
38
|
+
|