diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb index a52e3331..3b2ad558 100644 --- a/other/materials_designer/Introduction.ipynb +++ b/other/materials_designer/Introduction.ipynb @@ -41,6 +41,10 @@ "\n", "This notebook lets user add a perturbation to a slab by moving atoms according to a specified function. [Click here to open the notebook](create_perturbation.ipynb).\n", "\n", + "#### [1.8. Heterostructure creation](create_heterostructure_example.ipynb)\n", + "\n", + "This notebook lets user create a heterostructure between three materials by consequent creation of two interfaces. [Click here to open the notebook](create_heterostructure_example.ipynb).\n", + "\n", "### 2. Data Import\n", "\n", "#### [2.1. Materials import from files in ASE-supported formats](import_materials_from_files.ipynb)\n", diff --git a/other/materials_designer/create_heterostructure_example.ipynb b/other/materials_designer/create_heterostructure_example.ipynb new file mode 100644 index 00000000..281a684e --- /dev/null +++ b/other/materials_designer/create_heterostructure_example.ipynb @@ -0,0 +1,765 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Create Heterostructure Example with Three Materials\n", + "\n", + "This notebook demonstrates how to create a heterostructure involving three different materials using a sequential interface creation approach. We first create an interface between **Material 0** and **Material 1**, and then use that interface as a substrate to add a film of **Material 2**.\n", + "\n", + "

Usage

