Skip to content

Commit 315238a

Browse files
committed
Merge branch 'dev' into update/SOF-7544
2 parents 99bfb86 + 11ed434 commit 315238a

File tree

2 files changed

+126
-90
lines changed

2 files changed

+126
-90
lines changed

other/materials_designer/passivate_edge.ipynb

Lines changed: 92 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"source": [],
5+
"id": "759c70b8d39addc3",
66
"metadata": {
77
"collapsed": false
88
},
9-
"id": "759c70b8d39addc3"
9+
"source": []
1010
},
1111
{
1212
"cell_type": "markdown",
13+
"id": "4f5cab1ebbbe954",
14+
"metadata": {
15+
"collapsed": false
16+
},
1317
"source": [
1418
"# Create Edge Passivation\n",
1519
"Passivate material edges by detecting and adding passivants to undercoordinated atoms (atoms with fewer neighbors than bulk).\n",
@@ -27,11 +31,7 @@
2731
"1. Coordination-based passivation finds atoms with fewer neighbors than expected\n",
2832
"2. Coordination threshold below which passivation is applied, must be set depending on the material\n",
2933
"3. Passivant atoms are placed along the direction away from existing bonds\n"
30-
],
31-
"metadata": {
32-
"collapsed": false
33-
},
34-
"id": "4f5cab1ebbbe954"
34+
]
3535
},
3636
{
3737
"metadata": {},
@@ -44,11 +44,13 @@
4444
"\n",
4545
"<img src=\"https://github.com/Exabyte-io/documentation/raw/88451ce38b0f57f804dcb5010a1a95bb9b9e50bc/images/notebooks/coordination_based_passivation_settings.webp\" alt=\"Coordination search radius\" width=\"400\"/>"
4646
],
47-
"id": "b25b42e8d3da9789"
47+
"id": "f63b28f159207878"
4848
},
4949
{
5050
"metadata": {},
5151
"cell_type": "code",
52+
"outputs": [],
53+
"execution_count": null,
5254
"source": [
5355
"# Enable interactive selection of coordination threshold\n",
5456
"IS_COORDINATION_SELECTION_INTERACTIVE = False\n",
@@ -71,23 +73,25 @@
7173
"SHOW_INTERMEDIATE_STEPS = True\n",
7274
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
7375
],
74-
"id": "3b94d4e8623dd44f",
75-
"outputs": [],
76-
"execution_count": null
76+
"id": "7e8d8696bb1035e5"
7777
},
7878
{
7979
"cell_type": "markdown",
80-
"source": [
81-
"### 1.2. Install packages\n",
82-
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`.\n"
83-
],
80+
"id": "975da798561ccde8",
8481
"metadata": {
8582
"collapsed": false
8683
},
87-
"id": "975da798561ccde8"
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`.\n"
87+
]
8888
},
8989
{
9090
"cell_type": "code",
91+
"id": "4b010bef5b031158",
92+
"metadata": {
93+
"collapsed": false
94+
},
9195
"source": [
9296
"import sys\n",
9397
"\n",
@@ -99,25 +103,25 @@
99103
"\n",
100104
" await install_packages(\"\")"
101105
],
102-
"metadata": {
103-
"collapsed": false
104-
},
105-
"id": "4b010bef5b031158",
106106
"outputs": [],
107107
"execution_count": null
108108
},
109109
{
110110
"cell_type": "markdown",
111-
"source": [
112-
"### 1.3. Load and preview input material\n"
113-
],
111+
"id": "7df321ca07e11daa",
114112
"metadata": {
115113
"collapsed": false
116114
},
117-
"id": "7df321ca07e11daa"
115+
"source": [
116+
"### 1.3. Load and preview input material\n"
117+
]
118118
},
119119
{
120120
"cell_type": "code",
121+
"id": "3a53ff74253cb09a",
122+
"metadata": {
123+
"collapsed": false
124+
},
121125
"source": [
122126
"from utils.jupyterlite import get_materials\n",
123127
"from utils.visualize import visualize_materials\n",
@@ -130,91 +134,101 @@
130134
" visualize_materials(nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
131135
" visualize_materials(nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
132136
],
133-
"metadata": {
134-
"collapsed": false
135-
},
136-
"id": "3a53ff74253cb09a",
137137
"outputs": [],
138138
"execution_count": null
139139
},
140140
{
141141
"cell_type": "markdown",
142-
"source": [
143-
"## 2. Analyze Coordination Numbers and Select Threshold\n",
144-
"### 2.1. Plot RDF to estimate coordination search radius"
145-
],
142+
"id": "b5940fc50c11c7b8",
146143
"metadata": {
147144
"collapsed": false
148145
},
149-
"id": "b5940fc50c11c7b8"
146+
"source": [
147+
"## 2. Analyze Coordination Numbers and Select Threshold\n",
148+
"### 2.1. Plot RDF to estimate coordination search radius"
149+
]
150150
},
151151
{
152152
"cell_type": "code",
153+
"id": "575e8fba623c06e4",
154+
"metadata": {
155+
"collapsed": false
156+
},
153157
"source": [
154158
"from utils.plot import plot_rdf\n",
155159
"\n",
156160
"plot_rdf(nanoribbon, cutoff=10.0)"
157161
],
158-
"metadata": {
159-
"collapsed": false
160-
},
161-
"id": "575e8fba623c06e4",
162162
"outputs": [],
163163
"execution_count": null
164164
},
165165
{
166166
"cell_type": "markdown",
167-
"source": [
168-
"### 2.2. GEt coordination numbers and set coordination threshold"
169-
],
167+
"id": "b89dc754926f1ce4",
170168
"metadata": {
171169
"collapsed": false
172170
},
173-
"id": "b89dc754926f1ce4"
171+
"source": [
172+
"### 2.2. Get coordination numbers and set coordination threshold"
173+
]
174174
},
175175
{
176176
"cell_type": "code",
177+
"id": "54c265d8ca9408af",
178+
"metadata": {
179+
"collapsed": false
180+
},
177181
"source": [
178182
"from utils.io import select_coordination_threshold\n",
179-
"from mat3ra.made.tools.build.passivation import get_unique_coordination_numbers, PassivationConfiguration\n",
183+
"from mat3ra.made.tools.build.passivation import get_unique_coordination_numbers, PassivationConfiguration, \\\n",
184+
" get_coordination_numbers_distribution\n",
180185
"\n",
186+
"coordination_search_radius = None # Change this value according to the RDF plot if needed, Angstroms.\n",
181187
"config = PassivationConfiguration(\n",
182188
" slab=nanoribbon,\n",
183189
" passivant=PASSIVANT,\n",
184190
" bond_length=BOND_LENGTH\n",
185191
")\n",
186-
"coordination_numbers = get_unique_coordination_numbers(config, cutoff=COORDINATION_SEARCH_RADIUS)\n",
192+
"coordination_numbers = get_unique_coordination_numbers(\n",
193+
" configuration=config,\n",
194+
" cutoff=coordination_search_radius or COORDINATION_SEARCH_RADIUS\n",
195+
")\n",
187196
"print(f\"Unique coordination numbers: {coordination_numbers}\")\n",
188197
"\n",
198+
"cn_distribution = get_coordination_numbers_distribution(\n",
199+
" configuration=config,\n",
200+
" cutoff=coordination_search_radius or COORDINATION_SEARCH_RADIUS\n",
201+
")\n",
202+
"print(f\"Coordination numbers distribution: {cn_distribution}\")\n",
189203
"coordination_threshold = COORDINATION_THRESHOLD\n",
190204
"if IS_COORDINATION_SELECTION_INTERACTIVE:\n",
191205
" coordination_threshold = await select_coordination_threshold(\n",
192-
" coordination_numbers, COORDINATION_THRESHOLD\n",
206+
" cn_distribution, COORDINATION_THRESHOLD\n",
193207
" )\n",
194208
"\n",
195209
"print(f\"\\nSelected coordination threshold: {coordination_threshold}\")\n",
196-
"print(f\"Atoms with coordination < {coordination_threshold} will be passivated\")"
210+
"print(f\"Atoms with coordination <= {coordination_threshold} will be passivated\")"
197211
],
198-
"metadata": {
199-
"collapsed": false
200-
},
201-
"id": "54c265d8ca9408af",
202212
"outputs": [],
203213
"execution_count": null
204214
},
205215
{
206216
"cell_type": "markdown",
207-
"source": [
208-
"## 3. Create target material\n",
209-
"### 3.1. Set up passivation configuration and builder\n"
210-
],
217+
"id": "b873d2cb6eaa2bdb",
211218
"metadata": {
212219
"collapsed": false
213220
},
214-
"id": "b873d2cb6eaa2bdb"
221+
"source": [
222+
"## 3. Create target material\n",
223+
"### 3.1. Set up passivation configuration and builder\n"
224+
]
215225
},
216226
{
217227
"cell_type": "code",
228+
"id": "aca1c76a52e5376a",
229+
"metadata": {
230+
"collapsed": false
231+
},
218232
"source": [
219233
"from mat3ra.made.tools.build.passivation.builders import CoordinationBasedPassivationBuilder, \\\n",
220234
" CoordinationBasedPassivationBuilderParameters\n",
@@ -228,25 +242,25 @@
228242
"\n",
229243
"builder = CoordinationBasedPassivationBuilder(build_parameters=builder_params)"
230244
],
231-
"metadata": {
232-
"collapsed": false
233-
},
234-
"id": "aca1c76a52e5376a",
235245
"outputs": [],
236246
"execution_count": null
237247
},
238248
{
239249
"cell_type": "markdown",
240-
"source": [
241-
"### 3.2. Generate passivated structure\n"
242-
],
250+
"id": "e40b5f67ef5b54aa",
243251
"metadata": {
244252
"collapsed": false
245253
},
246-
"id": "e40b5f67ef5b54aa"
254+
"source": [
255+
"### 3.2. Generate passivated structure\n"
256+
]
247257
},
248258
{
249259
"cell_type": "code",
260+
"id": "3c36dc3654f544c1",
261+
"metadata": {
262+
"collapsed": false
263+
},
250264
"source": [
251265
"from mat3ra.made.tools.build.passivation import create_passivation\n",
252266
"\n",
@@ -258,59 +272,55 @@
258272
"print(f\"Original atoms: {len(nanoribbon.basis.elements.ids)}\")\n",
259273
"print(f\"Final atoms: {len(passivated_nanoribbon.basis.elements.ids)}\")"
260274
],
261-
"metadata": {
262-
"collapsed": false
263-
},
264-
"id": "3c36dc3654f544c1",
265275
"outputs": [],
266276
"execution_count": null
267277
},
268278
{
269279
"cell_type": "markdown",
270-
"source": [
271-
"## 4. Visualize the result"
272-
],
280+
"id": "ad96b86aef8b28f5",
273281
"metadata": {
274282
"collapsed": false
275283
},
276-
"id": "ad96b86aef8b28f5"
284+
"source": [
285+
"## 4. Visualize the result"
286+
]
277287
},
278288
{
279289
"cell_type": "code",
290+
"id": "d08ff21e3650ba5d",
291+
"metadata": {
292+
"collapsed": false
293+
},
280294
"source": [
281295
"print(\"Final passivated structure:\")\n",
282296
"visualize_materials(passivated_nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
283297
"visualize_materials(passivated_nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
284298
],
285-
"metadata": {
286-
"collapsed": false
287-
},
288-
"id": "d08ff21e3650ba5d",
289299
"outputs": [],
290300
"execution_count": null
291301
},
292302
{
293303
"cell_type": "markdown",
294-
"source": [
295-
"## 5. Pass data to the outside runtime\n"
296-
],
304+
"id": "7151e48eae3b1886",
297305
"metadata": {
298306
"collapsed": false
299307
},
300-
"id": "7151e48eae3b1886"
308+
"source": [
309+
"## 5. Pass data to the outside runtime\n"
310+
]
301311
},
302312
{
303313
"cell_type": "code",
314+
"id": "2d69736d0c71858c",
315+
"metadata": {
316+
"collapsed": false
317+
},
304318
"source": [
305319
"from utils.jupyterlite import set_materials\n",
306320
"\n",
307321
"passivated_nanoribbon.name = f\"{nanoribbon.name} passivated\"\n",
308322
"set_materials(passivated_nanoribbon)"
309323
],
310-
"metadata": {
311-
"collapsed": false
312-
},
313-
"id": "2d69736d0c71858c",
314324
"outputs": [],
315325
"execution_count": null
316326
}

0 commit comments

Comments
 (0)