From f77847bdfbcaddd9be53f0515a49844edded05b5 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Wed, 13 Nov 2024 22:56:39 -0800 Subject: [PATCH 1/2] update: add standata to common config --- config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config.yml b/config.yml index b7aae505..b99841b3 100644 --- a/config.yml +++ b/config.yml @@ -9,6 +9,7 @@ default: - pandas==1.5.3 - ase==3.22.1 - ipywidgets + - mat3ra-standata packages_python: - pymatgen==2024.4.13 packages_pyodide: From 0844748bc83c41b37f81b36ef0604547814007fe Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:22:23 -0800 Subject: [PATCH 2/2] update: import standata in speciic exmaples --- config.yml | 4 +++- .../defect_surface_adatom_graphene.ipynb | 19 +++++++++++-------- ...fect_surface_island_titanium_nitride.ipynb | 17 ++++++++++------- ...surate_lattices_molybdenum_disulfide.ipynb | 8 ++++---- ...er_twisted_nanoribbons_boron_nitride.ipynb | 5 ++--- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/config.yml b/config.yml index b99841b3..695919e7 100644 --- a/config.yml +++ b/config.yml @@ -9,7 +9,6 @@ default: - pandas==1.5.3 - ase==3.22.1 - ipywidgets - - mat3ra-standata packages_python: - pymatgen==2024.4.13 packages_pyodide: @@ -65,3 +64,6 @@ notebooks: packages_pyodide: - mat3ra-esse - mat3ra-made + - name: specific_examples + packages_common: + - mat3ra-standata 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 a19526ff..6be0a3a1 100644 --- a/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb +++ b/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb @@ -49,10 +49,10 @@ "DEFECT_TYPE = \"adatom\"\n", "PLACEMENT_METHOD = \"coordinate\"\n", "# Using crystal coordinates for the defect placement\n", - "USE_CARTESIAN_COORDINATES = False \n", - "HOLLOW_SITE_COORDINATE = [1/2, 1/2] # in crystal coordinates\n", - "BRIDGE_SITE_COORDINATE = [3/8, 1/2] # in crystal coordinates\n", - "TOP_SITE_COORDINATE = [7/12, 5/12] # in crystal coordinates\n", + "USE_CARTESIAN_COORDINATES = False\n", + "HOLLOW_SITE_COORDINATE = [1 / 2, 1 / 2] # in crystal coordinates\n", + "BRIDGE_SITE_COORDINATE = [3 / 8, 1 / 2] # in crystal coordinates\n", + "TOP_SITE_COORDINATE = [7 / 12, 5 / 12] # in crystal coordinates\n", "\n", "# Setting data according to Table 1 in the manuscript, distance_z is the `h` from the table.\n", "# Uncomment the lines to create the defect for the desired adatom.\n", @@ -100,7 +100,8 @@ " await micropip.install('mat3ra-api-examples', deps=False)\n", " from utils.jupyterlite import install_packages\n", "\n", - " await install_packages(\"create_point_defect.ipynb\", \"../../../config.yml\")" + " await install_packages(\"create_point_defect.ipynb\", \"../../../config.yml\")\n", + " await install_packages(\"specific_examples\", \"../../../config.yml\")" ], "metadata": { "collapsed": false @@ -174,7 +175,7 @@ "cell_type": "code", "outputs": [], "source": [ - "from mat3ra.made.tools.build.defect import AdatomSlabPointDefectConfiguration\n", + "from mat3ra.made.tools.build.defect import AdatomSlabPointDefectConfiguration\n", "from mat3ra.made.tools.build.defect.builders import PointDefectBuilderParameters\n", "\n", "configurations = [AdatomSlabPointDefectConfiguration(crystal=supercell,\n", @@ -236,7 +237,8 @@ "\n", "for material_with_defect in materials_with_adatom:\n", " title = f\"{material_with_defect.metadata['build']['configuration']['chemical_element']} adatom\"\n", - " visualize([{\"material\": material_with_defect, \"title\": title}, {\"material\": material_with_defect, \"title\":title, \"rotation\": \"-90x\"}])" + " visualize([{\"material\": material_with_defect, \"title\": title},\n", + " {\"material\": material_with_defect, \"title\": title, \"rotation\": \"-90x\"}])" ], "metadata": { "collapsed": false @@ -261,7 +263,8 @@ "from utils.jupyterlite import download_content_to_file\n", "\n", "for material_with_defect in materials_with_adatom:\n", - " download_content_to_file(material_with_defect.to_json(), f\"{material_with_defect.metadata['build']['configuration']['chemical_element']}_adatom.json\")" + " download_content_to_file(material_with_defect.to_json(),\n", + " f\"{material_with_defect.metadata['build']['configuration']['chemical_element']}_adatom.json\")" ], "metadata": { "collapsed": false 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 061bb53c..2f64dcd7 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 @@ -50,7 +50,7 @@ "\n", "# Create slab with default parameters if imported material is not a slab\n", "DEFAULT_SLAB_PARAMETERS = {\n", - " \"miller_indices\": (0,0,1),\n", + " \"miller_indices\": (0, 0, 1),\n", " \"thickness\": 3,\n", " \"vacuum\": 0.0,\n", " \"use_orthogonal_z\": True,\n", @@ -82,10 +82,12 @@ "\n", "if sys.platform == \"emscripten\":\n", " import micropip\n", + "\n", " await micropip.install('mat3ra-api-examples', deps=False)\n", - " await micropip.install('mat3ra-standata')\n", " from utils.jupyterlite import install_packages\n", - " await install_packages(\"\", \"../../../config.yml\")" + "\n", + " await install_packages(\"\", \"../../../config.yml\")\n", + " await install_packages(\"specific_examples\", \"../../../config.yml\")" ], "metadata": { "collapsed": false @@ -110,6 +112,7 @@ "source": [ "from mat3ra.made.material import Material\n", "from mat3ra.standata.materials import Materials\n", + "\n", "material = Material(Materials.get_by_name_first_match(\"TiN\"))" ], "metadata": { @@ -142,7 +145,7 @@ " bulk=material,\n", " miller_indices=DEFAULT_SLAB_PARAMETERS[\"miller_indices\"],\n", " thickness=DEFAULT_SLAB_PARAMETERS[\"thickness\"],\n", - " vacuum= DEFAULT_SLAB_PARAMETERS[\"vacuum\"],\n", + " vacuum=DEFAULT_SLAB_PARAMETERS[\"vacuum\"],\n", " use_orthogonal_z=DEFAULT_SLAB_PARAMETERS[\"use_orthogonal_z\"],\n", " xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n", " )\n", @@ -179,12 +182,11 @@ ")\n", "from mat3ra.made.tools.build.defect import IslandSlabDefectConfiguration\n", "\n", - "coordinate_condition= BoxCoordinateCondition(\n", + "coordinate_condition = BoxCoordinateCondition(\n", " min_coordinate=SHAPE_PARAMETERS['min_coordinate'],\n", " max_coordinate=SHAPE_PARAMETERS['max_coordinate']\n", ")\n", "\n", - "\n", "island_config = IslandSlabDefectConfiguration(\n", " crystal=slab,\n", " condition=coordinate_condition,\n", @@ -193,6 +195,7 @@ ")\n", "\n", "from mat3ra.made.tools.build.defect import IslandSlabDefectBuilder, SlabDefectBuilderParameters\n", + "\n", "params = SlabDefectBuilderParameters(\n", " auto_add_vacuum=AUTO_ADD_VACUUM,\n", " vacuum_thickness=VACUUM_THICKNESS,\n", @@ -243,7 +246,7 @@ "source": [ "visualize([{\"material\": slab, \"title\": \"Original material\"},\n", " {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\"}],\n", - "rotation=\"-90x\")\n", + " rotation=\"-90x\")\n", "\n", "visualize([{\"material\": slab, \"title\": \"Original material\"},\n", " {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\"}])" 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 70f6e174..3e93c140 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 @@ -86,9 +86,9 @@ " import micropip\n", "\n", " await micropip.install('mat3ra-api-examples', deps=False)\n", - " await micropip.install('mat3ra-standata')\n", " from utils.jupyterlite import install_packages\n", - " await install_packages(\"\", \"../../../config.yml\")" + "\n", + " await install_packages(\"specific_examples\", \"../../../config.yml\")" ], "metadata": { "collapsed": false @@ -150,7 +150,7 @@ " CommensurateLatticeTwistedInterfaceBuilder\n", "from mat3ra.made.tools.build.interface.configuration import TwistedInterfaceConfiguration\n", "\n", - "configs = [ TwistedInterfaceConfiguration(\n", + "configs = [TwistedInterfaceConfiguration(\n", " film=material,\n", " substrate=material,\n", " twist_angle=parameters[\"angle\"],\n", @@ -186,7 +186,7 @@ "cell_type": "code", "outputs": [], "source": [ - "interfaces= [ builder.get_material(config) for config in configs]" + "interfaces = [builder.get_material(config) for config in configs]" ], "metadata": { "collapsed": false 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 592be85f..39b0ff0b 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 @@ -57,7 +57,6 @@ "INTERFACE_DISTANCE = 3.23 # Distance between layers in Angstroms\n", "INTERFACE_VACUUM = 20.0 # Vacuum layer thickness in Angstroms\n", "\n", - "\n", "# Visualization settings\n", "SHOW_INTERMEDIATE_STEPS = True\n", "VISUALIZE_REPETITIONS = [1, 1, 1]" @@ -88,9 +87,9 @@ " import micropip\n", "\n", " await micropip.install('mat3ra-api-examples', deps=False)\n", - " await micropip.install('mat3ra-standata')\n", " from utils.jupyterlite import install_packages\n", - " await install_packages(\"\", \"../../../config.yml\")\n" + "\n", + " await install_packages(\"specific_examples\", \"../../../config.yml\")" ], "metadata": { "collapsed": false