Skip to content

Commit b028d18

Browse files
authored
Merge pull request #193 from Exabyte-io/feature/SOF-7527
feature/SOF-7527 Passivation Si(100) tutorial
2 parents d2df8d4 + 1822df4 commit b028d18

File tree

2 files changed

+455
-94
lines changed

2 files changed

+455
-94
lines changed

other/materials_designer/passivate_slab.ipynb

Lines changed: 96 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"id": "7d00c63281a63fa0",
6+
"metadata": {
7+
"collapsed": false
8+
},
59
"source": [
610
"# Passivate Slab Surface\n",
711
"\n",
@@ -20,14 +24,14 @@
2024
"1. Surface atoms are detected by analyzing atomic positions along z-axis\n",
2125
"1. \"Shadowing radius\" controls the exclusion of atoms below the surface ones from being passivated\n",
2226
"1. Passivants are added at specified bond lengths from surface atoms"
23-
],
24-
"metadata": {
25-
"collapsed": false
26-
},
27-
"id": "7d00c63281a63fa0"
27+
]
2828
},
2929
{
3030
"cell_type": "markdown",
31+
"id": "d80280b47f767281",
32+
"metadata": {
33+
"collapsed": false
34+
},
3135
"source": [
3236
"## 1. Prepare the Environment\n",
3337
"### 1.1. Set up the notebook\n",
@@ -36,14 +40,15 @@
3640
"Visualization of the parameters of passivation on the image below:\n",
3741
"\n",
3842
"<img src=\"https://i.imgur.com/sVd7BWn.png\" alt=\"Passivation parameters\" width=\"600\"/>\n"
39-
],
40-
"metadata": {
41-
"collapsed": false
42-
},
43-
"id": "d80280b47f767281"
43+
]
4444
},
4545
{
4646
"cell_type": "code",
47+
"execution_count": 5,
48+
"id": "92b3518bebdcf547",
49+
"metadata": {
50+
"collapsed": false
51+
},
4752
"outputs": [],
4853
"source": [
4954
"# Material selection\n",
@@ -58,7 +63,9 @@
5863
"SHADOWING_RADIUS = 2.5 # Radius to exclude subsurface atoms, in Angstroms\n",
5964
"DEPTH = 5.0 # How deep to look for surface atoms, in Angstroms\n",
6065
"\n",
61-
"# Slab parameters for creating a new slab if provided material is not a slab\n",
66+
"BYPASS_SLAB_CREATION = False # If True, will use input material directly\n",
67+
"\n",
68+
"# Slab parameters for creating a new slab if previous option is set to True\n",
6269
"DEFAULT_SLAB_PARAMETERS = {\n",
6370
" \"miller_indices\": (0, 0, 1),\n",
6471
" \"thickness\": 3,\n",
@@ -70,26 +77,26 @@
7077
"# Visualization parameters\n",
7178
"SHOW_INTERMEDIATE_STEPS = True\n",
7279
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
73-
],
74-
"metadata": {
75-
"collapsed": false
76-
},
77-
"id": "92b3518bebdcf547",
78-
"execution_count": null
80+
]
7981
},
8082
{
8183
"cell_type": "markdown",
82-
"source": [
83-
"### 1.2. Install packages\n",
84-
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
85-
],
84+
"id": "11bd9b5fca1510fc",
8685
"metadata": {
8786
"collapsed": false
8887
},
89-
"id": "11bd9b5fca1510fc"
88+
"source": [
89+
"### 1.2. Install packages\n",
90+
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
91+
]
9092
},
9193
{
9294
"cell_type": "code",
95+
"execution_count": 6,
96+
"id": "42863fe84bfab53c",
97+
"metadata": {
98+
"collapsed": false
99+
},
93100
"outputs": [],
94101
"source": [
95102
"import sys\n",
@@ -101,50 +108,50 @@
101108
" from utils.jupyterlite import install_packages\n",
102109
"\n",
103110
" await install_packages(\"\")"
104-
],
105-
"metadata": {
106-
"collapsed": false
107-
},
108-
"id": "42863fe84bfab53c",
109-
"execution_count": null
111+
]
110112
},
111113
{
112114
"cell_type": "markdown",
113-
"source": [
114-
"### 1.3. Load and preview input material"
115-
],
115+
"id": "6983ab284dff18c0",
116116
"metadata": {
117117
"collapsed": false
118118
},
119-
"id": "6983ab284dff18c0"
119+
"source": [
120+
"### 1.3. Load and preview input material"
121+
]
120122
},
121123
{
122124
"cell_type": "code",
125+
"execution_count": null,
126+
"id": "a51551f4af6456c7",
127+
"metadata": {
128+
"collapsed": false
129+
},
123130
"outputs": [],
124131
"source": [
125132
"from utils.jupyterlite import get_materials\n",
126133
"from utils.visualize import visualize_materials\n",
127134
"\n",
128135
"materials = get_materials(globals())"
129-
],
130-
"metadata": {
131-
"collapsed": false
132-
},
133-
"id": "a51551f4af6456c7",
134-
"execution_count": null
136+
]
135137
},
136138
{
137139
"cell_type": "markdown",
138-
"source": [
139-
"### 1.4. Create a slab if the input material is not a slab"
140-
],
140+
"id": "6b929ffec7c4876e",
141141
"metadata": {
142142
"collapsed": false
143143
},
144-
"id": "6b929ffec7c4876e"
144+
"source": [
145+
"### 1.4. Create a slab if the input material is not a slab"
146+
]
145147
},
146148
{
147149
"cell_type": "code",
150+
"execution_count": null,
151+
"id": "ad71f877f76f0550",
152+
"metadata": {
153+
"collapsed": false
154+
},
148155
"outputs": [],
149156
"source": [
150157
"from mat3ra.made.tools.build.slab import create_slab_if_not, SlabConfiguration\n",
@@ -159,32 +166,32 @@
159166
" xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n",
160167
")\n",
161168
"\n",
162-
"slab = create_slab_if_not(material, default_slab_config)\n",
169+
"slab = material if BYPASS_SLAB_CREATION else create_slab_if_not(material, default_slab_config)\n",
163170
"\n",
164171
"if SHOW_INTERMEDIATE_STEPS:\n",
165172
" print(\"Initial slab structure:\")\n",
166173
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
167174
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
168-
],
169-
"metadata": {
170-
"collapsed": false
171-
},
172-
"id": "ad71f877f76f0550",
173-
"execution_count": null
175+
]
174176
},
175177
{
176178
"cell_type": "markdown",
177-
"source": [
178-
"## 2. Create target material\n",
179-
"### 2.1. Set up passivation configuration and builder\n"
180-
],
179+
"id": "cee250785246811a",
181180
"metadata": {
182181
"collapsed": false
183182
},
184-
"id": "cee250785246811a"
183+
"source": [
184+
"## 2. Create target material\n",
185+
"### 2.1. Set up passivation configuration and builder\n"
186+
]
185187
},
186188
{
187189
"cell_type": "code",
190+
"execution_count": 9,
191+
"id": "7e26e8e7fb8319a",
192+
"metadata": {
193+
"collapsed": false
194+
},
188195
"outputs": [],
189196
"source": [
190197
"from mat3ra.made.tools.build.passivation import (\n",
@@ -206,25 +213,25 @@
206213
")\n",
207214
"\n",
208215
"builder = SurfacePassivationBuilder(build_parameters=builder_params)"
209-
],
210-
"metadata": {
211-
"collapsed": false
212-
},
213-
"id": "7e26e8e7fb8319a",
214-
"execution_count": null
216+
]
215217
},
216218
{
217219
"cell_type": "markdown",
218-
"source": [
219-
"### 2.2. Generate passivated structure\n"
220-
],
220+
"id": "2950f29de8bc79b2",
221221
"metadata": {
222222
"collapsed": false
223223
},
224-
"id": "2950f29de8bc79b2"
224+
"source": [
225+
"### 2.2. Generate passivated structure\n"
226+
]
225227
},
226228
{
227229
"cell_type": "code",
230+
"execution_count": null,
231+
"id": "a4ed473eb2129ac4",
232+
"metadata": {
233+
"collapsed": false
234+
},
228235
"outputs": [],
229236
"source": [
230237
"from mat3ra.made.tools.build.passivation import create_passivation\n",
@@ -236,79 +243,74 @@
236243
"print(f\"Bond length: {BOND_LENGTH} Å\")\n",
237244
"print(f\"Surfaces passivated: {SURFACE}\")\n",
238245
"print(f\"Number of atoms: {len(passivated_slab.basis.elements.ids)}\")"
239-
],
240-
"metadata": {
241-
"collapsed": false
242-
},
243-
"id": "a4ed473eb2129ac4",
244-
"execution_count": null
246+
]
245247
},
246248
{
247249
"cell_type": "markdown",
248-
"source": [
249-
"## 3. Visualize the result"
250-
],
250+
"id": "56ec05c6ed2f91cd",
251251
"metadata": {
252252
"collapsed": false
253253
},
254-
"id": "56ec05c6ed2f91cd"
254+
"source": [
255+
"## 3. Visualize the result"
256+
]
255257
},
256258
{
257259
"cell_type": "code",
260+
"execution_count": null,
261+
"id": "c4b5e1e0ec0ab02a",
262+
"metadata": {
263+
"collapsed": false
264+
},
258265
"outputs": [],
259266
"source": [
260267
"print(\"Final passivated structure:\")\n",
261268
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
262269
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
263-
],
264-
"metadata": {
265-
"collapsed": false
266-
},
267-
"id": "c4b5e1e0ec0ab02a",
268-
"execution_count": null
270+
]
269271
},
270272
{
271273
"cell_type": "markdown",
272-
"source": [
273-
"### 4. Pass data to the outside runtime\n"
274-
],
274+
"id": "eab7e14d2c7880a5",
275275
"metadata": {
276276
"collapsed": false
277277
},
278-
"id": "eab7e14d2c7880a5"
278+
"source": [
279+
"### 4. Pass data to the outside runtime\n"
280+
]
279281
},
280282
{
281283
"cell_type": "code",
284+
"execution_count": null,
285+
"id": "d66a15a29d27c6ea",
286+
"metadata": {
287+
"collapsed": false
288+
},
282289
"outputs": [],
283290
"source": [
284291
"from utils.jupyterlite import set_materials\n",
285292
"\n",
286293
"set_materials(passivated_slab)"
287-
],
288-
"metadata": {
289-
"collapsed": false
290-
},
291-
"id": "d66a15a29d27c6ea",
292-
"execution_count": null
294+
]
293295
}
294296
],
295297
"metadata": {
296298
"kernelspec": {
297-
"display_name": "Python 3",
299+
"display_name": ".venv-3.11",
298300
"language": "python",
299301
"name": "python3"
300302
},
301303
"language_info": {
302304
"codemirror_mode": {
303305
"name": "ipython",
304-
"version": 2
306+
"version": 3
305307
},
306308
"file_extension": ".py",
307309
"mimetype": "text/x-python",
308310
"name": "python",
309311
"nbconvert_exporter": "python",
310-
"pygments_lexer": "ipython2",
311-
"version": "2.7.6"
312+
"pygments_lexer": "ipython3",
313+
"version": "3.11.7"
312314
}
313315
},
314316
"nbformat": 4,

0 commit comments

Comments
 (0)