From 1703dffe5a01b8e486175fdae129bced5bad5d8a Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 23 Jan 2025 12:58:50 -0800 Subject: [PATCH 1/2] update: add json dumps --- other/materials_designer/src/__init__.py | 0 utils/jupyterlite.py | 1 + 2 files changed, 1 insertion(+) create mode 100644 other/materials_designer/src/__init__.py diff --git a/other/materials_designer/src/__init__.py b/other/materials_designer/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/jupyterlite.py b/utils/jupyterlite.py index a739ec7f..0bc84a13 100644 --- a/utils/jupyterlite.py +++ b/utils/jupyterlite.py @@ -448,6 +448,7 @@ def download_content_to_file(content: Any, filename: str): if isinstance(content, Material): content = content.to_json() + content = json.dumps(content, indent=4) js_code = f""" var content = `{content}`; From 0f36db03cf62649c2f264602020d4ddef0580770 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 23 Jan 2025 16:55:36 -0800 Subject: [PATCH 2/2] update: add set_materials to every tutorial nb --- ...anar_grain_boundary_2d_boron_nitride.ipynb | 19 ++-- ..._grain_boundary_3d_fcc_metals_copper.ipynb | 87 ++++++++++--------- .../defect_point_pair_gallium_nitride.ipynb | 19 ++-- .../defect_point_substitution_graphene.ipynb | 3 +- .../defect_point_vacancy_boron_nitride.ipynb | 3 +- .../defect_surface_adatom_graphene.ipynb | 3 +- ...fect_surface_island_titanium_nitride.ipynb | 3 +- .../defect_surface_step_platinum.ipynb | 3 +- ...ide_hafnium_dioxide_titanium_nitride.ipynb | 6 +- ...terface_2d_2d_boron_nitride_graphene.ipynb | 3 +- ...rface_2d_3d_graphene_silicon_dioxide.ipynb | 3 +- .../interface_3d_3d_copper_cristobalite.ipynb | 3 +- ...surate_lattices_molybdenum_disulfide.ipynb | 4 +- ...er_twisted_nanoribbons_boron_nitride.ipynb | 3 +- ...ace_film_xy_position_graphene_nickel.ipynb | 4 +- .../passivation_edge_nanowire_silicon.ipynb | 30 +++---- .../passivation_surface_silicon.ipynb | 25 +++--- .../perturbation_ripple_graphene.ipynb | 3 +- .../slab_strontium_titanate.ipynb | 3 +- 19 files changed, 123 insertions(+), 104 deletions(-) diff --git a/other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb b/other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb index cc7bd278..c72bc2f0 100644 --- a/other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb +++ b/other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb @@ -41,7 +41,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "# Material selection\n", "MATERIAL_NAME = \"Boron_Nitride\" # Name of the material to import from Standata\n", @@ -73,6 +72,7 @@ "collapsed": false }, "id": "338ee3c51155e086", + "outputs": [], "execution_count": null }, { @@ -88,7 +88,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "import sys\n", "\n", @@ -104,6 +103,7 @@ "collapsed": false }, "id": "7e22d1f4da825575", + "outputs": [], "execution_count": null }, { @@ -118,7 +118,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.standata.materials import Materials\n", "from mat3ra.made.material import Material\n", @@ -129,6 +128,7 @@ "collapsed": false }, "id": "a1635c31132962f6", + "outputs": [], "execution_count": null }, { @@ -144,7 +144,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials\n", "\n", @@ -155,6 +154,7 @@ "collapsed": false }, "id": "61f0870d8104cd21", + "outputs": [], "execution_count": null }, { @@ -170,7 +170,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.grain_boundary import (\n", " SurfaceGrainBoundaryConfiguration,\n", @@ -200,6 +199,7 @@ "collapsed": false }, "id": "33a2c8a9be436745", + "outputs": [], "execution_count": null }, { @@ -214,7 +214,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.plot import plot_twisted_interface_solutions\n", "\n", @@ -234,6 +233,7 @@ "collapsed": false }, "id": "d7007fe825463e5a", + "outputs": [], "execution_count": null }, { @@ -249,7 +249,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "selected_structure = grain_boundaries[0]\n", "\n", @@ -265,6 +264,7 @@ "collapsed": false }, "id": "7f558a8e9d417cef", + "outputs": [], "execution_count": null }, { @@ -279,16 +279,17 @@ }, { "cell_type": "code", - "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(selected_structure)\n", "download_content_to_file(selected_structure, \"grain_boundary_2d_boron_nitride.json\")" ], "metadata": { "collapsed": false }, "id": "20e46167358d63", + "outputs": [], "execution_count": null } ], diff --git a/other/materials_designer/specific_examples/defect_planar_grain_boundary_3d_fcc_metals_copper.ipynb b/other/materials_designer/specific_examples/defect_planar_grain_boundary_3d_fcc_metals_copper.ipynb index 398c6da1..c6c20d5f 100644 --- a/other/materials_designer/specific_examples/defect_planar_grain_boundary_3d_fcc_metals_copper.ipynb +++ b/other/materials_designer/specific_examples/defect_planar_grain_boundary_3d_fcc_metals_copper.ipynb @@ -39,12 +39,10 @@ }, { "cell_type": "code", - "execution_count": 1, "id": "45730b0f5384262b", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "# Enable interactive selection of terminations via UI prompt\n", "IS_TERMINATIONS_SELECTION_INTERACTIVE = False\n", @@ -73,7 +71,9 @@ "\n", "# Set the termination pair indices\n", "TERMINATION_PAIR_INDEX = 0 # Will be overridden if interactive selection is used" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -88,12 +88,10 @@ }, { "cell_type": "code", - "execution_count": 2, "id": "bae18ae87d3cc5ba", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "import sys\n", "\n", @@ -103,7 +101,9 @@ " await micropip.install('mat3ra-api-examples', deps=False)\n", " from utils.jupyterlite import install_packages\n", " await install_packages(\"specific_examples|create_grain_boundary.ipynb\")\n" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -117,18 +117,18 @@ }, { "cell_type": "code", - "execution_count": 3, "id": "950e5bef61bbd84a", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from mat3ra.standata.materials import Materials\n", "from mat3ra.made.material import Material\n", "\n", "material = Material(Materials.get_by_name_first_match(MATERIAL_NAME))" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -142,16 +142,16 @@ }, { "cell_type": "code", - "execution_count": null, "id": "4ebde830102b0b94", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from utils.visualize import visualize_materials as visualize\n", "visualize([material], repetitions=[3, 3, 1], rotation=\"0x\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -168,12 +168,10 @@ }, { "cell_type": "code", - "execution_count": null, "id": "b7cc3daa852d868d", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n", "\n", @@ -190,7 +188,9 @@ " thickness=PHASE_2_THICKNESS,\n", " use_orthogonal_z=PHASE_2_USE_ORTHOGONAL_Z\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -204,16 +204,16 @@ }, { "cell_type": "code", - "execution_count": null, "id": "5bdc0e37e3ec9891", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "phase_1_terminations = get_terminations(phase_1_configuration)\n", "phase_2_terminations = get_terminations(phase_2_configuration)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -227,19 +227,19 @@ }, { "cell_type": "code", - "execution_count": null, "id": "f75092312b399f84", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "phase_1_slabs = [create_slab(phase_1_configuration, termination) for termination in phase_1_terminations]\n", "phase_2_slabs = [create_slab(phase_2_configuration, termination) for termination in phase_2_terminations]\n", "\n", "visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in phase_1_slabs], repetitions=[3, 3, 1], rotation=\"-90x\")\n", "visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in phase_2_slabs], repetitions=[3, 3, 1], rotation=\"-90x\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -253,12 +253,10 @@ }, { "cell_type": "code", - "execution_count": null, "id": "40b4ba55613d9658", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from itertools import product\n", "\n", @@ -266,7 +264,9 @@ "print(\"Termination Pairs (Phase 1, Phase 2)\")\n", "for idx, termination_pair in enumerate(termination_pairs):\n", " print(f\" {idx}: {termination_pair}\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -280,12 +280,10 @@ }, { "cell_type": "code", - "execution_count": 9, "id": "8dfc5893f510bae4", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n", "\n", @@ -297,7 +295,9 @@ " termination_pair = await ui_prompt_select_array_element_by_index_pyodide(termination_pairs, element_name=\"phase 1/phase 2 termination pair\")\n", " else:\n", " termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"phase 1/phase 2 termination pair\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -311,12 +311,10 @@ }, { "cell_type": "code", - "execution_count": 10, "id": "40b6c8662d071f18", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from mat3ra.made.tools.build.grain_boundary import SlabGrainBoundaryConfiguration\n", "\n", @@ -338,7 +336,9 @@ " gap=INTERPHASE_GAP,\n", " slab_configuration=slab_configuration\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -352,12 +352,10 @@ }, { "cell_type": "code", - "execution_count": 11, "id": "44015c5407563d4e", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from mat3ra.made.tools.build.interface import ZSLStrainMatchingParameters\n", "from mat3ra.made.tools.build.grain_boundary.builders import SlabGrainBoundaryBuilderParameters\n", @@ -369,7 +367,9 @@ "builder_parameters = SlabGrainBoundaryBuilderParameters(\n", " strain_matching_parameters=zsl_strain_matching_parameters\n", ")\n" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -383,18 +383,18 @@ }, { "cell_type": "code", - "execution_count": null, "id": "884b458236270a29", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "from mat3ra.made.tools.build.grain_boundary import SlabGrainBoundaryBuilder\n", "\n", "grain_boundary_builder = SlabGrainBoundaryBuilder(build_parameters=builder_parameters)\n", "grain_boundary = grain_boundary_builder.get_material(configuration=grain_boundary_configuration)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -408,16 +408,16 @@ }, { "cell_type": "code", - "execution_count": null, "id": "892c0e7c932cd725", "metadata": { "collapsed": false }, - "outputs": [], "source": [ "visualize([grain_boundary], repetitions=[1, 1, 1])\n", "visualize([grain_boundary], repetitions=[1, 1, 1], rotation=\"-90x\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -431,17 +431,18 @@ }, { "cell_type": "code", - "execution_count": null, "id": "503eff0dd5c1a160", "metadata": { "collapsed": false }, - "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(grain_boundary)\n", "download_content_to_file(grain_boundary, f\"{MATERIAL_NAME}-{PHASE_1_MILLER_INDICES}-{PHASE_2_MILLER_INDICES}_grain_boundary.json\")" - ] + ], + "outputs": [], + "execution_count": null } ], "metadata": { diff --git a/other/materials_designer/specific_examples/defect_point_pair_gallium_nitride.ipynb b/other/materials_designer/specific_examples/defect_point_pair_gallium_nitride.ipynb index 0bc337d2..58feb239 100644 --- a/other/materials_designer/specific_examples/defect_point_pair_gallium_nitride.ipynb +++ b/other/materials_designer/specific_examples/defect_point_pair_gallium_nitride.ipynb @@ -28,7 +28,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "SUPERCELL_MATRIX = [[3, 0, 0], [0, 3, 0], [0, 0, 2]]\n", "\n", @@ -48,6 +47,7 @@ "collapsed": false }, "id": "2719b1a0b211ce20", + "outputs": [], "execution_count": null }, { @@ -63,7 +63,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "import sys\n", "\n", @@ -79,6 +78,7 @@ "collapsed": false }, "id": "f4994342ac9f2cbd", + "outputs": [], "execution_count": null }, { @@ -94,7 +94,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.standata.materials import Materials\n", "from mat3ra.made.material import Material\n", @@ -105,6 +104,7 @@ "collapsed": false }, "id": "4a6bab14f63024d1", + "outputs": [], "execution_count": null }, { @@ -119,7 +119,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials as visualize\n", "from mat3ra.made.tools.build.supercell import create_supercell\n", @@ -132,6 +131,7 @@ "collapsed": false }, "id": "4580fda63efa927e", + "outputs": [], "execution_count": null }, { @@ -147,7 +147,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.defect.configuration import PointDefectPairConfiguration, PointDefectConfiguration\n", "from mat3ra.made.tools.build.defect.builders import PointDefectBuilderParameters\n", @@ -166,6 +165,7 @@ "collapsed": false }, "id": "c686498fc4419e3c", + "outputs": [], "execution_count": null }, { @@ -180,7 +180,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.defect.builders import PointDefectPairBuilder\n", "\n", @@ -190,6 +189,7 @@ "collapsed": false }, "id": "7a584be241ab1548", + "outputs": [], "execution_count": null }, { @@ -204,7 +204,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials as visualize\n", "\n", @@ -218,6 +217,7 @@ "collapsed": false }, "id": "951f0cffe9389d5e", + "outputs": [], "execution_count": null }, { @@ -232,16 +232,17 @@ }, { "cell_type": "code", - "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(material_with_defect)\n", "download_content_to_file(material_with_defect, \"Mg substitution and vacancy in GaN.json\")" ], "metadata": { "collapsed": false }, "id": "b9e1aba13faf1bf0", + "outputs": [], "execution_count": null } ], diff --git a/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb b/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb index 32800ec0..fe959955 100644 --- a/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb +++ b/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb @@ -258,8 +258,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "material_with_defect.name = \"N-doped Graphene\"\n", + "set_materials(material_with_defect)\n", "download_content_to_file(material_with_defect.to_json(), \"N-doped_Graphene.json\")" ], "metadata": { diff --git a/other/materials_designer/specific_examples/defect_point_vacancy_boron_nitride.ipynb b/other/materials_designer/specific_examples/defect_point_vacancy_boron_nitride.ipynb index f15bbbb4..0d8e3189 100644 --- a/other/materials_designer/specific_examples/defect_point_vacancy_boron_nitride.ipynb +++ b/other/materials_designer/specific_examples/defect_point_vacancy_boron_nitride.ipynb @@ -260,9 +260,10 @@ }, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", "material_with_defect.name = \"B-vacancy h-BN\"\n", + "set_materials(material_with_defect)\n", "download_content_to_file(material_with_defect.to_json(), \"B-vacancy_hexagonal_boron_nitride.json\")" ] } diff --git a/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb b/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb index 3436699c..fbefddeb 100644 --- a/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb +++ b/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb @@ -259,8 +259,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(materials_with_adatom)\n", "for material_with_defect in materials_with_adatom:\n", " download_content_to_file(material_with_defect.to_json(),\n", " f\"{material_with_defect.metadata['build']['configuration']['chemical_element']}_adatom.json\")" diff --git a/other/materials_designer/specific_examples/defect_surface_island_titanium_nitride.ipynb b/other/materials_designer/specific_examples/defect_surface_island_titanium_nitride.ipynb index 3338cd16..cffbe784 100644 --- a/other/materials_designer/specific_examples/defect_surface_island_titanium_nitride.ipynb +++ b/other/materials_designer/specific_examples/defect_surface_island_titanium_nitride.ipynb @@ -270,8 +270,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(slab_with_island)\n", "download_content_to_file(slab_with_island, \"TiN_slab_with_island.json\")" ], "metadata": { diff --git a/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb b/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb index 769b6169..9a0a795e 100644 --- a/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb +++ b/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb @@ -400,8 +400,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials([slab_211, terrace_slab])\n", "download_content_to_file(slab_211, \"Pt_211_step.json\")\n", "download_content_to_file(terrace_slab, \"Pt_111_terrace.json\")" ], diff --git a/other/materials_designer/specific_examples/heterostructure_silicon_silicon_dioxide_hafnium_dioxide_titanium_nitride.ipynb b/other/materials_designer/specific_examples/heterostructure_silicon_silicon_dioxide_hafnium_dioxide_titanium_nitride.ipynb index 0d7ca305..ff291083 100644 --- a/other/materials_designer/specific_examples/heterostructure_silicon_silicon_dioxide_hafnium_dioxide_titanium_nitride.ipynb +++ b/other/materials_designer/specific_examples/heterostructure_silicon_silicon_dioxide_hafnium_dioxide_titanium_nitride.ipynb @@ -456,7 +456,8 @@ "metadata": { "collapsed": false }, - "id": "2b3fda71c801aeff" + "id": "2b3fda71c801aeff", + "execution_count": null }, { "cell_type": "markdown", @@ -477,8 +478,9 @@ }, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(interface_3)\n", "download_content_to_file(interface_3, \"heterostructure_high_k_metal_gate.json\")" ] } diff --git a/other/materials_designer/specific_examples/interface_2d_2d_boron_nitride_graphene.ipynb b/other/materials_designer/specific_examples/interface_2d_2d_boron_nitride_graphene.ipynb index 4976ec92..20634d72 100644 --- a/other/materials_designer/specific_examples/interface_2d_2d_boron_nitride_graphene.ipynb +++ b/other/materials_designer/specific_examples/interface_2d_2d_boron_nitride_graphene.ipynb @@ -505,8 +505,9 @@ "metadata": {}, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(shifted_interfaces)\n", "for idx, interface in enumerate(shifted_interfaces):\n", " download_content_to_file(interface, f\"interface_{idx}.json\")" ] diff --git a/other/materials_designer/specific_examples/interface_2d_3d_graphene_silicon_dioxide.ipynb b/other/materials_designer/specific_examples/interface_2d_3d_graphene_silicon_dioxide.ipynb index 608eb9d5..56fc27dd 100644 --- a/other/materials_designer/specific_examples/interface_2d_3d_graphene_silicon_dioxide.ipynb +++ b/other/materials_designer/specific_examples/interface_2d_3d_graphene_silicon_dioxide.ipynb @@ -338,8 +338,9 @@ "metadata": {}, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(interfaces)\n", "for idx, interface in enumerate(interfaces):\n", " download_content_to_file(interfaces, f\"interface_{idx}.json\")" ] diff --git a/other/materials_designer/specific_examples/interface_3d_3d_copper_cristobalite.ipynb b/other/materials_designer/specific_examples/interface_3d_3d_copper_cristobalite.ipynb index 11bc7eb3..9b8f630a 100644 --- a/other/materials_designer/specific_examples/interface_3d_3d_copper_cristobalite.ipynb +++ b/other/materials_designer/specific_examples/interface_3d_3d_copper_cristobalite.ipynb @@ -336,8 +336,9 @@ "metadata": {}, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(interfaces)\n", "for idx, interface in enumerate(interfaces):\n", " download_content_to_file(interface, f\"interface_{idx}.json\")" ] diff --git a/other/materials_designer/specific_examples/interface_bilayer_twisted_commensurate_lattices_molybdenum_disulfide.ipynb b/other/materials_designer/specific_examples/interface_bilayer_twisted_commensurate_lattices_molybdenum_disulfide.ipynb index 02406528..1bc47f0d 100644 --- a/other/materials_designer/specific_examples/interface_bilayer_twisted_commensurate_lattices_molybdenum_disulfide.ipynb +++ b/other/materials_designer/specific_examples/interface_bilayer_twisted_commensurate_lattices_molybdenum_disulfide.ipynb @@ -233,7 +233,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", + "\n", + "set_materials(interfaces)\n", "\n", "for idx, interface in enumerate(interfaces):\n", " download_content_to_file(interface, f\"twisted_interface_{idx}.json\")" diff --git a/other/materials_designer/specific_examples/interface_bilayer_twisted_nanoribbons_boron_nitride.ipynb b/other/materials_designer/specific_examples/interface_bilayer_twisted_nanoribbons_boron_nitride.ipynb index e4b1ec54..25ecc118 100644 --- a/other/materials_designer/specific_examples/interface_bilayer_twisted_nanoribbons_boron_nitride.ipynb +++ b/other/materials_designer/specific_examples/interface_bilayer_twisted_nanoribbons_boron_nitride.ipynb @@ -242,8 +242,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials([interface_a, interface_b])\n", "download_content_to_file(interface_a, \"twisted_bilayer_h-BN_A.json\")\n", "download_content_to_file(interface_b, \"twisted_bilayer_h-BN_B.json\")" ], diff --git a/other/materials_designer/specific_examples/optimization_interface_film_xy_position_graphene_nickel.ipynb b/other/materials_designer/specific_examples/optimization_interface_film_xy_position_graphene_nickel.ipynb index d48d4816..4eb71561 100644 --- a/other/materials_designer/specific_examples/optimization_interface_film_xy_position_graphene_nickel.ipynb +++ b/other/materials_designer/specific_examples/optimization_interface_film_xy_position_graphene_nickel.ipynb @@ -381,9 +381,9 @@ }, "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", - "# Save optimized material\n", + "set_materials(optimized_material)\n", "download_content_to_file(optimized_material, f\"{interface_material.name}_optimized_xy.json\")" ] } diff --git a/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb b/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb index 76e4409a..65614b21 100644 --- a/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb +++ b/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb @@ -38,7 +38,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "# Enable interactive selection of coordination threshold\n", "IS_COORDINATION_SELECTION_INTERACTIVE = False\n", @@ -53,6 +52,7 @@ "collapsed": false }, "id": "f704e7abe8fbe895", + "outputs": [], "execution_count": null }, { @@ -68,7 +68,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "import sys\n", "\n", @@ -84,6 +83,7 @@ "collapsed": false }, "id": "37904650f2478a1d", + "outputs": [], "execution_count": null }, { @@ -100,7 +100,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.standata.materials import Materials\n", "from mat3ra.made.material import Material\n", @@ -111,6 +110,7 @@ "collapsed": false }, "id": "6d48372afc12056e", + "outputs": [], "execution_count": null }, { @@ -125,7 +125,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.modify import rotate, filter_by_box, add_vacuum_sides\n", "from mat3ra.made.tools.build.slab import create_slab, SlabConfiguration\n", @@ -141,6 +140,7 @@ "collapsed": false }, "id": "f8431fd833f6ed", + "outputs": [], "execution_count": null }, { @@ -155,7 +155,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials\n", "\n", @@ -165,6 +164,7 @@ "collapsed": false }, "id": "76a4b4b6318d2549", + "outputs": [], "execution_count": null }, { @@ -179,7 +179,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.plot import plot_rdf\n", "\n", @@ -189,6 +188,7 @@ "collapsed": false }, "id": "bb206aac50a38bb6", + "outputs": [], "execution_count": null }, { @@ -204,7 +204,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.io import select_coordination_threshold\n", "from mat3ra.made.tools.build.passivation import get_unique_coordination_numbers, PassivationConfiguration\n", @@ -226,6 +225,7 @@ "collapsed": false }, "id": "7b80ee26896bbbfb", + "outputs": [], "execution_count": null }, { @@ -240,7 +240,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.passivation import CoordinationBasedPassivationBuilderParameters, CoordinationBasedPassivationBuilder, create_passivation\n", "params = CoordinationBasedPassivationBuilderParameters(\n", @@ -256,6 +255,7 @@ "collapsed": false }, "id": "398b2dedef23e0fc", + "outputs": [], "execution_count": null }, { @@ -270,7 +270,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "visualize_materials([{\"material\": passivated_nanowire}, {\"material\": passivated_nanowire, \"rotation\": \"-90x\"}])" ], @@ -278,6 +277,7 @@ "collapsed": false }, "id": "cb85e7e42c0944f2", + "outputs": [], "execution_count": null }, { @@ -291,17 +291,17 @@ "id": "5d7fa9201651fa72" }, { + "metadata": {}, "cell_type": "code", - "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", + "\n", "passivated_nanowire.name = \"H-Passivated Silicon Nanowire\"\n", + "set_materials(passivated_nanowire)\n", "download_content_to_file(passivated_nanowire, \"passivated_nanowire.json\")" ], - "metadata": { - "collapsed": false - }, - "id": "13f32826a5011952", + "id": "51a4fc8cbadfb526", + "outputs": [], "execution_count": null } ], diff --git a/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb b/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb index ba5795ac..71396289 100644 --- a/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb +++ b/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb @@ -37,7 +37,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "# Material selection\n", "MATERIAL_NAME = \"Silicon.*100.*reconstructed\" # Name (regex) of the material to import from Standata\n", @@ -68,6 +67,7 @@ "collapsed": false }, "id": "1fc2d9bcb4829e89", + "outputs": [], "execution_count": null }, { @@ -83,7 +83,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "import sys\n", "\n", @@ -99,6 +98,7 @@ "collapsed": false }, "id": "d1eb85a3125e3839", + "outputs": [], "execution_count": null }, { @@ -113,7 +113,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.material import Material\n", "from mat3ra.standata.materials import Materials\n", @@ -124,6 +123,7 @@ "collapsed": false }, "id": "f71a66a67f9ae8e6", + "outputs": [], "execution_count": null }, { @@ -139,7 +139,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials\n", "\n", @@ -152,6 +151,7 @@ "collapsed": false }, "id": "83efe492d92bf80c", + "outputs": [], "execution_count": null }, { @@ -166,7 +166,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "# Find coordinates of the Si atoms, list in descending order, and change the second one from the top\n", "si_atoms_coordinates = [coordinate for coordinate in slab.basis.coordinates.values]\n", @@ -188,6 +187,7 @@ "collapsed": false }, "id": "34c31166b0f9f262", + "outputs": [], "execution_count": null }, { @@ -202,7 +202,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "if SHOW_INTERMEDIATE_STEPS:\n", " print(\"Adjusted slab structure:\")\n", @@ -213,6 +212,7 @@ "collapsed": false }, "id": "93001473365fc768", + "outputs": [], "execution_count": null }, { @@ -228,7 +228,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.passivation import (\n", " PassivationConfiguration,\n", @@ -254,6 +253,7 @@ "collapsed": false }, "id": "ba90567da9d8c8c5", + "outputs": [], "execution_count": null }, { @@ -268,7 +268,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.passivation import create_passivation\n", "\n", @@ -284,6 +283,7 @@ "collapsed": false }, "id": "48b2f000227c92c7", + "outputs": [], "execution_count": null }, { @@ -298,7 +298,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "print(\"Final passivated structure:\")\n", "visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n", @@ -308,6 +307,7 @@ "collapsed": false }, "id": "4680f4f7906f6f2c", + "outputs": [], "execution_count": null }, { @@ -322,16 +322,17 @@ }, { "cell_type": "code", - "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", - "download_content_to_file(passivated_slab.to_json(), f\"{slab.name}_passivated.json\")" + "set_materials(passivated_slab)\n", + "download_content_to_file(passivated_slab, f\"{slab.name}_passivated.json\")" ], "metadata": { "collapsed": false }, "id": "b3c536f6ca85e403", + "outputs": [], "execution_count": null } ], diff --git a/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb b/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb index 2d685761..c44e3dba 100644 --- a/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb +++ b/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb @@ -302,8 +302,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(material_with_custom_perturbation)\n", "download_content_to_file(material_with_custom_perturbation, f\"{MATERIAL_NAME}_edge_perturbation.json\")" ], "metadata": { diff --git a/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb b/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb index f489cfa5..6b9df8fc 100644 --- a/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb +++ b/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb @@ -238,8 +238,9 @@ "cell_type": "code", "outputs": [], "source": [ - "from utils.jupyterlite import download_content_to_file\n", + "from utils.jupyterlite import download_content_to_file, set_materials\n", "\n", + "set_materials(slabs)\n", "for slab in slabs:\n", " download_content_to_file(slab, f\"{slab.name}.json\")" ],