-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStructure.py
More file actions
92 lines (76 loc) · 2.31 KB
/
Structure.py
File metadata and controls
92 lines (76 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from typing import List
from typing import NewType
from ase import Atoms as ASE_Atoms
from ase.io import read as ASE_read
StringList = List[str]
class Atom(object):
"""
CoDE Atom structure, based on ASE Atom
"""
def __init__(self, parent=None)->None:
self._atom = None
pass
def symbol(self)-> str:
"""
Return atomic symbol
"""
return self._symbol
class Cell(object):
"""
CoDE Cell structure, based on ASE Atom.Cell
"""
def __init__(self, parent=None)->None:
self._a = 5.0
self._b = 5.0
self._c = 5.0
self._alpha = 90.0
self._beta = 90.0
self._gamma = 90.0
class Atoms(object):
"""
CoDE Atoms structure, based on ASE Atoms
"""
def __init__(self, parent=None, symbols:StringList=None, cell:Cell=None)->None:
if symbols is not None:
self._atoms = self.createFromSymbols(symbols)
#self.aseAtoms = self.createASEAtomsFromSymbols(symbols)
pass
def createFromSymbols(self, symbols:StringList=None) -> list:
"""
Create Atoms structure based on passed list of atoms
"""
pass
# def createASEAtomsFromSymbols(self, symbols:StringList=None) -> list:
# """
# Create ASE Atoms structure based on passed list of atoms
# """
# pass
class Structure(object):
def __init__(self, file=None, atoms_represenatation=None):
self._atoms = None # ASE Atoms object
self._cell = None # External representation of the cell
self._bonds = None
self._symmetry = None
if file is not None:
self.load(file)
def create(self, formula=None):
"""
Wrapper for ASE atoms generator
"""
self._atoms = Atoms(symbols=formula)
def create3D(self, formula=None, cell=None):
"""
Wrapper for ASE atoms+cell generator
"""
self._atoms = Atoms(symbols=formula, cell=cell)
def load(self, file=None):
"""
Load structure from file
"""
# assume file can be read from within ASE
self._atoms = ASE_read(file)
def aseStructure(self):
"""
Return the ASE representation of the Atoms in Structure
"""
return self._atoms