diff --git a/other/materials_designer/create_point_defect.ipynb b/other/materials_designer/create_point_defect.ipynb index 38b6b801..f09fa057 100644 --- a/other/materials_designer/create_point_defect.ipynb +++ b/other/materials_designer/create_point_defect.ipynb @@ -39,40 +39,37 @@ { "cell_type": "code", "source": [ - "DEFECT_TYPE = \"substitution\" # (e.g. \"vacancy\", \"substitution\", \"interstitial\")\n", - "SITE_ID = None # Site index of the defect\n", - "COORDINATE = None # Position of the defect in crystal coordinates\n", - "APPROXIMATE_COORDINATE = None # Approximate coordinates of the defect in crystal coordinates\n", - "CHEMICAL_ELEMENT = \"C\" # Element to be placed at the site (ignored for vacancy)\n", - "\n", + "# Selected material will be used as a unit cell to create a supercell first.\n", "SUPERCELL_MATRIX = [[3, 0, 0], [0, 3, 0], [0, 0, 3]]\n", "\n", "# List of dictionaries with defect parameters\n", "DEFECT_CONFIGS = [\n", " {\n", - " \"defect_type\": DEFECT_TYPE,\n", - " \"approximate_coordinate\": [0.0, 0.0, 0.0],\n", - " \"chemical_element\": \"C\",\n", - " # \"site_id\": 0,\n", - " # \"coordinate\": None,\n", + " \"defect_type\": \"substitution\", # (e.g. \"vacancy\", \"substitution\", \"interstitial\")\n", + " \"chemical_element\": \"C\", # Substitution element\n", + " \"approximate_coordinate\": [0.0, 0.0, 0.0], # Approx. coord that will be resolved to the closest site\n", + " \"use_cartesian_coordinates\": True, # Use cartesian or crystal coordinates\n", " },\n", - " # Uncomment the following to create multiple defects\n", + "\n", + " # Uncomment the next lines to create more defects\n", " # {\n", - " # \"defect_type\": \"vacancy\",\n", - " # \"site_id\": 0,\n", + " # \"defect_type\": \"vacancy\", # Remove an atom at a specific site\n", + " # \"site_id\": 0, # Index of the atom in the host material\n", " # },\n", + " # {\n", + " # \"defect_type\": \"interstitial\", # Add an atom at an interstitial site\n", + " # \"coordinate\": [0.25, 0.25, 0.25], # Exact position\n", + " # \"use_cartesian_coordinates\": False, # Use cartesian or crystal coordinates\n", + " # \"chemical_element\": \"N\", # Add interstitial atom\n", + " # }\n", "]" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:42.339489Z", - "start_time": "2025-05-13T22:53:42.334226Z" - } + "collapsed": false }, "id": "9d8b1890b34d850a", "outputs": [], - "execution_count": 1 + "execution_count": null }, { "cell_type": "markdown", @@ -100,15 +97,11 @@ " await install_packages(\"create_point_defect.ipynb\")" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:42.360804Z", - "start_time": "2025-05-13T22:53:42.358355Z" - } + "collapsed": false }, "id": "ef664b14457530fd", "outputs": [], - "execution_count": 2 + "execution_count": null }, { "cell_type": "markdown", @@ -129,28 +122,11 @@ "materials = get_materials(globals())" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:43.047946Z", - "start_time": "2025-05-13T22:53:42.474580Z" - } + "collapsed": false }, "id": "be38fdda1984c654", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0: 0-Ni\n", - "1: 1-Graphene\n", - "2: C2(001)-Ni4(111), Interface\n", - "3: Ni4(001), termination Ni_P4:mmm_2, Slab\n", - "4: O8Zr4(011), termination O2_P2:m_1, Slab\n", - "Retrieved 5 materials.\n" - ] - } - ], - "execution_count": 3 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -173,30 +149,11 @@ "visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:45.847490Z", - "start_time": "2025-05-13T22:53:43.138551Z" - } + "collapsed": false }, "id": "e2d24109d3068c9e", - "outputs": [ - { - "data": { - "text/plain": [ - "GridBox(children=(VBox(children=(Label(value='Ni27 - Material - rotation: 0x', layout=Layout(align_self='cente…" - ], - "application/vnd.jupyter.widget-view+json": { - "version_major": 2, - "version_minor": 0, - "model_id": "cdc432e2a99c46af8bad06e72d376c4a" - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "execution_count": 4 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -220,15 +177,11 @@ "defect_builder_parameters = PointDefectBuilderParameters(center_defect=False)" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:45.909568Z", - "start_time": "2025-05-13T22:53:45.873079Z" - } + "collapsed": false }, "id": "e385e50ae11ed2b9", "outputs": [], - "execution_count": 5 + "execution_count": null }, { "cell_type": "markdown", @@ -245,33 +198,15 @@ "source": [ "from mat3ra.made.tools.build.defect import create_defects\n", "\n", - "material_with_defect = create_defects(builder_parameters=defect_builder_parameters, configurations=defect_configurations)" + "material_with_defect = create_defects(builder_parameters=defect_builder_parameters,\n", + " configurations=defect_configurations)" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:45.966908Z", - "start_time": "2025-05-13T22:53:45.916257Z" - } + "collapsed": false }, "id": "a990fa35742d7269", - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", - " warnings.warn(\n", - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['number']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", - " warnings.warn(\n", - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['equivalent_atoms']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", - " warnings.warn(\n", - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['wyckoffs']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", - " warnings.warn(\n" - ] - } - ], - "execution_count": 6 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -295,44 +230,11 @@ " {\"material\": material_with_defect, \"title\": f\"Material with defect\"}])" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:46.124855Z", - "start_time": "2025-05-13T22:53:45.980978Z" - } + "collapsed": false }, "id": "509b18661a069e42", - "outputs": [ - { - "data": { - "text/plain": [ - "GridBox(children=(VBox(children=(Label(value='Ni27 - Original material - rotation: -90x', layout=Layout(align_…" - ], - "application/vnd.jupyter.widget-view+json": { - "version_major": 2, - "version_minor": 0, - "model_id": "a8f71c9f02b54a9ab51c4e9e969e56a3" - } - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "GridBox(children=(VBox(children=(Label(value='Ni27 - Original material - rotation: 0x,0y,0z', layout=Layout(al…" - ], - "application/vnd.jupyter.widget-view+json": { - "version_major": 2, - "version_minor": 0, - "model_id": "3cd37b2b7bd646dd8922e0970a5bfe39" - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "execution_count": 7 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -352,23 +254,11 @@ "set_materials([material_with_defect])" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2025-05-13T22:53:46.138694Z", - "start_time": "2025-05-13T22:53:46.134037Z" - } + "collapsed": false }, "id": "61daa5afcbc078a9", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Data for materials written to uploads/Ni26 C1, Substitution C Defect.json\n" - ] - } - ], - "execution_count": 8 + "outputs": [], + "execution_count": null } ], "metadata": { diff --git a/other/materials_designer/create_point_defect_pair.ipynb b/other/materials_designer/create_point_defect_pair.ipynb index d451c7ca..8f96decd 100644 --- a/other/materials_designer/create_point_defect_pair.ipynb +++ b/other/materials_designer/create_point_defect_pair.ipynb @@ -38,16 +38,17 @@ }, { "cell_type": "code", - "outputs": [], "source": [ + "# Selected material will be used as a unit cell to create a supercell first.\n", "SUPERCELL_MATRIX = [[3, 0, 0], [0, 3, 0], [0, 0, 3]]\n", "\n", "# List of dictionaries with defect parameters\n", "PRIMARY_DEFECT_CONFIG = {\n", " \"defect_type\": \"vacancy\",\n", " \"approximate_coordinate\": [0.5, 0.5, 0.5],\n", - " # \"site_id\": 0,\n", - " # \"coordinate\": None,\n", + " \"use_cartesian_coordinates\": False, # Use cartesian or crystal coordinates\n", + " # \"site_id\": 0, # Index of the atom in the host material\n", + " # \"coordinate\": None, # Exact position (override the approximate coordinate)\n", "}\n", "\n", "SECONDARY_DEFECT_CONFIG = {\n", @@ -62,6 +63,7 @@ "collapsed": false }, "id": "9d8b1890b34d850a", + "outputs": [], "execution_count": null }, { @@ -77,7 +79,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "import sys\n", "\n", @@ -94,6 +95,7 @@ "collapsed": false }, "id": "ef664b14457530fd", + "outputs": [], "execution_count": null }, { @@ -109,7 +111,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.jupyterlite import get_materials\n", "\n", @@ -119,6 +120,7 @@ "collapsed": false }, "id": "be38fdda1984c654", + "outputs": [], "execution_count": null }, { @@ -133,7 +135,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", @@ -146,6 +147,7 @@ "collapsed": false }, "id": "e2d24109d3068c9e", + "outputs": [], "execution_count": null }, { @@ -161,7 +163,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", @@ -180,6 +181,7 @@ "collapsed": false }, "id": "e385e50ae11ed2b9", + "outputs": [], "execution_count": null }, { @@ -194,7 +196,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from mat3ra.made.tools.build.defect.builders import PointDefectPairBuilder\n", "\n", @@ -204,6 +205,7 @@ "collapsed": false }, "id": "a990fa35742d7269", + "outputs": [], "execution_count": null }, { @@ -218,7 +220,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.visualize import visualize_materials as visualize\n", "\n", @@ -232,6 +233,7 @@ "collapsed": false }, "id": "509b18661a069e42", + "outputs": [], "execution_count": null }, { @@ -246,7 +248,6 @@ }, { "cell_type": "code", - "outputs": [], "source": [ "from utils.jupyterlite import set_materials\n", "\n", @@ -256,6 +257,7 @@ "collapsed": false }, "id": "61daa5afcbc078a9", + "outputs": [], "execution_count": null } ],