\n", + "\n", + "1. **Set up the notebook and install packages**\n", + "2. **Import materials from Standata**\n", + "3. **Select and preview materials for the heterostructure**\n", + "4. **Build the heterostructure layer by layer with ZSL interface builder**\n", + "\n", + "## Summary\n", + "\n", + "1. **Prepare the Environment:** Set up the notebook and install packages, preview the input materials.\n", + "2. **Create Interfaces:** Sequentially create interfaces between the materials.\n", + "3. **Visualize:** Preview the materials and resulting interfaces.\n", + "4. **Pass to Runtime:** Pass the final heterostructure to the external runtime.\n", + "\n", + "## Notes\n", + "\n", + "1. For more information, see [Introduction](Introduction.ipynb)\n", + "\n", + "\n" + ], + "metadata": { + "collapsed": false + }, + "id": "ad0a4601cb4095ad" + }, + { + "cell_type": "markdown", + "source": [ + "## 1. Prepare the Environment\n", + "### 1.1. Set up the Notebook\n", + "\n", + "Set the following flags to control the notebook behavior.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "a0b4736f3dffa189" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "# Enable interactive selection of terminations via UI prompt\n", + "IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n", + "\n", + "# Indices and configurations for the three materials\n", + "MATERIAL_0_INDEX = 0\n", + "MATERIAL_1_INDEX = 1\n", + "MATERIAL_2_INDEX = 2\n", + "\n", + "# Interface parameters\n", + "MAX_AREA_01 = 50 # search area for the first interface\n", + "MAX_AREA_12 = 200 # search area for the second interface\n", + "INTERFACE_01_DISTANCE = 3.0 # in Angstrom\n", + "INTERFACE_12_DISTANCE = 3.0 # in Angstrom\n", + "FINAL_INTERFACE_VACUUM = 20.0 # in Angstrom\n", + "\n", + "# Configuration for Material 0 (Substrate)\n", + "MATERIAL_0_MILLER_INDICES = (0, 0, 1)\n", + "MATERIAL_0_THICKNESS = 3 # in atomic layers\n", + "MATERIAL_0_VACUUM = 3 # in Angstroms\n", + "MATERIAL_0_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", + "MATERIAL_0_USE_ORTHOGONAL_Z = True\n", + "\n", + "# Configuration for Material 1 (Film 1)\n", + "MATERIAL_1_MILLER_INDICES = (0, 0, 1)\n", + "MATERIAL_1_THICKNESS = 1 # in atomic layers\n", + "MATERIAL_1_VACUUM = 0 # in Angstroms\n", + "MATERIAL_1_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", + "MATERIAL_1_USE_ORTHOGONAL_Z = True\n", + "\n", + "# Configuration for Material 2 (Film 2)\n", + "MATERIAL_2_MILLER_INDICES = (0, 0, 1)\n", + "MATERIAL_2_THICKNESS = 1 # in atomic layers\n", + "MATERIAL_2_VACUUM = 1 # in Angstroms\n", + "MATERIAL_2_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", + "MATERIAL_2_USE_ORTHOGONAL_Z = True\n", + "\n", + "# Set termination pair indices for both interfaces\n", + "TERMINATION_PAIR_INDEX_01 = 0\n", + "TERMINATION_PAIR_INDEX_12 = 0\n" + ], + "metadata": { + "collapsed": false + }, + "id": "9e90252bcef065c9", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 1.2. Install Packages\n", + "\n", + "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb)).\n" + ], + "metadata": { + "collapsed": false + }, + "id": "e460756f40327e78" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "import sys\n", + "\n", + "if sys.platform == \"emscripten\":\n", + " import micropip\n", + " await micropip.install('mat3ra-api-examples', deps=False)\n", + " from utils.jupyterlite import install_packages\n", + " await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")\n" + ], + "metadata": { + "collapsed": false + }, + "id": "a4d99b5b40274810", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 1.3. Get Input Materials and Assign `material0`, `material1`, and `material2`\n", + "\n", + "Materials are loaded with `get_materials()`. The first material is assigned as **Material 0**, the second as **Material 1**, and the third as **Material 2**.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "c4b29abaa6160a66" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from utils.jupyterlite import get_materials\n", + "\n", + "materials = get_materials(globals())\n", + "\n", + "material0 = materials[MATERIAL_0_INDEX]\n", + "\n", + "try: \n", + " material1 = materials[MATERIAL_1_INDEX]\n", + "except IndexError:\n", + " print(\"Please select Material 1. Material 1 is set to Material 0.\")\n", + " material1 = material0\n", + "\n", + "try:\n", + " material2 = materials[MATERIAL_2_INDEX]\n", + "except IndexError:\n", + " print(\"Please select Material 2. Material 2 is set to Material 0.\")\n", + " material2 = material0\n" + ], + "metadata": { + "collapsed": false + }, + "id": "e90d5bf2655f5e0f", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 1.4. Preview Original Materials\n", + "\n", + "Visualize the three original materials.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "1ffc1f88eedbc9a4" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from utils.visualize import visualize_materials as visualize\n", + "\n", + "visualize([material0, material1, material2], repetitions=[3, 3, 1], rotation=\"0x\")\n" + ], + "metadata": { + "collapsed": false + }, + "id": "6253034909a0fef9", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "## 2. Create First Interface (Material 0 + Material 1)\n", + "\n", + "### 2.1. Configure Slabs and Select Termination Pair\n", + "\n", + "Set up slab configurations for **Material 0** and **Material 1**, then select terminations for the first interface.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "574327eaccdd52f0" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n", + "\n", + "# Slab Configuration for Material 1\n", + "material1_slab_configuration = SlabConfiguration(\n", + " bulk=material1,\n", + " miller_indices=MATERIAL_1_MILLER_INDICES,\n", + " thickness=MATERIAL_1_THICKNESS, # in atomic layers\n", + " vacuum=MATERIAL_1_VACUUM, # in Angstroms\n", + " xy_supercell_matrix=MATERIAL_1_XY_SUPERCELL_MATRIX,\n", + " use_orthogonal_z=MATERIAL_1_USE_ORTHOGONAL_Z\n", + ")\n", + "\n", + "# Slab Configuration for Material 0 (Substrate)\n", + "material0_slab_configuration = SlabConfiguration(\n", + " bulk=material0,\n", + " miller_indices=MATERIAL_0_MILLER_INDICES,\n", + " thickness=MATERIAL_0_THICKNESS, # in atomic layers\n", + " vacuum=MATERIAL_0_VACUUM, # in Angstroms\n", + " xy_supercell_matrix=MATERIAL_0_XY_SUPERCELL_MATRIX,\n", + " use_orthogonal_z=MATERIAL_0_USE_ORTHOGONAL_Z\n", + ")\n", + "\n", + "# Get possible terminations for the slabs\n", + "material1_slab_terminations = get_terminations(material1_slab_configuration)\n", + "material0_slab_terminations = get_terminations(material0_slab_configuration)\n", + "\n", + "# Visualize all possible terminations\n", + "material1_slabs = [create_slab(material1_slab_configuration, termination) for termination in material1_slab_terminations]\n", + "material0_slabs = [create_slab(material0_slab_configuration, termination) for termination in material0_slab_terminations]\n", + "\n", + "visualize(\n", + " [{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in material1_slabs],\n", + " repetitions=[3, 3, 1],\n", + " rotation=\"-90x\"\n", + ")\n", + "\n", + "visualize(\n", + " [{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in material0_slabs],\n", + " repetitions=[3, 3, 1],\n", + " rotation=\"-90x\"\n", + ")\n" + ], + "metadata": { + "collapsed": false + }, + "id": "de4fe773ee9c8a61", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.2. Print and Select Termination Pair for First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "e4aea26afab84e0c" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from itertools import product\n", + "\n", + "termination_pairs_01 = list(product(material1_slab_terminations, material0_slab_terminations)) \n", + "print(\"Termination Pairs for First Interface (Material1, Material0)\")\n", + "for idx, termination_pair in enumerate(termination_pairs_01):\n", + " print(f\" {idx}: {termination_pair}\")\n" + ], + "metadata": { + "collapsed": false + }, + "id": "4e467693b61f0125", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.3. Select Termination Pair for First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "e70e2a4ef133c9f" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n", + "\n", + "termination_pair_index_01 = TERMINATION_PAIR_INDEX_01\n", + "\n", + "termination_pair_first = termination_pairs_01[termination_pair_index_01]\n", + "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n", + " if sys.platform == \"emscripten\":\n", + " termination_pair_first = await ui_prompt_select_array_element_by_index_pyodide(\n", + " termination_pairs_01,\n", + " element_name=\"Material1/Material0 termination pair\"\n", + " )\n", + " else:\n", + " termination_pair_first = ui_prompt_select_array_element_by_index(\n", + " termination_pairs_01,\n", + " element_name=\"Material1/Material0 termination pair\"\n", + " )\n" + ], + "metadata": { + "collapsed": false + }, + "id": "c99cb2e5bbcd24df", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.4. Initialize Interface Configuration for First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "7621d2178a91c691" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from mat3ra.made.tools.build.interface import InterfaceConfiguration\n", + "\n", + "material1_termination, material0_termination = termination_pair_first\n", + "interface_configuration_01 = InterfaceConfiguration(\n", + " film_configuration=material1_slab_configuration,\n", + " substrate_configuration=material0_slab_configuration,\n", + " film_termination=material1_termination,\n", + " substrate_termination=material0_termination,\n", + " distance=INTERFACE_01_DISTANCE,\n", + " vacuum=FINAL_INTERFACE_VACUUM\n", + ")\n" + ], + "metadata": { + "collapsed": false + }, + "id": "9e87ca9779cee593", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.5. Set Strain Matching Parameters and Generate First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "afab24f1d8cf9ad7" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from mat3ra.made.tools.build.interface import ZSLStrainMatchingParameters\n", + "from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n", + "\n", + "zsl_strain_matching_parameters_01 = ZSLStrainMatchingParameters(\n", + " max_area=MAX_AREA_01\n", + ")\n", + "\n", + "matched_interfaces_builder_01 = ZSLStrainMatchingInterfaceBuilder(\n", + " build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(\n", + " strain_matching_parameters=zsl_strain_matching_parameters_01\n", + " )\n", + ")\n", + "\n", + "interfaces_01_sorted = matched_interfaces_builder_01.get_materials(configuration=interface_configuration_01)\n" + ], + "metadata": { + "collapsed": false + }, + "id": "9b72198198a18278", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.6. Plot and Select First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "4989c48b4ed6a33d" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from utils.plot import plot_strain_vs_atoms\n", + "\n", + "PLOT_SETTINGS = {\n", + " \"HEIGHT\": 600,\n", + " \"X_SCALE\": \"log\", # or linear\n", + " \"Y_SCALE\": \"log\", # or linear\n", + "}\n", + "\n", + "plot_strain_vs_atoms(interfaces_01_sorted, PLOT_SETTINGS)\n", + "\n", + "# Select the first interface with the lowest strain and smallest number of atoms\n", + "interfaces_slice_range_01 = slice(0, 1)\n", + "selected_interfaces_01 = interfaces_01_sorted[interfaces_slice_range_01]\n" + ], + "metadata": { + "collapsed": false + }, + "id": "32e05e63fea1b5a3", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 2.7. Preview the First Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "342d6261ae79122" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "visualize(selected_interfaces_01, repetitions=[3, 3, 1])\n", + "visualize(selected_interfaces_01, repetitions=[3, 3, 1], rotation=\"-90x\")" + ], + "metadata": { + "collapsed": false + }, + "id": "1148759314be11cc", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "## 3. Create Second Interface (First Interface + Material 2)\n", + "\n", + "### 3.1. Configure Slabs and Select Termination Pair for Second Interface\n", + "\n", + "Now, use the first interface as the substrate to add **Material 2**.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "df770aba2dbc2df0" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from mat3ra.made.tools.modify import translate_to_z_level\n", + "from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n", + "\n", + "# Update substrate to be the first interface\n", + "substrate_second = translate_to_z_level(selected_interfaces_01[0], \"top\")\n", + "\n", + "# Slab Configuration for Material 2\n", + "material2_slab_configuration = SlabConfiguration(\n", + " bulk=material2,\n", + " miller_indices=MATERIAL_2_MILLER_INDICES,\n", + " thickness=MATERIAL_2_THICKNESS, # in atomic layers\n", + " vacuum=MATERIAL_2_VACUUM, # in atomic layers\n", + " xy_supercell_matrix=MATERIAL_2_XY_SUPERCELL_MATRIX,\n", + " use_orthogonal_z=MATERIAL_2_USE_ORTHOGONAL_Z\n", + ")\n", + "\n", + "# Slab Configuration for Substrate (First Interface)\n", + "substrate_second_slab_configuration = SlabConfiguration(\n", + " bulk=substrate_second,\n", + " miller_indices=(0, 0, 1), # Z-orientation for the first interface\n", + " thickness=1, # One unit cell thick\n", + " vacuum=0, \n", + " xy_supercell_matrix=MATERIAL_0_XY_SUPERCELL_MATRIX, # Adjust if necessary\n", + " use_orthogonal_z=MATERIAL_0_USE_ORTHOGONAL_Z\n", + ")\n", + "\n", + "# Get possible terminations for the second interface slabs\n", + "material2_slab_terminations = get_terminations(material2_slab_configuration)\n", + "substrate_second_slab_terminations = get_terminations(substrate_second_slab_configuration)\n", + "\n", + "# Visualize all possible terminations for Material 2 and Substrate (First Interface)\n", + "material2_slabs = [create_slab(material2_slab_configuration, termination) for termination in material2_slab_terminations]\n", + "substrate_second_slabs = [create_slab(substrate_second_slab_configuration, termination) for termination in substrate_second_slab_terminations]\n", + "\n", + "visualize(\n", + " [{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in material2_slabs],\n", + " repetitions=[3, 3, 1],\n", + " rotation=\"-90x\"\n", + ")\n", + "\n", + "visualize(\n", + " [{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in substrate_second_slabs],\n", + " repetitions=[3, 3, 1],\n", + " rotation=\"-90x\"\n", + ")" + ], + "metadata": { + "collapsed": false + }, + "id": "636e0e4c45b02925", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.2. Print and Select Termination Pair for Second Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "ac68ed5b9219b0dc" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "termination_pairs_12 = list(product(material2_slab_terminations, substrate_second_slab_terminations)) \n", + "print(\"Termination Pairs for Second Interface (Material2, First Interface Substrate)\")\n", + "for idx, termination_pair in enumerate(termination_pairs_12):\n", + " print(f\" {idx}: {termination_pair}\")" + ], + "metadata": { + "collapsed": false + }, + "id": "41b3d541c1ebfe5a", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.3. Select Termination Pair for Second Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "822c79480c3d7965" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "termination_pair_index_12 = TERMINATION_PAIR_INDEX_12\n", + "\n", + "termination_pair_second = termination_pairs_12[termination_pair_index_12]\n", + "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n", + " if sys.platform == \"emscripten\":\n", + " termination_pair_second = await ui_prompt_select_array_element_by_index_pyodide(\n", + " termination_pairs_12,\n", + " element_name=\"Material2/First Interface termination pair\"\n", + " )\n", + " else:\n", + " termination_pair_second = ui_prompt_select_array_element_by_index(\n", + " termination_pairs_12,\n", + " element_name=\"Material2/First Interface termination pair\"\n", + " )" + ], + "metadata": { + "collapsed": false + }, + "id": "f9d2b5429447338e", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.4. Initialize Interface Configuration for Second Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "796e3604d6bd4c60" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from mat3ra.made.tools.build.interface import InterfaceConfiguration\n", + "\n", + "material2_termination, substrate_second_termination = termination_pair_second\n", + "interface_configuration_12 = InterfaceConfiguration(\n", + " film_configuration=material2_slab_configuration,\n", + " substrate_configuration=substrate_second_slab_configuration,\n", + " film_termination=material2_termination,\n", + " substrate_termination=substrate_second_termination,\n", + " distance=INTERFACE_12_DISTANCE,\n", + " vacuum=FINAL_INTERFACE_VACUUM\n", + ")" + ], + "metadata": { + "collapsed": false + }, + "id": "fa7e6b937d2b78a0", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.5. Set Strain Matching Parameters and Generate Second Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "3816e1b290f7e5d0" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "zsl_strain_matching_parameters_12 = ZSLStrainMatchingParameters(\n", + " max_area=MAX_AREA_12\n", + ")\n", + "\n", + "matched_interfaces_builder_12 = ZSLStrainMatchingInterfaceBuilder(\n", + " build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(\n", + " strain_matching_parameters=zsl_strain_matching_parameters_12\n", + " )\n", + ")\n", + "\n", + "interfaces_12_sorted = matched_interfaces_builder_12.get_materials(configuration=interface_configuration_12)" + ], + "metadata": { + "collapsed": false + }, + "id": "6f30c6961f7abbfe", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.6. Plot and Select Second Interface\n" + ], + "metadata": { + "collapsed": false + }, + "id": "32ded9bdae6ef429" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "plot_strain_vs_atoms(interfaces_12_sorted, PLOT_SETTINGS)\n", + "\n", + "# Select the first interface with the lowest strain and smallest number of atoms\n", + "interfaces_slice_range_12 = slice(0, 1)\n", + "selected_interfaces_12 = interfaces_12_sorted[interfaces_slice_range_12]" + ], + "metadata": { + "collapsed": false + }, + "id": "43f233403393eb2a", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "### 3.7. Preview the Second Interface (Final Heterostructure)\n" + ], + "metadata": { + "collapsed": false + }, + "id": "ed109941d5e29522" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "visualize(selected_interfaces_12, repetitions=[3, 3, 1])\n", + "visualize(selected_interfaces_12, repetitions=[3, 3, 1], rotation=\"-90x\")" + ], + "metadata": { + "collapsed": false + }, + "id": "fffbf9243911a98", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "## 4. Preview the Final Heterostructure\n" + ], + "metadata": { + "collapsed": false + }, + "id": "e98176e806c4aace" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "visualize(selected_interfaces_12, repetitions=[3, 3, 1], title=\"Final Heterostructure (First Interface + Material2)\")\n", + "visualize(selected_interfaces_12, repetitions=[3, 3, 1], rotation=\"-90x\", title=\"Final Heterostructure (First Interface + Material2) Rotated\")" + ], + "metadata": { + "collapsed": false + }, + "id": "47f9a1aa1578c37", + "execution_count": null + }, + { + "cell_type": "markdown", + "source": [ + "## 5. Pass the Final Heterostructure to the Outside Runtime\n", + "\n", + "Pass the resulting heterostructure with an adjusted name to `set_materials()`.\n" + ], + "metadata": { + "collapsed": false + }, + "id": "946d5a41156bc1e1" + }, + { + "cell_type": "code", + "outputs": [], + "source": [ + "from utils.jupyterlite import set_materials\n", + "\n", + "final_heterostructure = selected_interfaces_12[0]\n", + "final_heterostructure.name = f\"{material0.name} - {material1.name} - {material2.name} - Heterostructure\"\n", + "\n", + "set_materials(final_heterostructure)" + ], + "metadata": { + "collapsed": false + }, + "id": "1b466c32b0d82431", + "execution_count": null + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}