@mat3ra/made 2026.6.15-0 → 2026.6.29-0
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.
- package/.pre-commit-config.yaml +1 -1
- package/.prettierignore +1 -0
- package/AGENTS.md +133 -0
- package/MANIFEST.in +1 -0
- package/data/constants.json +13 -0
- package/data/reciprocal_paths.json +111 -0
- package/dist/js/data/reciprocal_paths.json +111 -0
- package/dist/js/lattice/reciprocal/paths.js +8 -113
- package/dist/js/made.d.ts +1 -1
- package/dist/js/made.js +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/js/constants/molecule.ts +1 -1
- package/src/js/lattice/reciprocal/paths.ts +10 -118
- package/src/js/made.ts +1 -1
- package/src/py/mat3ra/made/data_helper.py +5 -0
- package/src/py/mat3ra/made/lattice.py +34 -0
- package/src/py/mat3ra/made/material.py +1 -2
- package/src/py/mat3ra/made/reciprocal/__init__.py +5 -0
- package/src/py/mat3ra/made/reciprocal/lattice_reciprocal.py +147 -0
- package/src/py/mat3ra/made/reciprocal/paths.py +30 -0
- package/src/py/mat3ra/made/reciprocal/symmetry_points.py +385 -0
- package/src/py/mat3ra/made/tools/analyze/fingerprint/__init__.py +1 -1
- package/src/py/mat3ra/made/tools/analyze/fingerprint/layers/layered_fingerprint_along_axis.py +2 -3
- package/src/py/mat3ra/made/tools/analyze/interface/__init__.py +1 -1
- package/src/py/mat3ra/made/tools/analyze/lattice/analyzer.py +7 -5
- package/src/py/mat3ra/made/tools/analyze/lattice_planes.py +10 -9
- package/src/py/mat3ra/made/tools/analyze/lattice_swap_analyzer.py +3 -3
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/helpers.py +0 -1
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/utils.py +10 -11
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/stack/builder.py +26 -13
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/helpers.py +2 -2
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/strain/builder.py +1 -1
- package/src/py/mat3ra/made/tools/convert/__init__.py +8 -11
- package/src/py/mat3ra/made/tools/convert/utils.py +9 -5
- package/src/py/mat3ra/made/tools/operations/reusable/unary.py +2 -2
- package/tests/js/parsers/poscar.ts +9 -9
- package/tests/py/unit/fixtures/thrid_party/ase_atoms.py +0 -1
- package/tests/py/unit/test_data_files.py +68 -0
- package/tests/py/unit/test_lattice.py +3 -4
- package/tests/py/unit/test_lattice_type_extended.py +53 -0
- package/tests/py/unit/test_reciprocal_lattice.py +86 -0
- package/tests/py/unit/test_reciprocal_paths.py +64 -0
- package/tests/py/unit/test_symmetry_points.py +151 -0
- package/tests/py/unit/test_tools_analyze.py +7 -1
- package/tests/py/unit/test_tools_analyze_basis.py +1 -1
- package/tests/py/unit/test_tools_analyze_lattice.py +9 -4
- package/tests/py/unit/test_tools_analyze_swap.py +15 -9
- package/tests/py/unit/test_tools_build_defect/test_point_defect.py +24 -3
- package/tests/py/unit/test_tools_build_interface.py +1 -2
- package/tests/py/unit/test_tools_build_interface_zsl.py +72 -4
- package/tests/py/unit/test_tools_build_metadata.py +0 -1
- package/tests/py/unit/test_tools_calculate.py +1 -0
- package/tests/py/unit/test_tools_convert.py +1 -4
- package/tests/py/unit/utils.py +29 -0
- package/constants.json +0 -13
- package/src/py/mat3ra/made/constants.py +0 -11
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Brillouin zone high-symmetry points by lattice type.
|
|
3
|
+
|
|
4
|
+
AFLOW methodology is used for implementation.
|
|
5
|
+
Reference: https://arxiv.org/abs/1004.2974
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import math
|
|
9
|
+
from typing import Any, Callable, Dict, List
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _cub(**_: Any) -> List[dict]:
|
|
13
|
+
return [
|
|
14
|
+
{"point": "R", "coordinates": [0.5, 0.5, 0.5]},
|
|
15
|
+
{"point": "X", "coordinates": [0.0, 0.5, 0.0]},
|
|
16
|
+
{"point": "M", "coordinates": [0.5, 0.5, 0.0]},
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _fcc(**_: Any) -> List[dict]:
|
|
21
|
+
return [
|
|
22
|
+
{"point": "K", "coordinates": [3 / 8, 3 / 8, 3 / 4]},
|
|
23
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
24
|
+
{"point": "U", "coordinates": [5 / 8, 1 / 4, 5 / 8]},
|
|
25
|
+
{"point": "W", "coordinates": [1 / 2, 1 / 4, 3 / 4]},
|
|
26
|
+
{"point": "X", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _bcc(**_: Any) -> List[dict]:
|
|
31
|
+
return [
|
|
32
|
+
{"point": "H", "coordinates": [1 / 2, -1 / 2, 1 / 2]},
|
|
33
|
+
{"point": "P", "coordinates": [1 / 4, 1 / 4, 1 / 4]},
|
|
34
|
+
{"point": "N", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _tet(**_: Any) -> List[dict]:
|
|
39
|
+
return [
|
|
40
|
+
{"point": "A", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
41
|
+
{"point": "M", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
42
|
+
{"point": "R", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
43
|
+
{"point": "X", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
44
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _bct(a: float = 1.0, c: float = 1.0, **_: Any) -> List[dict]:
|
|
49
|
+
if c < a:
|
|
50
|
+
# BCT-1
|
|
51
|
+
n = (1 + (c * c) / (a * a)) / 4
|
|
52
|
+
return [
|
|
53
|
+
{"point": "M", "coordinates": [-1 / 2, 1 / 2, 1 / 2]},
|
|
54
|
+
{"point": "N", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
55
|
+
{"point": "P", "coordinates": [1 / 4, 1 / 4, 1 / 4]},
|
|
56
|
+
{"point": "X", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
57
|
+
{"point": "Z", "coordinates": [n, n, -n]},
|
|
58
|
+
{"point": "Z1", "coordinates": [-n, 1 - n, n]},
|
|
59
|
+
]
|
|
60
|
+
# BCT-2
|
|
61
|
+
n = (1 + (a * a) / (c * c)) / 4
|
|
62
|
+
e = (a * a) / (2 * c * c)
|
|
63
|
+
return [
|
|
64
|
+
{"point": "N", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
65
|
+
{"point": "P", "coordinates": [1 / 4, 1 / 4, 1 / 4]},
|
|
66
|
+
{"point": "∑", "coordinates": [-n, n, n]},
|
|
67
|
+
{"point": "∑1", "coordinates": [n, 1 - n, -n]},
|
|
68
|
+
{"point": "X", "coordinates": [0, 0, 1 / 2]},
|
|
69
|
+
{"point": "Y", "coordinates": [-e, e, 1 / 2]},
|
|
70
|
+
{"point": "Y1", "coordinates": [1 / 2, 1 / 2, -e]},
|
|
71
|
+
{"point": "Z", "coordinates": [1 / 2, 1 / 2, -1 / 2]},
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _orc(**_: Any) -> List[dict]:
|
|
76
|
+
return [
|
|
77
|
+
{"point": "R", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
78
|
+
{"point": "S", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
79
|
+
{"point": "T", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
80
|
+
{"point": "U", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
81
|
+
{"point": "X", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
82
|
+
{"point": "Y", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
83
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _orcf(a: float = 1.0, b: float = 1.0, c: float = 1.0, **_: Any) -> List[dict]:
|
|
88
|
+
if 1 / (a * a) >= 1 / (b * b) + 1 / (c * c):
|
|
89
|
+
# ORCF-1,3
|
|
90
|
+
n = (1 + (a * a) / (b * b) + (a * a) / (c * c)) / 4
|
|
91
|
+
e = (1 + (a * a) / (b * b) - (a * a) / (c * c)) / 4
|
|
92
|
+
return [
|
|
93
|
+
{"point": "A", "coordinates": [1 / 2, 1 / 2 + e, e]},
|
|
94
|
+
{"point": "A1", "coordinates": [0.0, 1 / 2 - e, 1 - e]},
|
|
95
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
96
|
+
{"point": "T", "coordinates": [1.0, 1 / 2, 1 / 2]},
|
|
97
|
+
{"point": "X", "coordinates": [0.0, n, n]},
|
|
98
|
+
{"point": "X1", "coordinates": [1.0, 1 - n, 1 - n]},
|
|
99
|
+
{"point": "Y", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
100
|
+
{"point": "Z", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
101
|
+
]
|
|
102
|
+
# ORCF-2
|
|
103
|
+
n = (1 + (a * a) / (b * b) - (a * a) / (c * c)) / 4
|
|
104
|
+
f = (1 + (c * c) / (b * b) - (c * c) / (a * a)) / 4
|
|
105
|
+
d = (1 + (b * b) / (a * a) - (b * b) / (c * c)) / 4
|
|
106
|
+
return [
|
|
107
|
+
{"point": "C", "coordinates": [1 / 2, 1 / 2 - n, 1 - n]},
|
|
108
|
+
{"point": "C1", "coordinates": [0.0, 1 / 2 + n, n]},
|
|
109
|
+
{"point": "D", "coordinates": [1 / 2 - d, 1 / 2, 1 - d]},
|
|
110
|
+
{"point": "D1", "coordinates": [1 / 2 + d, 1 / 2, d]},
|
|
111
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
112
|
+
{"point": "H", "coordinates": [1 - f, 1 / 2 - f, 1 / 2]},
|
|
113
|
+
{"point": "H1", "coordinates": [f, 1 / 2 + f, 1 / 2]},
|
|
114
|
+
{"point": "X", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
115
|
+
{"point": "Y", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
116
|
+
{"point": "Z", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _orci(a: float = 1.0, b: float = 1.0, c: float = 1.0, **_: Any) -> List[dict]:
|
|
121
|
+
n = (1 + (a * a) / (c * c)) / 4
|
|
122
|
+
e = (1 + (b * b) / (c * c)) / 4
|
|
123
|
+
d = (b * b - a * a) / (4 * c * c)
|
|
124
|
+
m = (b * b + a * a) / (4 * c * c)
|
|
125
|
+
return [
|
|
126
|
+
{"point": "L", "coordinates": [-m, m, 1 / 2 - d]},
|
|
127
|
+
{"point": "L1", "coordinates": [m, -m, 1 / 2 + d]},
|
|
128
|
+
{"point": "L2", "coordinates": [1 / 2 - d, 1 / 2 + d, -m]},
|
|
129
|
+
{"point": "R", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
130
|
+
{"point": "S", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
131
|
+
{"point": "T", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
132
|
+
{"point": "W", "coordinates": [1 / 4, 1 / 4, 1 / 4]},
|
|
133
|
+
{"point": "X", "coordinates": [-e, e, e]},
|
|
134
|
+
{"point": "X1", "coordinates": [e, 1 - e, -e]},
|
|
135
|
+
{"point": "Y", "coordinates": [n, -n, n]},
|
|
136
|
+
{"point": "Y1", "coordinates": [1 - n, n, -n]},
|
|
137
|
+
{"point": "Z", "coordinates": [1 / 2, 1 / 2, -1 / 2]},
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _orcc(a: float = 1.0, b: float = 1.0, **_: Any) -> List[dict]:
|
|
142
|
+
e = (1 + (a * a) / (b * b)) / 4
|
|
143
|
+
return [
|
|
144
|
+
{"point": "A", "coordinates": [e, e, 1 / 2]},
|
|
145
|
+
{"point": "A1", "coordinates": [-e, 1 - e, 1 / 2]},
|
|
146
|
+
{"point": "R", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
147
|
+
{"point": "S", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
148
|
+
{"point": "T", "coordinates": [-1 / 2, 1 / 2, 1 / 2]},
|
|
149
|
+
{"point": "X", "coordinates": [e, e, 0.0]},
|
|
150
|
+
{"point": "X1", "coordinates": [-e, 1 - e, 0.0]},
|
|
151
|
+
{"point": "Y", "coordinates": [-1 / 2, 1 / 2, 0.0]},
|
|
152
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
153
|
+
]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _hex(**_: Any) -> List[dict]:
|
|
157
|
+
return [
|
|
158
|
+
{"point": "A", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
159
|
+
{"point": "H", "coordinates": [1 / 3, 1 / 3, 1 / 2]},
|
|
160
|
+
{"point": "K", "coordinates": [1 / 3, 1 / 3, 0.0]},
|
|
161
|
+
{"point": "L", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
162
|
+
{"point": "M", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _rhl(alpha: float = 90.0, **_: Any) -> List[dict]:
|
|
167
|
+
cos_alpha = math.cos(math.radians(alpha))
|
|
168
|
+
if cos_alpha > 0:
|
|
169
|
+
# RHL-1
|
|
170
|
+
n = (1 + 4 * cos_alpha) / (2 + 4 * cos_alpha)
|
|
171
|
+
v = 3 / 4 - n / 2
|
|
172
|
+
return [
|
|
173
|
+
{"point": "B", "coordinates": [n, 1 / 2, 1 - n]},
|
|
174
|
+
{"point": "B1", "coordinates": [1 / 2, 1 - n, n - 1]},
|
|
175
|
+
{"point": "F", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
176
|
+
{"point": "L", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
177
|
+
{"point": "L1", "coordinates": [0.0, 0.0, -1 / 2]},
|
|
178
|
+
{"point": "P", "coordinates": [n, v, v]},
|
|
179
|
+
{"point": "P1", "coordinates": [1 - v, 1 - v, 1 - n]},
|
|
180
|
+
{"point": "P2", "coordinates": [v, v, n - 1]},
|
|
181
|
+
{"point": "Q", "coordinates": [1 - v, v, 0.0]},
|
|
182
|
+
{"point": "X", "coordinates": [v, 0.0, -v]},
|
|
183
|
+
{"point": "Z", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
184
|
+
]
|
|
185
|
+
# RHL-2
|
|
186
|
+
n = (1 / 2 * (1 + cos_alpha)) / (1 - cos_alpha)
|
|
187
|
+
v = 3 / 4 - n / 2
|
|
188
|
+
return [
|
|
189
|
+
{"point": "F", "coordinates": [1 / 2, -1 / 2, 0.0]},
|
|
190
|
+
{"point": "L", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
191
|
+
{"point": "P", "coordinates": [1 - v, -v, 1 - v]},
|
|
192
|
+
{"point": "P1", "coordinates": [v, v - 1, v - 1]},
|
|
193
|
+
{"point": "Q", "coordinates": [n, n, n]},
|
|
194
|
+
{"point": "Q1", "coordinates": [1 - n, -n, -n]},
|
|
195
|
+
{"point": "Z", "coordinates": [1 / 2, -1 / 2, 1 / 2]},
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _mcl(b: float = 1.0, c: float = 1.0, alpha: float = 90.0, **_: Any) -> List[dict]:
|
|
200
|
+
cos_alpha = math.cos(math.radians(alpha))
|
|
201
|
+
n = (1 / 2 * (1 - (b * cos_alpha) / c)) / (1 - cos_alpha * cos_alpha)
|
|
202
|
+
v = 1 / 2 - (n * c * cos_alpha) / b
|
|
203
|
+
return [
|
|
204
|
+
{"point": "A", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
205
|
+
{"point": "C", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
206
|
+
{"point": "D", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
207
|
+
{"point": "D1", "coordinates": [1 / 2, 0.0, -1 / 2]},
|
|
208
|
+
{"point": "E", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
209
|
+
{"point": "H", "coordinates": [0.0, n, 1 - v]},
|
|
210
|
+
{"point": "H1", "coordinates": [0.0, 1 - n, v]},
|
|
211
|
+
{"point": "H2", "coordinates": [0.0, n, -v]},
|
|
212
|
+
{"point": "M", "coordinates": [1 / 2, n, 1 - v]},
|
|
213
|
+
{"point": "M1", "coordinates": [1 / 2, 1 - n, v]},
|
|
214
|
+
{"point": "M2", "coordinates": [1 / 2, n, -v]},
|
|
215
|
+
{"point": "X", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
216
|
+
{"point": "Y", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
217
|
+
{"point": "Y1", "coordinates": [0.0, 0.0, -1 / 2]},
|
|
218
|
+
{"point": "Z", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _mclc(
|
|
223
|
+
a: float = 1.0,
|
|
224
|
+
b: float = 1.0,
|
|
225
|
+
c: float = 1.0,
|
|
226
|
+
alpha: float = 90.0,
|
|
227
|
+
gamma: float = 90.0,
|
|
228
|
+
**_: Any,
|
|
229
|
+
) -> List[dict]:
|
|
230
|
+
cos_alpha = math.cos(math.radians(alpha))
|
|
231
|
+
if gamma >= 90:
|
|
232
|
+
# MCLC-1,2
|
|
233
|
+
e = (2 - (b * cos_alpha) / c) / (4 * (1 - cos_alpha * cos_alpha))
|
|
234
|
+
n = 1 / 2 + (2 * e * c * cos_alpha) / b
|
|
235
|
+
p = 3 / 4 - (a * a) / (4 * b * b * (1 - cos_alpha * cos_alpha))
|
|
236
|
+
f = p + ((3 / 4 - p) * cos_alpha * b) / c
|
|
237
|
+
return [
|
|
238
|
+
{"point": "N", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
239
|
+
{"point": "N1", "coordinates": [0.0, -1 / 2, 0.0]},
|
|
240
|
+
{"point": "F", "coordinates": [1 - e, 1 - e, 1 - n]},
|
|
241
|
+
{"point": "F1", "coordinates": [e, e, n]},
|
|
242
|
+
{"point": "F2", "coordinates": [-e, -e, 1 - n]},
|
|
243
|
+
{"point": "F3", "coordinates": [1 - e, -e, 1 - n]},
|
|
244
|
+
{"point": "I", "coordinates": [f, 1 - f, 1 / 2]},
|
|
245
|
+
{"point": "I1", "coordinates": [1 - f, f - 1, 1 / 2]},
|
|
246
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
247
|
+
{"point": "M", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
248
|
+
{"point": "X", "coordinates": [1 - p, p - 1, 0.0]},
|
|
249
|
+
{"point": "X1", "coordinates": [p, 1 - p, 0.0]},
|
|
250
|
+
{"point": "X2", "coordinates": [p - 1, -p, 0.0]},
|
|
251
|
+
{"point": "Y", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
252
|
+
{"point": "Y1", "coordinates": [-1 / 2, -1 / 2, 0.0]},
|
|
253
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
254
|
+
]
|
|
255
|
+
if (b / c) * cos_alpha + (b * b / (a * a)) * (1 - cos_alpha * cos_alpha) <= 1:
|
|
256
|
+
# MCLC-3,4
|
|
257
|
+
m = (1 + (b * b) / (a * a)) / 4
|
|
258
|
+
d = (b * c * cos_alpha) / (2 * a * a)
|
|
259
|
+
e = m - 1 / 4 + (1 - (b * cos_alpha) / c) / (4 * (1 - cos_alpha * cos_alpha))
|
|
260
|
+
n = 1 / 2 + (2 * e * c * cos_alpha) / b
|
|
261
|
+
f = 1 + e - 2 * m
|
|
262
|
+
p = n - 2 * d
|
|
263
|
+
return [
|
|
264
|
+
{"point": "N", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
265
|
+
{"point": "N1", "coordinates": [0.0, -1 / 2, 0.0]},
|
|
266
|
+
{"point": "F", "coordinates": [1 - f, 1 - f, 1 - p]},
|
|
267
|
+
{"point": "F1", "coordinates": [f, f - 1, p]},
|
|
268
|
+
{"point": "F2", "coordinates": [1 - f, -f, 1 - p]},
|
|
269
|
+
{"point": "H", "coordinates": [e, e, n]},
|
|
270
|
+
{"point": "H1", "coordinates": [1 - e, -e, 1 - n]},
|
|
271
|
+
{"point": "H2", "coordinates": [-e, -e, 1 - n]},
|
|
272
|
+
{"point": "I", "coordinates": [1 / 2, -1 / 2, 1 / 2]},
|
|
273
|
+
{"point": "M", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
274
|
+
{"point": "X", "coordinates": [1 / 2, -1 / 2, 0.0]},
|
|
275
|
+
{"point": "Y", "coordinates": [m, m, d]},
|
|
276
|
+
{"point": "Y1", "coordinates": [1 - m, -m, -d]},
|
|
277
|
+
{"point": "Y2", "coordinates": [-m, -m, -d]},
|
|
278
|
+
{"point": "Y3", "coordinates": [m, m - 1, d]},
|
|
279
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
280
|
+
]
|
|
281
|
+
# MCLC-5
|
|
282
|
+
# Note: The JS source has a bug where n and v are used before proper assignment.
|
|
283
|
+
# Here we use the correct order from the AFLOW paper (arXiv:1004.2974).
|
|
284
|
+
e = (1 / 4) * ((b * b) / (a * a) + (1 - (b * cos_alpha) / c) / (1 - cos_alpha * cos_alpha))
|
|
285
|
+
n = 1 / 2 + (2 * e * c * cos_alpha) / b
|
|
286
|
+
m = e / 2 + (b * b) / (a * a) / 4 - (b * c * cos_alpha) / (2 * a * a)
|
|
287
|
+
v = 1 + e - 2 * m
|
|
288
|
+
w = ((4 * v - 1 - (b * b * (1 - cos_alpha * cos_alpha)) / (a * a)) * c) / (2 * b * cos_alpha)
|
|
289
|
+
d = ((e * c) / b) * cos_alpha + w / 2 - 1 / 4
|
|
290
|
+
r = 1 - (e * a * a) / (b * b)
|
|
291
|
+
return [
|
|
292
|
+
{"point": "N", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
293
|
+
{"point": "N1", "coordinates": [0.0, -1 / 2, 0.0]},
|
|
294
|
+
{"point": "F", "coordinates": [v, v, w]},
|
|
295
|
+
{"point": "F1", "coordinates": [1 - v, 1 - v, 1 - w]},
|
|
296
|
+
{"point": "F2", "coordinates": [v, v - 1, w]},
|
|
297
|
+
{"point": "H", "coordinates": [e, e, n]},
|
|
298
|
+
{"point": "H1", "coordinates": [1 - e, -e, 1 - n]},
|
|
299
|
+
{"point": "H2", "coordinates": [-e, -e, 1 - n]},
|
|
300
|
+
{"point": "I", "coordinates": [r, 1 - r, 1 / 2]},
|
|
301
|
+
{"point": "I1", "coordinates": [1 - r, r - 1, 1 / 2]},
|
|
302
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
303
|
+
{"point": "M", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
304
|
+
{"point": "X", "coordinates": [1 / 2, -1 / 2, 0.0]},
|
|
305
|
+
{"point": "Y", "coordinates": [m, m, d]},
|
|
306
|
+
{"point": "Y1", "coordinates": [1 - m, -m, -d]},
|
|
307
|
+
{"point": "Y2", "coordinates": [-m, -m, -d]},
|
|
308
|
+
{"point": "Y3", "coordinates": [m, m - 1, d]},
|
|
309
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
310
|
+
]
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def _tri(alpha: float = 90.0, beta: float = 90.0, gamma: float = 90.0, **_: Any) -> List[dict]:
|
|
314
|
+
if alpha > 90 and beta > 90 and gamma >= 90:
|
|
315
|
+
# TRI-1a,2a
|
|
316
|
+
return [
|
|
317
|
+
{"point": "L", "coordinates": [1 / 2, 1 / 2, 0.0]},
|
|
318
|
+
{"point": "M", "coordinates": [0.0, 1 / 2, 1 / 2]},
|
|
319
|
+
{"point": "N", "coordinates": [1 / 2, 0.0, 1 / 2]},
|
|
320
|
+
{"point": "R", "coordinates": [1 / 2, 1 / 2, 1 / 2]},
|
|
321
|
+
{"point": "X", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
322
|
+
{"point": "Y", "coordinates": [0.0, 1 / 2, 0.0]},
|
|
323
|
+
{"point": "Z", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
324
|
+
]
|
|
325
|
+
# TRI-1b,2b
|
|
326
|
+
return [
|
|
327
|
+
{"point": "L", "coordinates": [1 / 2, -1 / 2, 0.0]},
|
|
328
|
+
{"point": "M", "coordinates": [0.0, 0.0, 1 / 2]},
|
|
329
|
+
{"point": "N", "coordinates": [-1 / 2, -1 / 2, 1 / 2]},
|
|
330
|
+
{"point": "R", "coordinates": [0.0, -1 / 2, 1 / 2]},
|
|
331
|
+
{"point": "X", "coordinates": [0.0, -1 / 2, 0.0]},
|
|
332
|
+
{"point": "Y", "coordinates": [1 / 2, 0.0, 0.0]},
|
|
333
|
+
{"point": "Z", "coordinates": [-1 / 2, 0.0, 1 / 2]},
|
|
334
|
+
]
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
POINTS: Dict[str, Callable[..., List[dict]]] = {
|
|
338
|
+
"CUB": _cub,
|
|
339
|
+
"FCC": _fcc,
|
|
340
|
+
"BCC": _bcc,
|
|
341
|
+
"TET": _tet,
|
|
342
|
+
"BCT": _bct,
|
|
343
|
+
"ORC": _orc,
|
|
344
|
+
"ORCF": _orcf,
|
|
345
|
+
"ORCI": _orci,
|
|
346
|
+
"ORCC": _orcc,
|
|
347
|
+
"HEX": _hex,
|
|
348
|
+
"RHL": _rhl,
|
|
349
|
+
"MCL": _mcl,
|
|
350
|
+
"MCLC": _mclc,
|
|
351
|
+
"TRI": _tri,
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def get_symmetry_points(lattice: Any) -> List[dict]:
|
|
356
|
+
"""Return a list of high-symmetry points for the given lattice.
|
|
357
|
+
|
|
358
|
+
The Gamma point is always included as the first entry.
|
|
359
|
+
|
|
360
|
+
Args:
|
|
361
|
+
lattice: An object with attributes a, b, c, alpha, beta, gamma, and type.
|
|
362
|
+
The type attribute should be a string or enum with a .value attribute
|
|
363
|
+
representing one of the 14 Bravais lattice types.
|
|
364
|
+
|
|
365
|
+
Returns:
|
|
366
|
+
List of dicts with 'point' (str) and 'coordinates' ([float, float, float]).
|
|
367
|
+
"""
|
|
368
|
+
lattice_type = lattice.type.value if hasattr(lattice.type, "value") else str(lattice.type)
|
|
369
|
+
|
|
370
|
+
gamma_point = [{"point": "Г", "coordinates": [0.0, 0.0, 0.0]}]
|
|
371
|
+
|
|
372
|
+
points_fn = POINTS.get(lattice_type)
|
|
373
|
+
if points_fn is None:
|
|
374
|
+
return gamma_point
|
|
375
|
+
|
|
376
|
+
type_points = points_fn(
|
|
377
|
+
a=lattice.a,
|
|
378
|
+
b=lattice.b,
|
|
379
|
+
c=lattice.c,
|
|
380
|
+
alpha=lattice.alpha,
|
|
381
|
+
beta=lattice.beta,
|
|
382
|
+
gamma=lattice.gamma,
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
return gamma_point + type_points
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from mat3ra.made.tools.analyze.fingerprint.layers.unique_element_string_per_layer import UniqueElementStringsPerLayer
|
|
2
1
|
from mat3ra.made.tools.analyze.fingerprint.layers.layered_fingerprint_along_axis import LayeredFingerprintAlongAxis
|
|
2
|
+
from mat3ra.made.tools.analyze.fingerprint.layers.unique_element_string_per_layer import UniqueElementStringsPerLayer
|
|
3
3
|
|
|
4
4
|
__all__ = ["UniqueElementStringsPerLayer", "LayeredFingerprintAlongAxis"]
|
package/src/py/mat3ra/made/tools/analyze/fingerprint/layers/layered_fingerprint_along_axis.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from itertools import cycle, islice
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
-
from mat3ra.utils.array import jaccard_similarity_for_strings
|
|
5
4
|
from mat3ra.esse.models.core.reusable.axis_enum import AxisEnum
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
5
|
from mat3ra.made.tools.analyze.fingerprint.layers.unique_element_string_per_layer import UniqueElementStringsPerLayer
|
|
6
|
+
from mat3ra.utils.array import jaccard_similarity_for_strings
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class LayeredFingerprintAlongAxis(BaseModel):
|
|
@@ -2,9 +2,9 @@ from .commensurate import CommensurateLatticeInterfaceAnalyzer, CommensurateLatt
|
|
|
2
2
|
from .grain_boundary import GrainBoundaryPlanarAnalyzer, GrainBoundaryPlanarMatchHolder
|
|
3
3
|
from .simple import InterfaceAnalyzer
|
|
4
4
|
from .twisted_nanoribbons import TwistedNanoribbonsInterfaceAnalyzer
|
|
5
|
+
from .utils import calculate_interfacial_distance_from_rdf
|
|
5
6
|
from .utils.holders import MatchedSubstrateFilmConfigurationHolder
|
|
6
7
|
from .zsl import ZSLInterfaceAnalyzer, ZSLMatchHolder
|
|
7
|
-
from .utils import calculate_interfacial_distance_from_rdf
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"InterfaceAnalyzer",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from functools import cached_property
|
|
2
|
+
|
|
3
|
+
from ....lattice import LatticeTypeEnum
|
|
3
4
|
from ...build_components.metadata import MaterialWithBuildMetadata
|
|
4
5
|
from ...convert import from_pymatgen, to_pymatgen
|
|
5
6
|
from ...third_party import PymatgenSpacegroupAnalyzer
|
|
6
|
-
from
|
|
7
|
+
from .. import BaseMaterialAnalyzer
|
|
8
|
+
from ..lattice_swap_analyzer import MaterialLatticeSwapAnalyzer
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
class LatticeMaterialAnalyzer(BaseMaterialAnalyzer):
|
|
@@ -68,7 +70,7 @@ class LatticeMaterialAnalyzer(BaseMaterialAnalyzer):
|
|
|
68
70
|
except Exception:
|
|
69
71
|
return LatticeTypeEnum.TRI
|
|
70
72
|
|
|
71
|
-
@
|
|
73
|
+
@cached_property
|
|
72
74
|
def material_with_primitive_lattice(self: MaterialWithBuildMetadata) -> MaterialWithBuildMetadata:
|
|
73
75
|
"""
|
|
74
76
|
Convert a structure to its primitive cell.
|
|
@@ -77,7 +79,7 @@ class LatticeMaterialAnalyzer(BaseMaterialAnalyzer):
|
|
|
77
79
|
from_pymatgen(self.spacegroup_analyzer.get_primitive_standard_structure())
|
|
78
80
|
)
|
|
79
81
|
|
|
80
|
-
@
|
|
82
|
+
@cached_property
|
|
81
83
|
def material_with_conventional_lattice(self: MaterialWithBuildMetadata) -> MaterialWithBuildMetadata:
|
|
82
84
|
"""
|
|
83
85
|
Convert a structure to its conventional cell.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from functools import cached_property
|
|
1
2
|
from typing import List, Tuple, Union
|
|
2
3
|
|
|
3
4
|
from mat3ra.code.vector import Vector3D
|
|
@@ -45,7 +46,7 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
45
46
|
primitive=make_primitive,
|
|
46
47
|
)
|
|
47
48
|
|
|
48
|
-
@
|
|
49
|
+
@cached_property
|
|
49
50
|
def pymatgen_slab_generator_with_vacuum(self) -> PymatgenSlabGenerator:
|
|
50
51
|
# This generator is used to create slabs with vacuum and thick enough to allow for all terminations to be found.
|
|
51
52
|
return self.get_pymatgen_slab_generator(
|
|
@@ -53,14 +54,14 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
53
54
|
min_vacuum_size=self.DEFAULT_VACUUM_SIZE_FOR_TERMINATIONS,
|
|
54
55
|
)
|
|
55
56
|
|
|
56
|
-
@
|
|
57
|
+
@cached_property
|
|
57
58
|
def pymatgen_slab_generator_without_vacuum(self) -> PymatgenSlabGenerator:
|
|
58
59
|
# This generator is used to create slabs without vacuum and with a single layer thickness.
|
|
59
60
|
return self.get_pymatgen_slab_generator(
|
|
60
61
|
min_slab_size=self.DEFAULT_THICKNESS_FOR_GENERATION, min_vacuum_size=self.DEFAULT_VACUUM_SIZE_FOR_GENERATION
|
|
61
62
|
)
|
|
62
63
|
|
|
63
|
-
@
|
|
64
|
+
@cached_property
|
|
64
65
|
def all_planes_as_pymatgen_slabs_with_vacuum(self) -> List[PymatgenSlab]:
|
|
65
66
|
return [
|
|
66
67
|
*self.pymatgen_slab_generator_with_vacuum.get_slabs(symmetrize=True),
|
|
@@ -69,7 +70,7 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
69
70
|
# *self.pymatgen_slab_generator_with_vacuum.get_slabs(symmetrize=False),
|
|
70
71
|
]
|
|
71
72
|
|
|
72
|
-
@
|
|
73
|
+
@cached_property
|
|
73
74
|
def all_planes_as_pymatgen_slabs_without_vacuum(self) -> List[PymatgenSlab]:
|
|
74
75
|
return [
|
|
75
76
|
*self.pymatgen_slab_generator_without_vacuum.get_slabs(symmetrize=self.DEFAULT_SYMMETRIZE),
|
|
@@ -85,7 +86,7 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
85
86
|
and returns empty slab lists (e.g., some nanoribbons, thin 2D materials).
|
|
86
87
|
|
|
87
88
|
Returns:
|
|
88
|
-
|
|
89
|
+
TerminationHolder: A basic termination using the material's chemical formula
|
|
89
90
|
"""
|
|
90
91
|
formula = self.formula
|
|
91
92
|
fallback_termination = Termination(chemical_elements=formula, space_group_symmetry_label="")
|
|
@@ -97,7 +98,7 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
97
98
|
shift_without_vacuum=0.0,
|
|
98
99
|
)
|
|
99
100
|
|
|
100
|
-
@
|
|
101
|
+
@cached_property
|
|
101
102
|
def termination_holders(self):
|
|
102
103
|
termination_holders = []
|
|
103
104
|
slabs_with_vacuum = self.all_planes_as_pymatgen_slabs_with_vacuum
|
|
@@ -136,15 +137,15 @@ class CrystalLatticePlanesMaterialAnalyzer(LatticeMaterialAnalyzer):
|
|
|
136
137
|
|
|
137
138
|
return termination_holders
|
|
138
139
|
|
|
139
|
-
@
|
|
140
|
+
@cached_property
|
|
140
141
|
def terminations_with_vacuum(self) -> List[Termination]:
|
|
141
142
|
return [holder.termination_with_vacuum for holder in self.termination_holders]
|
|
142
143
|
|
|
143
|
-
@
|
|
144
|
+
@cached_property
|
|
144
145
|
def terminations_without_vacuum(self) -> List[Termination]:
|
|
145
146
|
return [holder.termination_without_vacuum for holder in self.termination_holders]
|
|
146
147
|
|
|
147
|
-
@
|
|
148
|
+
@cached_property
|
|
148
149
|
def terminations(self):
|
|
149
150
|
return self.terminations_with_vacuum
|
|
150
151
|
|
|
@@ -2,13 +2,13 @@ from typing import Union
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
from mat3ra.esse.models.core.abstract.matrix_3x3 import Matrix3x3Schema
|
|
5
|
+
from mat3ra.made.material import Material
|
|
5
6
|
from pydantic import BaseModel, Field
|
|
6
7
|
|
|
7
|
-
from mat3ra.made.material import Material
|
|
8
|
-
from .basis import BasisMaterialAnalyzer
|
|
9
|
-
from .enums import POSSIBLE_TRANSFORMATION_MATRICES
|
|
10
8
|
from ..build_components.metadata.material_with_build_metadata import MaterialWithBuildMetadata
|
|
11
9
|
from ..operations.reusable.unary import transform_material_by_matrix
|
|
10
|
+
from .basis import BasisMaterialAnalyzer
|
|
11
|
+
from .enums import POSSIBLE_TRANSFORMATION_MATRICES
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class LatticeSwapDetectionResult(BaseModel):
|
|
@@ -29,9 +29,7 @@ def validate_heterostructure_inputs(stack_component_dicts: List[StackComponentDi
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def create_initial_slabs(
|
|
32
|
-
stack_component_dicts: List[StackComponentDict],
|
|
33
|
-
vacuum: float,
|
|
34
|
-
use_conventional_cell: bool
|
|
32
|
+
stack_component_dicts: List[StackComponentDict], vacuum: float, use_conventional_cell: bool
|
|
35
33
|
) -> List[MaterialWithBuildMetadata]:
|
|
36
34
|
"""Create initial slabs from stack components."""
|
|
37
35
|
slabs = []
|
|
@@ -49,8 +47,7 @@ def create_initial_slabs(
|
|
|
49
47
|
|
|
50
48
|
|
|
51
49
|
def find_common_supercell_matrix(
|
|
52
|
-
slabs: List[MaterialWithBuildMetadata],
|
|
53
|
-
optimize_layer_supercells: bool
|
|
50
|
+
slabs: List[MaterialWithBuildMetadata], optimize_layer_supercells: bool
|
|
54
51
|
) -> SupercellMatrix2DSchema:
|
|
55
52
|
"""Find common supercell matrix for all materials."""
|
|
56
53
|
reference_substrate = slabs[0]
|
|
@@ -68,13 +65,14 @@ def find_common_supercell_matrix(
|
|
|
68
65
|
film_build_parameters=film_analyzer.build_parameters,
|
|
69
66
|
optimize_film_supercell=optimize_layer_supercells,
|
|
70
67
|
)
|
|
68
|
+
analyzer.__dict__["substrate_material"] = reference_substrate
|
|
69
|
+
analyzer.__dict__["film_material"] = film_slab
|
|
71
70
|
|
|
72
71
|
return analyzer.film_strained_configuration.xy_supercell_matrix
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
def create_strained_substrate(
|
|
76
|
-
reference_substrate: MaterialWithBuildMetadata,
|
|
77
|
-
common_supercell_matrix: SupercellMatrix2DSchema
|
|
75
|
+
reference_substrate: MaterialWithBuildMetadata, common_supercell_matrix: SupercellMatrix2DSchema
|
|
78
76
|
) -> MaterialWithBuildMetadata:
|
|
79
77
|
"""Create strained substrate with common supercell."""
|
|
80
78
|
substrate_analyzer = SlabMaterialAnalyzer(material=reference_substrate)
|
|
@@ -92,7 +90,7 @@ def create_strained_substrate(
|
|
|
92
90
|
def create_strained_films(
|
|
93
91
|
slabs: List[MaterialWithBuildMetadata],
|
|
94
92
|
common_supercell_matrix: SupercellMatrix2DSchema,
|
|
95
|
-
optimize_layer_supercells: bool
|
|
93
|
+
optimize_layer_supercells: bool,
|
|
96
94
|
) -> List[MaterialWithBuildMetadata]:
|
|
97
95
|
"""Create strained films with common supercell."""
|
|
98
96
|
reference_substrate = slabs[0]
|
|
@@ -112,10 +110,12 @@ def create_strained_films(
|
|
|
112
110
|
film_build_parameters=film_analyzer.build_parameters,
|
|
113
111
|
optimize_film_supercell=optimize_layer_supercells,
|
|
114
112
|
)
|
|
113
|
+
analyzer.__dict__["substrate_material"] = reference_substrate
|
|
114
|
+
analyzer.__dict__["film_material"] = film_slab
|
|
115
115
|
|
|
116
116
|
film_config = analyzer.film_strained_configuration
|
|
117
117
|
film_config_dict = film_config.model_dump()
|
|
118
|
-
film_config_dict[
|
|
118
|
+
film_config_dict["xy_supercell_matrix"] = common_supercell_matrix
|
|
119
119
|
film_config_common = SlabStrainedSupercellConfiguration(**film_config_dict)
|
|
120
120
|
|
|
121
121
|
strained_film = builder.get_material(film_config_common)
|
|
@@ -125,8 +125,7 @@ def create_strained_films(
|
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
def apply_gaps_and_stack(
|
|
128
|
-
strained_slabs: List[MaterialWithBuildMetadata],
|
|
129
|
-
gaps: List[float]
|
|
128
|
+
strained_slabs: List[MaterialWithBuildMetadata], gaps: List[float]
|
|
130
129
|
) -> MaterialWithBuildMetadata:
|
|
131
130
|
"""Apply gaps and stack materials."""
|
|
132
131
|
stacked_materials = []
|