Skip to content

Commit 363a044

Browse files
Merge pull request #196 from Exabyte-io/feature/SOF-7513
Feature/sof 7513
2 parents f92a0fd + 1c20ce1 commit 363a044

3 files changed

Lines changed: 413 additions & 22 deletions

File tree

other/materials_designer/create_interface_with_min_strain_zsl.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
" substrate_configuration=substrate_slab_configuration,\n",
318318
" film_termination=film_termination,\n",
319319
" substrate_termination=substrate_termination,\n",
320-
" distance=INTERFACE_DISTANCE,\n",
320+
" distance_z=INTERFACE_DISTANCE,\n",
321321
" vacuum= INTERFACE_VACUUM\n",
322322
")"
323323
],

other/materials_designer/specific_examples/interface_2d_2d_boron_nitride_graphene.ipynb

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
"outputs": [],
4040
"source": [
4141
"# Enable interactive selection of terminations via UI prompt\n",
42-
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
42+
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False\n",
4343
"\n",
44-
"FILM_INDEX = 1 # Index in the list of materials, to access as materials[FILM_INDEX]\n",
44+
"FILM_INDEX = 1 # Index in the list of materials, to access as materials[FILM_INDEX]\n",
4545
"FILM_MILLER_INDICES = (0, 0, 1)\n",
4646
"FILM_THICKNESS = 1 # in atomic layers\n",
4747
"FILM_VACUUM = 0.0 # in angstroms\n",
@@ -56,9 +56,9 @@
5656
"SUBSTRATE_USE_ORTHOGONAL_Z = True\n",
5757
"\n",
5858
"# Maximum area for the superlattice search algorithm\n",
59-
"MAX_AREA = 50 # in Angstrom^2\n",
59+
"MAX_AREA = 50 # in Angstrom^2\n",
6060
"# Set the termination pair indices\n",
61-
"TERMINATION_PAIR_INDEX = 0 # Will be overridden in interactive selection is used\n",
61+
"TERMINATION_PAIR_INDEX = 0 # Will be overridden in interactive selection is used\n",
6262
"INTERFACE_DISTANCE = 3.4 # in Angstrom\n",
6363
"INTERFACE_VACUUM = 20.0 # in Angstrom"
6464
],
@@ -85,9 +85,10 @@
8585
"\n",
8686
"if sys.platform == \"emscripten\":\n",
8787
" import micropip\n",
88-
" \n",
88+
"\n",
8989
" await micropip.install('mat3ra-api-examples', deps=False)\n",
9090
" from utils.jupyterlite import install_packages\n",
91+
"\n",
9192
" await install_packages(\"specific_examples|create_interface_with_min_strain_zsl.ipynb\")"
9293
],
9394
"metadata": {
@@ -109,6 +110,7 @@
109110
"source": [
110111
"from mat3ra.standata.materials import Materials\n",
111112
"from mat3ra.made.material import Material\n",
113+
"\n",
112114
"film = Material(Materials.get_by_name_first_match(\"Graphene\"))\n",
113115
"substrate = Material(Materials.get_by_name_and_categories(\"BN\", \"2D\"))"
114116
],
@@ -131,6 +133,7 @@
131133
"outputs": [],
132134
"source": [
133135
"from utils.visualize import visualize_materials as visualize\n",
136+
"\n",
134137
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
135138
],
136139
"metadata": {
@@ -158,17 +161,17 @@
158161
"film_slab_configuration = SlabConfiguration(\n",
159162
" bulk=film,\n",
160163
" miller_indices=FILM_MILLER_INDICES,\n",
161-
" thickness=FILM_THICKNESS, # in atomic layers\n",
162-
" vacuum=FILM_VACUUM, # in angstroms\n",
164+
" thickness=FILM_THICKNESS, # in atomic layers\n",
165+
" vacuum=FILM_VACUUM, # in angstroms\n",
163166
" xy_supercell_matrix=FILM_XY_SUPERCELL_MATRIX,\n",
164167
" use_orthogonal_z=FILM_USE_ORTHOGONAL_Z\n",
165168
")\n",
166169
"\n",
167170
"substrate_slab_configuration = SlabConfiguration(\n",
168171
" bulk=substrate,\n",
169172
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
170-
" thickness=SUBSTRATE_THICKNESS, # in atomic layers\n",
171-
" vacuum=SUBSTRATE_VACUUM, # in angstroms\n",
173+
" thickness=SUBSTRATE_THICKNESS, # in atomic layers\n",
174+
" vacuum=SUBSTRATE_VACUUM, # in angstroms\n",
172175
" xy_supercell_matrix=SUBSTRATE_XY_SUPERCELL_MATRIX,\n",
173176
" use_orthogonal_z=SUBSTRATE_USE_ORTHOGONAL_Z\n",
174177
")"
@@ -211,10 +214,13 @@
211214
"outputs": [],
212215
"source": [
213216
"film_slabs = [create_slab(film_slab_configuration, termination) for termination in film_slab_terminations]\n",
214-
"substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in substrate_slab_terminations]\n",
217+
"substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in\n",
218+
" substrate_slab_terminations]\n",
215219
"\n",
216-
"visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in film_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\")\n",
217-
"visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") "
220+
"visualize([{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in film_slabs],\n",
221+
" repetitions=[3, 3, 1], rotation=\"-90x\")\n",
222+
"visualize([{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in substrate_slabs],\n",
223+
" repetitions=[3, 3, 1], rotation=\"-90x\")"
218224
],
219225
"metadata": {
220226
"collapsed": false
@@ -236,7 +242,7 @@
236242
"source": [
237243
"from itertools import product\n",
238244
"\n",
239-
"termination_pairs = list(product(film_slab_terminations, substrate_slab_terminations)) \n",
245+
"termination_pairs = list(product(film_slab_terminations, substrate_slab_terminations))\n",
240246
"print(\"Termination Pairs (Film, Substrate)\")\n",
241247
"for idx, termination_pair in enumerate(termination_pairs):\n",
242248
" print(f\" {idx}: {termination_pair}\")"
@@ -266,9 +272,11 @@
266272
"termination_pair = termination_pairs[termination_pair_index]\n",
267273
"if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n",
268274
" if sys.platform == \"emscripten\":\n",
269-
" termination_pair = await ui_prompt_select_array_element_by_index_pyodide(termination_pairs, element_name=\"film/substrate termination pair\")\n",
275+
" termination_pair = await ui_prompt_select_array_element_by_index_pyodide(termination_pairs,\n",
276+
" element_name=\"film/substrate termination pair\")\n",
270277
" else:\n",
271-
" termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"film/substrate termination pair\")"
278+
" termination_pair = ui_prompt_select_array_element_by_index(termination_pairs,\n",
279+
" element_name=\"film/substrate termination pair\")"
272280
],
273281
"metadata": {
274282
"collapsed": false
@@ -299,7 +307,7 @@
299307
" film_termination=film_termination,\n",
300308
" substrate_termination=substrate_termination,\n",
301309
" distance=INTERFACE_DISTANCE,\n",
302-
" vacuum= INTERFACE_VACUUM\n",
310+
" vacuum=INTERFACE_VACUUM\n",
303311
")"
304312
],
305313
"metadata": {
@@ -322,6 +330,7 @@
322330
"outputs": [],
323331
"source": [
324332
"from mat3ra.made.tools.build.interface import ZSLStrainMatchingParameters\n",
333+
"\n",
325334
"zsl_strain_matching_parameters = ZSLStrainMatchingParameters(\n",
326335
" max_area=MAX_AREA\n",
327336
")"
@@ -345,11 +354,14 @@
345354
"cell_type": "code",
346355
"outputs": [],
347356
"source": [
348-
"from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n",
357+
"from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, \\\n",
358+
" ZSLStrainMatchingInterfaceBuilderParameters\n",
349359
"\n",
350-
"matched_interfaces_builder = ZSLStrainMatchingInterfaceBuilder(build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(strain_matching_parameters=zsl_strain_matching_parameters))\n",
360+
"matched_interfaces_builder = ZSLStrainMatchingInterfaceBuilder(\n",
361+
" build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(\n",
362+
" strain_matching_parameters=zsl_strain_matching_parameters))\n",
351363
"\n",
352-
"interfaces_sorted_by_size_and_strain= matched_interfaces_builder.get_materials(configuration=interface_configuration)"
364+
"interfaces_sorted_by_size_and_strain = matched_interfaces_builder.get_materials(configuration=interface_configuration)"
353365
],
354366
"metadata": {
355367
"collapsed": false
@@ -445,10 +457,14 @@
445457
"source": [
446458
"import numpy as np\n",
447459
"from mat3ra.made.tools.modify import interface_displace_part\n",
460+
"\n",
448461
"a = selected_interface.lattice.a\n",
449462
"shifted_interfaces = []\n",
450-
"for n in range(7):\n",
451-
" shifted_interface= interface_displace_part(selected_interface, [0,n*a/np.sqrt(3)/2,0], use_cartesian_coordinates=True)\n",
463+
"for n in range(2, 9):\n",
464+
" shifted_interface = interface_displace_part(\n",
465+
" interface=selected_interface, \n",
466+
" displacement=[0, n * a / np.sqrt(3) / 2, 0],\n",
467+
" use_cartesian_coordinates=True)\n",
452468
" shifted_interfaces.append(shifted_interface)"
453469
],
454470
"metadata": {
@@ -490,6 +506,7 @@
490506
"outputs": [],
491507
"source": [
492508
"from utils.jupyterlite import download_content_to_file\n",
509+
"\n",
493510
"for idx, interface in enumerate(shifted_interfaces):\n",
494511
" download_content_to_file(interface, f\"interface_{idx}.json\")"
495512
]

0 commit comments

Comments
 (0)