Skip to content

Commit 1822df4

Browse files
committed
update: rename flag
1 parent d48dfff commit 1822df4

File tree

1 file changed

+94
-94
lines changed

1 file changed

+94
-94
lines changed

other/materials_designer/passivate_slab.ipynb

Lines changed: 94 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,7 @@
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-
"CREATE_SLAB = False # Create a slab if the input material is not a slab\n",
66+
"BYPASS_SLAB_CREATION = False # If True, will use input material directly\n",
6267
"\n",
6368
"# Slab parameters for creating a new slab if previous option is set to True\n",
6469
"DEFAULT_SLAB_PARAMETERS = {\n",
@@ -72,26 +77,26 @@
7277
"# Visualization parameters\n",
7378
"SHOW_INTERMEDIATE_STEPS = True\n",
7479
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
75-
],
76-
"metadata": {
77-
"collapsed": false
78-
},
79-
"id": "92b3518bebdcf547",
80-
"execution_count": null
80+
]
8181
},
8282
{
8383
"cell_type": "markdown",
84-
"source": [
85-
"### 1.2. Install packages\n",
86-
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
87-
],
84+
"id": "11bd9b5fca1510fc",
8885
"metadata": {
8986
"collapsed": false
9087
},
91-
"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+
]
9292
},
9393
{
9494
"cell_type": "code",
95+
"execution_count": 6,
96+
"id": "42863fe84bfab53c",
97+
"metadata": {
98+
"collapsed": false
99+
},
95100
"outputs": [],
96101
"source": [
97102
"import sys\n",
@@ -103,50 +108,50 @@
103108
" from utils.jupyterlite import install_packages\n",
104109
"\n",
105110
" await install_packages(\"\")"
106-
],
107-
"metadata": {
108-
"collapsed": false
109-
},
110-
"id": "42863fe84bfab53c",
111-
"execution_count": null
111+
]
112112
},
113113
{
114114
"cell_type": "markdown",
115-
"source": [
116-
"### 1.3. Load and preview input material"
117-
],
115+
"id": "6983ab284dff18c0",
118116
"metadata": {
119117
"collapsed": false
120118
},
121-
"id": "6983ab284dff18c0"
119+
"source": [
120+
"### 1.3. Load and preview input material"
121+
]
122122
},
123123
{
124124
"cell_type": "code",
125+
"execution_count": null,
126+
"id": "a51551f4af6456c7",
127+
"metadata": {
128+
"collapsed": false
129+
},
125130
"outputs": [],
126131
"source": [
127132
"from utils.jupyterlite import get_materials\n",
128133
"from utils.visualize import visualize_materials\n",
129134
"\n",
130135
"materials = get_materials(globals())"
131-
],
132-
"metadata": {
133-
"collapsed": false
134-
},
135-
"id": "a51551f4af6456c7",
136-
"execution_count": null
136+
]
137137
},
138138
{
139139
"cell_type": "markdown",
140-
"source": [
141-
"### 1.4. Create a slab if the input material is not a slab"
142-
],
140+
"id": "6b929ffec7c4876e",
143141
"metadata": {
144142
"collapsed": false
145143
},
146-
"id": "6b929ffec7c4876e"
144+
"source": [
145+
"### 1.4. Create a slab if the input material is not a slab"
146+
]
147147
},
148148
{
149149
"cell_type": "code",
150+
"execution_count": null,
151+
"id": "ad71f877f76f0550",
152+
"metadata": {
153+
"collapsed": false
154+
},
150155
"outputs": [],
151156
"source": [
152157
"from mat3ra.made.tools.build.slab import create_slab_if_not, SlabConfiguration\n",
@@ -161,32 +166,32 @@
161166
" xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n",
162167
")\n",
163168
"\n",
164-
"slab = create_slab_if_not(material, default_slab_config) if CREATE_SLAB else material\n",
169+
"slab = material if BYPASS_SLAB_CREATION else create_slab_if_not(material, default_slab_config)\n",
165170
"\n",
166171
"if SHOW_INTERMEDIATE_STEPS:\n",
167172
" print(\"Initial slab structure:\")\n",
168173
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
169174
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
170-
],
171-
"metadata": {
172-
"collapsed": false
173-
},
174-
"id": "ad71f877f76f0550",
175-
"execution_count": null
175+
]
176176
},
177177
{
178178
"cell_type": "markdown",
179-
"source": [
180-
"## 2. Create target material\n",
181-
"### 2.1. Set up passivation configuration and builder\n"
182-
],
179+
"id": "cee250785246811a",
183180
"metadata": {
184181
"collapsed": false
185182
},
186-
"id": "cee250785246811a"
183+
"source": [
184+
"## 2. Create target material\n",
185+
"### 2.1. Set up passivation configuration and builder\n"
186+
]
187187
},
188188
{
189189
"cell_type": "code",
190+
"execution_count": 9,
191+
"id": "7e26e8e7fb8319a",
192+
"metadata": {
193+
"collapsed": false
194+
},
190195
"outputs": [],
191196
"source": [
192197
"from mat3ra.made.tools.build.passivation import (\n",
@@ -208,25 +213,25 @@
208213
")\n",
209214
"\n",
210215
"builder = SurfacePassivationBuilder(build_parameters=builder_params)"
211-
],
212-
"metadata": {
213-
"collapsed": false
214-
},
215-
"id": "7e26e8e7fb8319a",
216-
"execution_count": null
216+
]
217217
},
218218
{
219219
"cell_type": "markdown",
220-
"source": [
221-
"### 2.2. Generate passivated structure\n"
222-
],
220+
"id": "2950f29de8bc79b2",
223221
"metadata": {
224222
"collapsed": false
225223
},
226-
"id": "2950f29de8bc79b2"
224+
"source": [
225+
"### 2.2. Generate passivated structure\n"
226+
]
227227
},
228228
{
229229
"cell_type": "code",
230+
"execution_count": null,
231+
"id": "a4ed473eb2129ac4",
232+
"metadata": {
233+
"collapsed": false
234+
},
230235
"outputs": [],
231236
"source": [
232237
"from mat3ra.made.tools.build.passivation import create_passivation\n",
@@ -238,79 +243,74 @@
238243
"print(f\"Bond length: {BOND_LENGTH} Å\")\n",
239244
"print(f\"Surfaces passivated: {SURFACE}\")\n",
240245
"print(f\"Number of atoms: {len(passivated_slab.basis.elements.ids)}\")"
241-
],
242-
"metadata": {
243-
"collapsed": false
244-
},
245-
"id": "a4ed473eb2129ac4",
246-
"execution_count": null
246+
]
247247
},
248248
{
249249
"cell_type": "markdown",
250-
"source": [
251-
"## 3. Visualize the result"
252-
],
250+
"id": "56ec05c6ed2f91cd",
253251
"metadata": {
254252
"collapsed": false
255253
},
256-
"id": "56ec05c6ed2f91cd"
254+
"source": [
255+
"## 3. Visualize the result"
256+
]
257257
},
258258
{
259259
"cell_type": "code",
260+
"execution_count": null,
261+
"id": "c4b5e1e0ec0ab02a",
262+
"metadata": {
263+
"collapsed": false
264+
},
260265
"outputs": [],
261266
"source": [
262267
"print(\"Final passivated structure:\")\n",
263268
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
264269
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
265-
],
266-
"metadata": {
267-
"collapsed": false
268-
},
269-
"id": "c4b5e1e0ec0ab02a",
270-
"execution_count": null
270+
]
271271
},
272272
{
273273
"cell_type": "markdown",
274-
"source": [
275-
"### 4. Pass data to the outside runtime\n"
276-
],
274+
"id": "eab7e14d2c7880a5",
277275
"metadata": {
278276
"collapsed": false
279277
},
280-
"id": "eab7e14d2c7880a5"
278+
"source": [
279+
"### 4. Pass data to the outside runtime\n"
280+
]
281281
},
282282
{
283283
"cell_type": "code",
284+
"execution_count": null,
285+
"id": "d66a15a29d27c6ea",
286+
"metadata": {
287+
"collapsed": false
288+
},
284289
"outputs": [],
285290
"source": [
286291
"from utils.jupyterlite import set_materials\n",
287292
"\n",
288293
"set_materials(passivated_slab)"
289-
],
290-
"metadata": {
291-
"collapsed": false
292-
},
293-
"id": "d66a15a29d27c6ea",
294-
"execution_count": null
294+
]
295295
}
296296
],
297297
"metadata": {
298298
"kernelspec": {
299-
"display_name": "Python 3",
299+
"display_name": ".venv-3.11",
300300
"language": "python",
301301
"name": "python3"
302302
},
303303
"language_info": {
304304
"codemirror_mode": {
305305
"name": "ipython",
306-
"version": 2
306+
"version": 3
307307
},
308308
"file_extension": ".py",
309309
"mimetype": "text/x-python",
310310
"name": "python",
311311
"nbconvert_exporter": "python",
312-
"pygments_lexer": "ipython2",
313-
"version": "2.7.6"
312+
"pygments_lexer": "ipython3",
313+
"version": "3.11.7"
314314
}
315315
},
316316
"nbformat": 4,

0 commit comments

Comments
 (0)