diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a4d932fe..160d0e09 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
exclude: ^((examples|other)\/.*\/.*\.(py|poscar|csv))
repos:
- repo: https://github.com/Exabyte-io/pre-commit-hooks
- rev: 2023.6.28
+ rev: 2023.9.13
hooks:
- id: ruff
- id: black
@@ -13,3 +13,9 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
+ # to strip notebook outputs
+ - repo: https://github.com/kynan/nbstripout
+ rev: 0.7.1
+ hooks:
+ - id: nbstripout
+ files: ^other\/materials_designer\/.*\.ipynb$
diff --git a/README.ipynb b/README.ipynb
index d8268b2f..80fc3f9e 100644
--- a/README.ipynb
+++ b/README.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Mat3ra API Examples\n",
"\n",
@@ -115,11 +117,7 @@
"2. Jupyter.org, official website: [link](https://jupyter.org/)\n",
"3. Git Large File Storage, official website: [link](https://git-lfs.github.com/)\n",
"4. GitHub Standard Fork & Pull Request Workflow, online explanation: [link](https://gist.github.com/Chaser324/ce0505fbed06b947d962)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ca988675356058"
+ ]
}
],
"metadata": {
diff --git a/config.yml b/config.yml
index c407b873..8794d38e 100644
--- a/config.yml
+++ b/config.yml
@@ -31,7 +31,8 @@ default:
- uncertainties==3.1.6
- jinja2
- pymatgen-analysis-defects<=2024.4.23
- - mat3ra-made==2025.8.1.post1
+ - mat3ra-made==2025.8.9.post0
+# packages below are used when made is installed from GH wheel
# - mat3ra-code
# - mat3ra-esse
notebooks:
diff --git a/other/experiments/create_interface_with_relaxation_alignn.ipynb b/other/experiments/create_interface_with_relaxation_alignn.ipynb
index b1a3fb19..1b349581 100644
--- a/other/experiments/create_interface_with_relaxation_alignn.ipynb
+++ b/other/experiments/create_interface_with_relaxation_alignn.ipynb
@@ -142,8 +142,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "tags": [],
- "trusted": true
+ "tags": []
},
"outputs": [],
"source": [
@@ -605,9 +604,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## References\n",
"\n",
@@ -633,13 +630,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/experiments/create_interface_with_relaxation_ase_emt.ipynb b/other/experiments/create_interface_with_relaxation_ase_emt.ipynb
index 63df0389..b9054ad6 100644
--- a/other/experiments/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/experiments/create_interface_with_relaxation_ase_emt.ipynb
@@ -141,8 +141,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "tags": [],
- "trusted": true
+ "tags": []
},
"outputs": [],
"source": [
@@ -607,11 +606,9 @@
},
{
"cell_type": "code",
+ "metadata": {},
"outputs": [],
- "source": [],
- "metadata": {
- "collapsed": false
- }
+ "source": []
}
],
"metadata": {
@@ -631,13 +628,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/jarvis/run_job_using_material_from_jarvis_db.ipynb b/other/jarvis/run_job_using_material_from_jarvis_db.ipynb
index bd1153a3..c6a8f63d 100644
--- a/other/jarvis/run_job_using_material_from_jarvis_db.ipynb
+++ b/other/jarvis/run_job_using_material_from_jarvis_db.ipynb
@@ -2,53 +2,47 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"\n",
"
\n",
""
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3c567b6400249971"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## Install Packages\n",
"First, install `express-py` which includes `jarvis-tools` as dependency."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8b00ab6854f2263b"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "2",
+ "metadata": {},
"outputs": [],
"source": [
"!pip install express-py==2024.1.25.post7"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b1288bc79ee2c828"
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"## Get Materials Data From JARVIS\n",
"Then, let\"s get the dataset containing 2D materials from JARVIS and wrap it into a pandas dataframe."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f418c51a7f794f9f"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "4",
+ "metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
@@ -56,27 +50,27 @@
"\n",
"dft_2d = data(\"dft_2d\")\n",
"df = pd.DataFrame(dft_2d)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b1ee775d1476f884"
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"## Create a simple heterostructure\n",
"\n",
"We use two material ids and place them one above another."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9035ff20f1483b33"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "6",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"from jarvis.core.atoms import Atoms\n",
@@ -97,31 +91,29 @@
"heterostructure_atoms = interface_atoms_dict[\"interface\"].center_around_origin()\n",
"\n",
"print (jid1,jid2,atoms1.composition.reduced_formula,atoms2.composition.reduced_formula, heterostructure_atoms)"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "1b3e7d016f30b61"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "## Extract the film and substrate"
- ],
+ "id": "7",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
- "id": "4d59e226b39bbf41"
+ "source": [
+ "## Extract the film and substrate"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "8",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"# Using the fractional coordinate Z level of 0.5 to separate top/bottom\n",
@@ -147,29 +139,22 @@
" heterostructure_atoms_copy = heterostructure_atoms_copy.remove_site_by_index(ind - i)\n",
" print(\"removed\", ind, heterostructure_atoms_copy.props)\n",
"film_atoms = Atoms.from_dict(heterostructure_atoms_copy.to_dict())"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "c60f1cdeca83df6a"
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## Extract Structure and Convert to ESSE\n",
"Next, we extract an entry from the JARVIS dataset and convert it into ESSE format ready to be uploaded to Mat3ra.com."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "15fe5f9de299c935"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "10",
+ "metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -194,26 +179,26 @@
"\n",
"# To preview resulting JSON data\n",
"print(json.dumps(material_heterostructure, indent=4))"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c41fb68c6d25fe48"
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## Setup the API credentials\n",
"Finally, we can upload the material to Mat3ra.com using the REST API: follow the explanation in another example notebook [here](../../examples/material/create_material.ipynb). One can replace the content of the `CONFIG` variable with the JSON data above."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a4a48479c7ea090f"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "12",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"# @title Authorization Form\n",
@@ -236,31 +221,29 @@
" )\n",
"\n",
" !GIT_BRANCH=\"dev\"; export GIT_BRANCH; curl -s \"https://raw.githubusercontent.com/Exabyte-io/api-examples/${GIT_BRANCH}/scripts/env.sh\" | bash"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "5b2ae68afcacc16"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "## Initialize the API Endpoints"
- ],
+ "id": "13",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
- "id": "deac6f9f10d31b19"
+ "source": [
+ "## Initialize the API Endpoints"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "14",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"from utils.settings import ENDPOINT_ARGS, ACCOUNT_ID\n",
@@ -278,31 +261,29 @@
"material_endpoints = MaterialEndpoints(*ENDPOINT_ARGS)\n",
"property_endpoints = PropertiesEndpoints(*ENDPOINT_ARGS)\n",
"bank_workflow_endpoints = BankWorkflowEndpoints(*ENDPOINT_ARGS)"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "979e35d5e828f794"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "## Create Material in the platform"
- ],
+ "id": "15",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
- "id": "6ea47ba011947ad5"
+ "source": [
+ "## Create Material in the platform"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "16",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"material_heterostructure[\"name\"] = f\"Heterostructure - {jid1} with {jid2}\"\n",
@@ -313,61 +294,56 @@
"\n",
"material_substrate[\"name\"] = f\"Substrate - {jid2}\"\n",
"material_substrate_in_the_platform = material_endpoints.create(material_substrate)"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "84b4ae0786b716cc"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "## Create a workflow if it does not exist yet\n",
- "\n",
- "Here we utilize the id of the Valence Band bank workflow from \"curators\" account `kXJ9j9piJTddX9FHz` and import it if it does not exist in the account collection."
- ],
+ "id": "17",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
- "id": "ca5e8436bab6f5bd"
+ "source": [
+ "## Create a workflow if it does not exist yet\n",
+ "\n",
+ "Here we utilize the id of the Valence Band bank workflow from \"curators\" account `kXJ9j9piJTddX9FHz` and import it if it does not exist in the account collection."
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "outputs": [],
- "source": [
- "BANK_ID = \"kXJ9j9piJTddX9FHz\"\n",
- "workflow_in_the_platform = bank_workflow_endpoints.copy(BANK_ID, ACCOUNT_ID)"
- ],
+ "id": "18",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
- "id": "443484aaa75ac2ff"
+ "outputs": [],
+ "source": [
+ "BANK_ID = \"kXJ9j9piJTddX9FHz\"\n",
+ "workflow_in_the_platform = bank_workflow_endpoints.copy(BANK_ID, ACCOUNT_ID)"
+ ]
},
{
"cell_type": "markdown",
+ "id": "19",
+ "metadata": {},
"source": [
"## Create and Run a Job\n",
"\n",
"Create Job config"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "da418324b250a490"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "20",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"PPN = \"4\"\n",
@@ -393,108 +369,97 @@
" \"name\": f\"Valence Band - {material_heterostructure['name']}\",\n",
" \"compute\": compute,\n",
"}"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "b4354c90697ee8de"
+ ]
},
{
"cell_type": "markdown",
+ "id": "21",
+ "metadata": {},
"source": [
"Then create a job"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c907fce6c3a3f59e"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "outputs": [],
- "source": [
- "job = job_endpoints.create(config)"
- ],
+ "id": "22",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
- "id": "d6537b79de46978a"
+ "outputs": [],
+ "source": [
+ "job = job_endpoints.create(config)"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "then run it"
- ],
+ "id": "23",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
- "id": "f4b7b12d8cd5019e"
+ "source": [
+ "then run it"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "outputs": [],
- "source": [
- "job_endpoints.submit(job[\"_id\"])"
- ],
+ "id": "24",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
- "id": "cc878e6674215ecc"
+ "outputs": [],
+ "source": [
+ "job_endpoints.submit(job[\"_id\"])"
+ ]
},
{
"cell_type": "markdown",
+ "id": "25",
+ "metadata": {},
"source": [
"and wait for it to finish"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2ef0dfa179949972"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "outputs": [],
- "source": [
- "from utils.generic import wait_for_jobs_to_finish, get_property_by_subworkflow_and_unit_indicies\n",
- "job_id = job[\"_id\"]\n",
- "wait_for_jobs_to_finish(job_endpoints, [job_id])"
- ],
+ "id": "26",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
- "id": "436d477f7245ea02"
+ "outputs": [],
+ "source": [
+ "from utils.generic import wait_for_jobs_to_finish, get_property_by_subworkflow_and_unit_indicies\n",
+ "job_id = job[\"_id\"]\n",
+ "wait_for_jobs_to_finish(job_endpoints, [job_id])"
+ ]
},
{
"cell_type": "markdown",
+ "id": "27",
+ "metadata": {},
"source": [
"Then get job files:"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2a2cc84332f6d98b"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
+ "id": "28",
+ "metadata": {
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ },
"outputs": [],
"source": [
"files = job_endpoints.list_files(job_id)\n",
@@ -514,40 +479,30 @@
"\n",
"with open(output_file_metadata[\"name\"], \"w\") as file_descriptor:\n",
" file_descriptor.write(output_file)"
- ],
- "metadata": {
- "collapsed": false,
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "id": "3199c5b7ecf347ef"
+ ]
},
{
"cell_type": "markdown",
+ "id": "29",
+ "metadata": {},
"source": [
"and get job properties using the index of a subworkflow in workflow and the index of unit in subworkflow (0, 0) below"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d155c1096b7499f5"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "outputs": [],
- "source": [
- "pressure = get_property_by_subworkflow_and_unit_indicies(property_endpoints, \"pressure\", job, 0, 0)\n",
- "print(pressure[\"data\"][\"value\"])"
- ],
+ "id": "30",
"metadata": {
- "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
- "id": "651c91cebd378528"
+ "outputs": [],
+ "source": [
+ "pressure = get_property_by_subworkflow_and_unit_indicies(property_endpoints, \"pressure\", job, 0, 0)\n",
+ "print(pressure[\"data\"][\"value\"])"
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index 7dbb48ee..8ac1b87a 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -114,22 +114,20 @@
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
- "source": [],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
+ "source": []
}
],
"metadata": {
- "language_info": {
- "name": "python"
- },
"kernelspec": {
- "name": "python3",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
- "display_name": "Python 3 (ipykernel)"
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
}
},
"nbformat": 4,
diff --git a/other/materials_designer/create_adatom_defect.ipynb b/other/materials_designer/create_adatom_defect.ipynb
index 185cda2e..ebbce1ee 100644
--- a/other/materials_designer/create_adatom_defect.ipynb
+++ b/other/materials_designer/create_adatom_defect.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f2e1e795020d7b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Create adatom defects in a slab material\n",
"\n",
@@ -37,35 +35,36 @@
},
{
"cell_type": "markdown",
- "id": "5e43ff288847b784",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Index in the list of materials, to access as materials[MATERIAL_INDEX]\n",
"MATERIAL_INDEX = 0\n",
"ELEMENT = \"Si\" # Chemical element of the adatom\n",
+ "\n",
+ "# Dictionaries are validated and converted to AdatomDefectDict objects below\n",
"DEFECT_CONFIGS = [\n",
" {\n",
" \"type\": \"adatom\",\n",
- " \"coordinate\": [0.5, 0.5], # Crystal coordinates on the surface (x, y)\n",
+ " \"coordinate_2d\": [0.5, 0.5], # Crystal coordinates on the surface (x, y)\n",
" \"distance_z\": 1.0, # Method to place the adatom\n",
" \"element\": ELEMENT,\n",
" }\n",
"]\n",
"\n",
"\n",
- "PLACEMENT_METHOD = \"new_crystal_site\" # Method to place the adatom, e.g., \"NEW_CRYSTAL_SITE\", \"EQUIDISTANT\", \"EXACT_COORDINATE\"\n",
+ "PLACEMENT_METHOD = \"new_crystal_site\" # Method to place the adatom, e.g., \"new_crystal_site\", \"exact_coordinate\", \"equidistant\"\n",
"\n",
"\n",
"# Slab parameters\n",
@@ -74,25 +73,23 @@
"VACUUM = 5.0 # Vacuum thickness in Angstrom\n",
"XY_SUPERCELL_MATRIX = [[2, 0], [0, 2]] # Supercell matrix for the slab\n",
"TERMINATION_FORMULA = None # Stoichiometric formula of the slab termination to be used."
- ],
- "id": "42487847a9bdb6a5"
+ ]
},
{
"cell_type": "markdown",
- "id": "bb64de5ff32649f8",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -105,46 +102,45 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "id": "84be13304382106"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 1.3. Get input material",
- "id": "c7ca14890a9205db"
+ "id": "5",
+ "metadata": {},
+ "source": [
+ "### 1.3. Get input material"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "id": "540dc3a04b706af6"
+ ]
},
{
"cell_type": "markdown",
- "id": "a132fe0ef8bbf0d0",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Slab"
]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab, get_slab_terminations\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab, get_slab_terminations, select_slab_termination\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"material = materials[MATERIAL_INDEX]\n",
@@ -157,7 +153,7 @@
"\n",
"slab = create_slab(\n",
" crystal=material,\n",
- " termination=termination,\n",
+ " termination_top=termination,\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers=SLAB_THICKNESS,\n",
" vacuum=VACUUM,\n",
@@ -166,41 +162,64 @@
" use_conventional_cell=True\n",
")\n",
"visualize([{\"material\": slab, \"rotation\": \"0x\"}, {\"material\": slab, \"rotation\": \"-90x\"}], repetitions=[1, 1, 1])"
- ],
- "id": "426b290f92c6bc26"
+ ]
},
{
"cell_type": "markdown",
- "id": "b386c06587b2f843",
+ "id": "9",
"metadata": {},
"source": [
"## 2. Create the Defect"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "### 2.1. Validate defect dictionaries and prepare them"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
- "id": "a990fa35742d7269",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.adatom.helpers import create_multiple_adatom_defects\n",
+ "from mat3ra.made.tools.helpers import AdatomDefectDict\n",
+ "\n",
+ "defect_dicts = [AdatomDefectDict(**defect_dict) for defect_dict in DEFECT_CONFIGS]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.2. Create the adatom defect"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from mat3ra.made.tools.helpers import create_multiple_adatom_defects\n",
"\n",
"slab_with_adatom = create_multiple_adatom_defects(\n",
" slab=slab,\n",
- " defect_dicts=DEFECT_CONFIGS,\n",
+ " defect_dicts=defect_dicts,\n",
" placement_method=PLACEMENT_METHOD,\n",
")"
]
},
{
"cell_type": "markdown",
- "id": "462549d016073446",
- "metadata": {
- "collapsed": false
- },
+ "id": "14",
+ "metadata": {},
"source": [
"## 3. Visualize the Slab with Adatom"
]
@@ -208,7 +227,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "256b07fb2dd39ae2",
+ "id": "15",
"metadata": {},
"outputs": [],
"source": [
@@ -224,10 +243,8 @@
},
{
"cell_type": "markdown",
- "id": "d381df29a6bbdd82",
- "metadata": {
- "collapsed": false
- },
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
@@ -235,10 +252,8 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "61daa5afcbc078a9",
- "metadata": {
- "collapsed": false
- },
+ "id": "17",
+ "metadata": {},
"outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
diff --git a/other/materials_designer/create_cluster_custom_shape.ipynb b/other/materials_designer/create_cluster_custom_shape.ipynb
index 8ff2546f..0257e5ae 100644
--- a/other/materials_designer/create_cluster_custom_shape.ipynb
+++ b/other/materials_designer/create_cluster_custom_shape.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a cluster of custom shape from a bulk material\n",
"\n",
@@ -19,35 +21,31 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9adf37a8d2620dc4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -59,57 +57,49 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d9e6be14343d00a1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set up cluster parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "26066db067a41c93"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
- "RADIUS = 0.3 # in crystal units\n",
+ "RADIUS = 5.3 # in Angstroms\n",
"VACUUM = 10.0 # in Angstroms on each side\n",
"Z_ORIENTATION = (0, 0, 1) # Miller indices of the slab orientation along the z-axis for the cluster\n",
- "USE_CARTESIAN_COORDINATES = False\n",
+ "USE_CARTESIAN_COORDINATES = True\n",
"NAME = \"Icosahedron\" # Name of the cluster"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Set coordinates condition"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3aae932e71fa71a9"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"import numpy as np\n",
"from scipy.spatial import ConvexHull\n",
"from typing import List\n",
- "from mat3ra.made.tools.utils.coordinate import CoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import CoordinateCondition\n",
"\n",
"\n",
"class CustomCoordinateCondition(CoordinateCondition):\n",
@@ -135,111 +125,89 @@
"\n",
" \n",
"condition = CustomCoordinateCondition(radius=RADIUS)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8e382d5ab459e2d",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"## 2. Create the Target Material\n",
"### 2.1. Set the cluster configuration\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.nanoparticle.helpers import create_nanoparticle_from_material\n",
+ "from mat3ra.made.tools.helpers import create_nanoparticle_from_material\n",
"material = materials[0]\n",
"cluster = create_nanoparticle_from_material(material=material,condition=condition, orientation_z=Z_ORIENTATION, vacuum_padding=VACUUM, use_cartesian_coordinates=USE_CARTESIAN_COORDINATES)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8fbe260fa14db47a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize([{\"material\": cluster, \"title\": f\"Cluster\"},\n",
" {\"material\": cluster, \"title\": f\"Cluster\", \"rotation\": \"-90x\"}])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"cluster.name = f\"{materials[0].name} {NAME}\"\n",
"set_materials(cluster)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_cluster_specific_shape.ipynb b/other/materials_designer/create_cluster_specific_shape.ipynb
index 507c21b7..bd3f33dd 100644
--- a/other/materials_designer/create_cluster_specific_shape.ipynb
+++ b/other/materials_designer/create_cluster_specific_shape.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a nanocluster with a specific shape.\n",
"\n",
@@ -19,35 +21,31 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9adf37a8d2620dc4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -59,144 +57,118 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d9e6be14343d00a1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set up cluster parameters\n",
"Parameters for the cuboctahedron and icosahedron shapes can be found at [ASE Clusters](https://wiki.fysik.dtu.dk/ase/ase/cluster/cluster.html#ase.cluster.Cluster)."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "26066db067a41c93"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.nanoparticle.enums import NanoparticleShapesEnum\n",
+ "from mat3ra.made.tools.build.pristine_structures.zero_dimensional.nanoparticle import NanoparticleShapesEnum\n",
"\n",
"shape = NanoparticleShapesEnum.OCTAHEDRON\n",
"parameters = {\n",
" \"length\": 5,\n",
" \"cutoff\": 2\n",
"}"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"## 2. Create the Target Material\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.nanoparticle.helpers import create_nanoparticle_by_shape\n",
+ "from mat3ra.made.tools.helpers import create_nanoparticle_by_shape\n",
"\n",
"cluster = create_nanoparticle_by_shape(\n",
" crystal=materials[0],\n",
" shape=shape,\n",
" parameters=parameters\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a990fa35742d7269",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"visualize_materials([{\"material\": cluster}, {\"material\": cluster, \"rotation\": \"-90x\"}],viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"cluster.name = f\"{materials[0].name} {shape.name.capitalize()} cluster\"\n",
"set_materials(cluster)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_cluster_sphere.ipynb b/other/materials_designer/create_cluster_sphere.ipynb
index a414ae11..8aef80aa 100644
--- a/other/materials_designer/create_cluster_sphere.ipynb
+++ b/other/materials_designer/create_cluster_sphere.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a cluster from a bulk material\n",
"\n",
@@ -19,50 +21,44 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up cluster parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"RADIUS = 4.5 # in Angstroms\n",
"VACUUM = 10.0 # in Angstroms on each side\n",
"Z_ORIENTATION = (0, 0, 1) # Miller indices of the slab orientation along the z-axis for the cluster"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bb64de5ff32649f8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -74,54 +70,46 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ef664b14457530fd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create a slab of sufficient size"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"# Create analyzer to get terminations\n",
@@ -133,7 +121,7 @@
"\n",
"slab = create_slab(\n",
" crystal=materials[0],\n",
- " termination=termination,\n",
+ " termination_top=termination,\n",
" miller_indices=Z_ORIENTATION,\n",
" number_of_layers=1,\n",
" vacuum=0,\n",
@@ -148,53 +136,45 @@
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}])\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7fcb1e02e84c5f35",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create the Target Material\n",
"### 2.1. Create spherical cluster\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import filter_by_sphere, add_vacuum, add_vacuum_sides\n",
"\n",
"cluster = filter_by_sphere(material=slab, center_coordinate=[0.5, 0.5, 0.5], radius=RADIUS)\n",
"cluster = add_vacuum(cluster, VACUUM, to_bottom=True, on_top=True)\n",
"cluster = add_vacuum_sides(cluster, VACUUM, on_x=True, on_y=True)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a990fa35742d7269",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.2. Set lattice to Cubic"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a01018588e6e55fc"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.lattice import Lattice\n",
"\n",
@@ -203,64 +183,50 @@
"cubic_vector_2 = [0, current_vector_2[1], 0]\n",
"cubic_vector_3 = [0, 0, current_vector_3[2]]\n",
"cluster.lattice = Lattice.from_vectors_array([cubic_vector_1, cubic_vector_2, cubic_vector_3], type=\"CUB\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4f78c4743b370c3b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": cluster, \"title\": f\"Cluster\"}])\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": cluster, \"title\": f\"Cluster\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"cluster.name = f\"{materials[0].name} Cluster R={RADIUS}A\"\n",
"set_materials(cluster)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_cutout_box.ipynb b/other/materials_designer/create_cutout_box.ipynb
index 2304507b..66b2fc5f 100644
--- a/other/materials_designer/create_cutout_box.ipynb
+++ b/other/materials_designer/create_cutout_box.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create slab with box cutout\n",
"\n",
@@ -19,28 +21,26 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up cluster parameters\n",
"Min and Max coordinates correspond to opposite vertices of the parallelogram.\n",
"\n",
"
"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Box cutout parameters\n",
"MIN_COORDINATE = [0.25, 0.25, 0.5]\n",
@@ -55,27 +55,23 @@
" \"use_orthogonal_c\": True,\n",
" \"xy_supercell_matrix\": [[10, 0], [0, 10]]\n",
"}"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bb64de5ff32649f8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -87,52 +83,44 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ef664b14457530fd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create a slab if the input material is not a slab"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"# Create analyzer to get terminations\n",
"slab = create_slab(\n",
@@ -143,52 +131,44 @@
" use_orthogonal_c=DEFAULT_SLAB_PARAMETERS[\"use_orthogonal_c\"],\n",
" xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bfce9928ba2d0c7e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 1.5. Visualize the slab"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "580036d8d11b8bed"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}])\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7fcb1e02e84c5f35",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 2. Create the Target Material\n",
"### 2.1. Create a cutout"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import filter_by_box\n",
"\n",
@@ -199,64 +179,50 @@
" invert_selection=True,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a990fa35742d7269",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_box_cutout, \"title\": f\"Cluster\"}])\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_box_cutout, \"title\": f\"Cluster\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"slab_with_box_cutout.name += \" with box cutout\"\n",
"set_materials(slab_with_box_cutout)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_cutout_custom_shape.ipynb b/other/materials_designer/create_cutout_custom_shape.ipynb
index bf514e52..c49acc3b 100644
--- a/other/materials_designer/create_cutout_custom_shape.ipynb
+++ b/other/materials_designer/create_cutout_custom_shape.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a custom-shape cutout\n",
"\n",
@@ -20,26 +22,24 @@
"\n",
"## Resulting structure:\n",
"
"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "98aa134f51746218"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -51,26 +51,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "280f9794a876678b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Set up structure parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b3d4d3ea7b589f89"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Slab parameters\n",
"MILLER_INDICES = (0, 0, 1)\n",
@@ -87,30 +83,26 @@
"CAVITY_TOP_Z = 0.5\n",
"\n",
"NAME = \"Custom Shape - Etching Pattern\""
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5177e239254e3601",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Create a condition on coordinates\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "361c291aaf3feb2a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from typing import List\n",
"\n",
- "from mat3ra.made.tools.utils.coordinate import CoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import CoordinateCondition\n",
"\n",
"\n",
"# Example of a custom coordinate condition. Adapt coordinate conditions to your needs.\n",
@@ -169,84 +161,72 @@
" right_wall_position=RIGHT_WALL_POSITION,\n",
" left_channel_position=LEFT_CHANNEL_POSITION,\n",
" right_channel_position=RIGHT_CHANNEL_POSITION,\n",
- " channel_depth=CHANNEL_TOP_Z,\n",
- " cavity_depth=CAVITY_TOP_Z,\n",
+ " channel_top_z=CHANNEL_TOP_Z,\n",
+ " cavity_top_z=CAVITY_TOP_Z,\n",
").condition"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "56c8227695643174",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "91724db55eddad60"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ceebf2a5229da67c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "13964644436b4156"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize(material, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(material, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "45f0c424ece00186",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 2. Create target material\n",
"### 2.1. Create a slab and apply the cutout condition"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "615800437b2ef7a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import filter_by_condition_on_coordinates, add_vacuum\n",
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"# Create analyzer to get terminations\n",
"analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material, miller_indices=MILLER_INDICES)\n",
@@ -257,7 +237,7 @@
"\n",
"slab_unit_cell = create_slab(\n",
" crystal=material,\n",
- " termination=termination,\n",
+ " termination_top=termination,\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers=THICKNESS,\n",
" vacuum=VACUUM,\n",
@@ -265,62 +245,48 @@
")\n",
"resulting_material = filter_by_condition_on_coordinates(slab_unit_cell, condition)\n",
"resulting_material = add_vacuum(resulting_material, VACUUM)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "422815d29aa347a1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "57cc38ec0df3c1f7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(resulting_material, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(resulting_material, repetitions=[1, 1, 1], rotation=\"-90x\")\n",
"visualize(resulting_material, repetitions=[1, 1, 1], rotation=\"-90x,-90y\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2a9627cd4a261067",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c67e6f5363e80942"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"resulting_material.name = NAME\n",
"set_materials(resulting_material)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cbee60d4b936e5cb",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_grain_boundary_crystal.ipynb b/other/materials_designer/create_grain_boundary_crystal.ipynb
index 2487443c..218d5917 100644
--- a/other/materials_designer/create_grain_boundary_crystal.ipynb
+++ b/other/materials_designer/create_grain_boundary_crystal.ipynb
@@ -2,14 +2,14 @@
"cells": [
{
"cell_type": "markdown",
- "source": [],
- "metadata": {
- "collapsed": false
- },
- "id": "ba979b741d79bad2"
+ "id": "0",
+ "metadata": {},
+ "source": []
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"# Create a Grain Boundary with Strain Matching\n",
"\n",
@@ -35,27 +35,25 @@
"1. We perform strain matching on the slabs to extract the supercell dimensions.\n",
"2. When the strain matching is finished, the grain boundary with the lowest strain (and reasonable number of atoms) is selected.\n",
"3. For more information about grain boundaries, see the Introduction notebook.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "64cac14fa1273938"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
"\n",
"Set the following flags to control the notebook behavior "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "31ef78017669ea95"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Parameters for Phase 1\n",
"PHASE_1_MILLER_INDICES = (1, 1, 1)\n",
@@ -77,27 +75,23 @@
"\n",
"# index of the grain boundary to select after strain matching\n",
"MATCH_ID = 0 # if None, the grain boundary with the lowest strain will be selected"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "38eac66e44951f88",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "63f9747e4a43c49d"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -109,80 +103,68 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"create_grain_boundary.ipynb\")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "26c1a6af762eda56",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1e2caebbe15a0e06"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c269a9fe44c400be",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 1.4. Preview Material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "91b2b7a5a2996487"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([material], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4fb3d10f24145759",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"## 2. Configure slabs and select termination pair\n",
"\n",
"### 2.1. Create Phase 1 and Phase 2 Slabs\n",
"Get the terminations for the two slabs of phases."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ed7b0a774220a297"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"phase_1_terminations = get_slab_terminations(\n",
" material=material,\n",
@@ -193,32 +175,29 @@
" material=material,\n",
" miller_indices=PHASE_2_MILLER_INDICES,\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "70ce21f35a487b63",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.3. Visualize slabs for all possible terminations",
- "id": "d233c1437eb21960"
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.3. Visualize slabs for all possible terminations"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
- "phase_1_slabs = [create_slab(material, miller_indices=PHASE_1_MILLER_INDICES, termination=termination) for termination in\n",
+ "phase_1_slabs = [create_slab(material, miller_indices=PHASE_1_MILLER_INDICES, termination_top=termination) for termination in\n",
" phase_1_terminations]\n",
"\n",
- "phase_2_slabs = [create_slab(material, miller_indices=PHASE_2_MILLER_INDICES, termination=termination) for termination in\n",
+ "phase_2_slabs = [create_slab(material, miller_indices=PHASE_2_MILLER_INDICES, termination_top=termination) for termination in\n",
" phase_2_terminations]\n",
"\n",
"phase_1_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in\n",
@@ -228,41 +207,44 @@
"\n",
"visualize(phase_1_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(phase_2_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "id": "cd8e53c68e1c7569",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.4. Select terminations for the grain boundary phases",
- "id": "5fd99a07e51380b0"
+ "id": "14",
+ "metadata": {},
+ "source": [
+ "### 2.4. Select terminations for the grain boundary phases"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import select_slab_termination\n",
"phase_1_selected_termination = select_slab_termination(phase_1_terminations, PHASE_1_TERMINATION_FORMULA)\n",
"phase_2_selected_termination = select_slab_termination(phase_2_terminations, PHASE_2_TERMINATION_FORMULA)"
- ],
- "id": "9109ac095608d82a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 3. Create grain boundary",
- "metadata": {
- "collapsed": false
- },
- "id": "20186205803e07d9"
+ "id": "16",
+ "metadata": {},
+ "source": [
+ "## 3. Create grain boundary"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.grain_boundary.helpers import create_grain_boundary_planar\n",
+ "from mat3ra.made.tools.helpers import create_grain_boundary_planar\n",
"\n",
"grain_boundary = create_grain_boundary_planar(\n",
" phase_1_material=material,\n",
@@ -276,60 +258,46 @@
" max_area_ratio_tol=0.2,\n",
" match_id =MATCH_ID,\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e9977c17f97f0035",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "18",
+ "metadata": {},
"source": [
"## 4. Preview the grain boundary"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aa55348911eb6679"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "19",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([grain_boundary], repetitions=[1, 1, 1])\n",
"visualize([grain_boundary], repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "abd081a986bdca0",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "20",
+ "metadata": {},
"source": [
"## 5. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bde2ea26c96543f5"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "21",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(grain_boundary)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "76469e88bd21a25d",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_grain_boundary_film.ipynb b/other/materials_designer/create_grain_boundary_film.ipynb
index 037ea924..ccba448b 100644
--- a/other/materials_designer/create_grain_boundary_film.ipynb
+++ b/other/materials_designer/create_grain_boundary_film.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a 2D Surface Grain Boundary in a film\n",
"\n",
@@ -23,14 +25,12 @@
"2. The two orientations are placed next to each other in the x-direction with a gap in between.\n",
"1. Atoms on the edge of the left orientation are handled to overlap with the right orientation in the interfacial region.\n",
"1. For more information, see the [Introduction](Introduction.ipynb) notebook.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "415ed707e27a6c8e"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
@@ -40,14 +40,14 @@
"For example of Graphene at 17.9 degrees: orange and green atoms are present with the value of 0.5 Angstroms, with value of 0, they will not be included.\n",
"\n",
"
\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a080006df3785cc5"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"MATERIAL_INDEX = 0 # Index in the list of materials\n",
@@ -76,27 +76,23 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [3, 3, 1]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "338ee3c51155e086",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6463f9bbcd3be7c7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -108,51 +104,43 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7e22d1f4da825575",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4a1cfe15caa44c3e"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a1635c31132962f6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"## 2. Prepare Material\n",
"### 2.1. Select and visualize initial material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "32b3ad775543b06f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
@@ -160,27 +148,25 @@
"\n",
"if SHOW_INTERMEDIATE_STEPS:\n",
" visualize_materials(material, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61f0870d8104cd21",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 3. Generate Surface Grain Boundary\n",
- "metadata": {
- "collapsed": false
- },
- "id": "34d6c7a337f1e40b"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 3. Generate Surface Grain Boundary\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.esse.models.core.reusable.axis_enum import AxisEnum\n",
- "from mat3ra.made.tools.build.grain_boundary import create_grain_boundary_linear\n",
+ "from mat3ra.made.tools.helpers import create_grain_boundary_linear\n",
"\n",
"\n",
"grain_boundary = create_grain_boundary_linear(\n",
@@ -193,24 +179,22 @@
" miller_indices=MILLER_INDICES,\n",
" vacuum=VACUUM\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "33a2c8a9be436745",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 4. Preview grain boundary",
- "metadata": {
- "collapsed": false
- },
- "id": "8b2f0574a20089a5"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "## 4. Preview grain boundary"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"actual_angle = grain_boundary.metadata.build[-1].configuration.get(\"actual_angle\")\n",
"print(actual_angle)\n",
@@ -220,37 +204,27 @@
"\n",
"visualize_materials(grain_boundary, repetitions=[1, 1, 1])\n",
"visualize_materials(grain_boundary, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7f558a8e9d417cef",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"### 5. Pass data to the outside runtime\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "afcc004c5878b56f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(grain_boundary)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "20e46167358d63",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_heterostructure_example.ipynb b/other/materials_designer/create_heterostructure_example.ipynb
index e6bb0b7d..4d549967 100644
--- a/other/materials_designer/create_heterostructure_example.ipynb
+++ b/other/materials_designer/create_heterostructure_example.ipynb
@@ -2,28 +2,35 @@
"cells": [
{
"cell_type": "markdown",
- "id": "ad0a4601cb4095ad",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
- "# Create Heterostructure Example with Three Materials\n",
+ "# Create Heterostructure Example (Simplified)\n",
+ "\n",
+ "This notebook demonstrates how to create a heterostructure with any number of materials using the **new simplified `create_heterostructure` function**.\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",
+ "This approach replaces the complex multi-step interface creation with a single function call that automatically handles strain matching and layer stacking.\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",
+ "2. **Configure structure parameters for any number of materials**\n",
+ "3. **Import materials from Standata or user uploads**\n",
+ "4. **Create heterostructure with a single function call**\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",
+ "1. **Prepare the Environment:** Set up the notebook and install packages\n",
+ "2. **Configure Materials:** Define parameters for each layer in the stack\n",
+ "3. **Create Stack:** Use simplified `create_heterostructure()` function\n",
+ "4. **Visualize:** Preview the resulting heterostructure\n",
+ "5. **Pass to Runtime:** Pass the final heterostructure to the external runtime\n",
+ "\n",
+ "## Key Improvements:\n",
+ "- **Simplified Configuration**: Replace complex multi-step setup with simple parameter lists\n",
+ "- **Single Function Call**: Use `create_heterostructure()` instead of manual interface creation\n",
+ "- **Automatic Optimization**: Built-in strain matching and supercell optimization\n",
+ "- **Flexible Stacking**: Supports any number of materials in the stack\n",
"\n",
"## Notes\n",
"\n",
@@ -34,758 +41,278 @@
},
{
"cell_type": "markdown",
- "id": "a0b4736f3dffa189",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
- "## 1. Prepare the Environment\n",
- "### 1.1. Set up the Notebook\n",
+ "## 1. Configuration Parameters\n",
"\n",
- "Set the following flags to control the notebook behavior.\n"
+ "Configure the heterostructure parameters including materials, layer thicknesses, and gaps.\n"
]
},
{
"cell_type": "code",
- "id": "9e90252bcef065c9",
- "metadata": {
- "collapsed": false
- },
- "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_C = 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_C = 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_C = True\n",
- "\n",
- "# Set termination pair indices for both interfaces\n",
- "TERMINATION_PAIR_INDEX_01 = 0\n",
- "TERMINATION_PAIR_INDEX_12 = 0\n"
- ],
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "from types import SimpleNamespace\n",
+ "\n",
+ "# Structure parameters for each layer - add or remove layers as needed\n",
+ "STRUCTURE_PARAMS = [\n",
+ " SimpleNamespace(\n",
+ " # First material (substrate)\n",
+ " name=\"Silicon\", # Material name from Standata or upload\n",
+ " slab_params=SimpleNamespace(\n",
+ " miller_indices=(0, 0, 1),\n",
+ " thickness=3, # atomic layers\n",
+ " xy_supercell_matrix=[[1, 0], [0, 1]],\n",
+ " ),\n",
+ " termination_formula=None, # Use default termination\n",
+ " ),\n",
+ " SimpleNamespace(\n",
+ " # Second material\n",
+ " name=\"SiO2\", # Material name from Standata or upload \n",
+ " slab_params=SimpleNamespace(\n",
+ " miller_indices=(1, 1, 1),\n",
+ " thickness=3, # atomic layers\n",
+ " ),\n",
+ " termination_formula=None, # Use default termination\n",
+ " ),\n",
+ " SimpleNamespace(\n",
+ " # Third material\n",
+ " name=\"HfO2.*MCL\", # Material name from Standata or upload\n",
+ " slab_params=SimpleNamespace(\n",
+ " miller_indices=(0, 0, 1), \n",
+ " thickness=1, # atomic layers\n",
+ " ),\n",
+ " termination_formula=None, # Use default termination\n",
+ " ),\n",
+ " # Add more materials here as needed...\n",
+ "]\n",
+ "\n",
+ "# Gap distances between layers (in Angstroms)\n",
+ "# Length should be one less than number of materials\n",
+ "GAPS = [3.0, 3.0] # Gaps between materials\n",
+ "\n",
+ "# Final vacuum above the heterostructure (in Angstroms)\n",
+ "VACUUM = 20.0\n"
+ ]
},
{
"cell_type": "markdown",
- "id": "e460756f40327e78",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
- "### 1.2. Install Packages\n",
+ "## 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"
]
},
{
"cell_type": "code",
- "id": "a4d99b5b40274810",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
"if sys.platform == \"emscripten\":\n",
" import micropip\n",
+ "\n",
" await micropip.install(\"mat3ra-api-examples\", deps=False)\n",
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
- " await install_packages(\"create_interface_with_min_strain_zsl.ipynb\")\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "c4b29abaa6160a66",
- "metadata": {
- "collapsed": false
- },
- "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"
+ " await install_packages(\"specific_examples\")\n"
]
},
- {
- "cell_type": "code",
- "id": "e90d5bf2655f5e0f",
- "metadata": {
- "collapsed": false
- },
- "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"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "1ffc1f88eedbc9a4",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
- "### 1.4. Preview Original Materials\n",
+ "## 3. Get Input Materials\n",
"\n",
- "Visualize the three original materials.\n"
+ "Materials are loaded from Standata using the names specified in `STRUCTURE_PARAMS` or from user uploads via `get_materials()`.\n"
]
},
{
"cell_type": "code",
- "id": "6253034909a0fef9",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from utils.visualize import visualize_materials as visualize\n",
- "\n",
- "visualize([material0, material1, material2], repetitions=[3, 3, 1], rotation=\"0x\")\n"
- ],
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "574327eaccdd52f0",
- "metadata": {
- "collapsed": false
- },
"source": [
- "## 2. Create First Interface (Material 0 + Material 1)\n",
- "\n",
- "### 2.1. Configure Slabs and Select Termination Pair\n",
+ "from mat3ra.standata.materials import Materials\n",
+ "from mat3ra.made.tools.build import MaterialWithBuildMetadata\n",
+ "from utils.jupyterlite import get_materials\n",
"\n",
- "Set up slab configurations for **Material 0** and **Material 1**, then select terminations for the first interface.\n"
+ "# Try to get materials from Standata first, then fallback to uploads\n",
+ "crystals = []\n",
+ "uploaded_materials = get_materials(globals()) if get_materials else []\n",
+ "\n",
+ "for i, structure_param in enumerate(STRUCTURE_PARAMS):\n",
+ " try:\n",
+ " # Try to get from Standata\n",
+ " standata_material = Materials.get_by_name_first_match(structure_param.name)\n",
+ " crystal = MaterialWithBuildMetadata.create(standata_material)\n",
+ " print(f\"Found '{structure_param.name}' in Standata\")\n",
+ " except:\n",
+ " # Fallback to uploaded materials\n",
+ " if i < len(uploaded_materials):\n",
+ " crystal = MaterialWithBuildMetadata.create(uploaded_materials[i])\n",
+ " print(f\"Using uploaded material {i} for '{structure_param.name}'\")\n",
+ " else:\n",
+ " # Use first uploaded material as fallback\n",
+ " crystal = MaterialWithBuildMetadata.create(uploaded_materials[0] if uploaded_materials else Materials.get_by_name_first_match(\"Silicon\"))\n",
+ " print(f\"Using fallback material for '{structure_param.name}'\")\n",
+ " \n",
+ " crystals.append(crystal)\n"
]
},
- {
- "cell_type": "code",
- "id": "de4fe773ee9c8a61",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "\n",
- "# Slab Configuration for Material 1 (Film) - using correct parameters like ZSL notebook\n",
- "material1_slab_configuration = SlabConfiguration.from_parameters(\n",
- " material_or_dict=material1,\n",
- " miller_indices=MATERIAL_1_MILLER_INDICES,\n",
- " number_of_layers=MATERIAL_1_THICKNESS, # in atomic layers\n",
- " vacuum=MATERIAL_1_VACUUM, # in Angstroms\n",
- " termination_formula=None, # if None, the first termination will be used\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "# Slab Configuration for Material 0 (Substrate) - using correct parameters like ZSL notebook\n",
- "material0_slab_configuration = SlabConfiguration.from_parameters(\n",
- " material_or_dict=material0,\n",
- " miller_indices=MATERIAL_0_MILLER_INDICES,\n",
- " number_of_layers=MATERIAL_0_THICKNESS, # in atomic layers\n",
- " vacuum=MATERIAL_0_VACUUM, # in Angstroms\n",
- " termination_formula=None, # if None, the first termination will be used\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "# Get possible terminations for the slabs\n",
- "material1_slab_terminations = get_slab_terminations(material=material1, miller_indices=MATERIAL_1_MILLER_INDICES)\n",
- "material0_slab_terminations = get_slab_terminations(material=material0, miller_indices=MATERIAL_0_MILLER_INDICES)\n",
- "\n",
- "# Visualize all possible terminations using analyzer approach\n",
- "from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
- "\n",
- "material1_analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material1, miller_indices=MATERIAL_1_MILLER_INDICES)\n",
- "material1_slabs = [material1_analyzer.get_material_with_termination_without_vacuum(termination) for termination in material1_slab_terminations]\n",
- "\n",
- "material0_analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material0, miller_indices=MATERIAL_0_MILLER_INDICES)\n",
- "material0_slabs = [material0_analyzer.get_material_with_termination_without_vacuum(termination) for termination in material0_slab_terminations]\n",
- "\n",
- "material1_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in zip(material1_slabs, material1_slab_terminations)]\n",
- "material0_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in zip(material0_slabs, material0_slab_terminations)]\n",
- "\n",
- "visualize(material1_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
- "visualize(material0_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "e4aea26afab84e0c",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
- "### 2.2. Print and Select Termination Pair for First Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "4e467693b61f0125",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from itertools import product\n",
+ "## 4. Preview Original Materials\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"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "e70e2a4ef133c9f",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 2.3. Select Termination Pair for First Interface\n"
+ "Visualize the loaded materials before creating the heterostructure.\n"
]
},
{
"cell_type": "code",
- "id": "c99cb2e5bbcd24df",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
- "from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n",
- "\n",
- "# Select terminations for each material using the newer approach\n",
- "material1_termination = select_slab_termination(material1_slab_terminations, None) # None means use first termination\n",
- "material0_termination = select_slab_termination(material0_slab_terminations, None) # None means use first termination\n",
- "\n",
- "# Create termination pair\n",
- "termination_pair_first = (material1_termination, material0_termination)\n",
- "\n",
- "# Allow for interactive selection if enabled\n",
- "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n",
- " termination_pair_index_01 = TERMINATION_PAIR_INDEX_01\n",
- " termination_pair_first = termination_pairs_01[termination_pair_index_01]\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"
- ],
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "7621d2178a91c691",
- "metadata": {
- "collapsed": false
- },
"source": [
- "### 2.4. Initialize Interface Configuration for First Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "9e87ca9779cee593",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
- "\n",
- "# Create actual slabs using the newer approach\n",
- "material1_termination, material0_termination = termination_pair_first\n",
- "\n",
- "# Update configurations with selected terminations - using correct parameters like ZSL notebook\n",
- "material1_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=material1,\n",
- " miller_indices=MATERIAL_1_MILLER_INDICES,\n",
- " number_of_layers=MATERIAL_1_THICKNESS,\n",
- " vacuum=0.0, # Set vacuum to 0 for interface creation\n",
- " termination_formula=None, # Will use selected termination\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "material0_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=material0,\n",
- " miller_indices=MATERIAL_0_MILLER_INDICES,\n",
- " number_of_layers=MATERIAL_0_THICKNESS,\n",
- " vacuum=0.0, # Set vacuum to 0 for interface creation\n",
- " termination_formula=None, # Will use selected termination\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "# Build the actual slabs\n",
- "material1_slab = SlabBuilder().get_material(material1_slab_config)\n",
- "material0_slab = SlabBuilder().get_material(material0_slab_config)\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "afab24f1d8cf9ad7",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 2.5. Set Strain Matching Parameters and Generate First Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "9b72198198a18278",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
- "\n",
- "# Set up ZSL Interface Analyzer with the newer approach\n",
- "zsl_analyzer_01 = ZSLInterfaceAnalyzer(\n",
- " substrate_slab_configuration=material0_slab_config,\n",
- " film_slab_configuration=material1_slab_config,\n",
- " max_area=MAX_AREA_01,\n",
- " max_area_ratio_tol=0.09, # Default tolerance\n",
- " max_angle_tol=0.03, # Default tolerance\n",
- " max_length_tol=0.03 # Default tolerance\n",
- ")\n",
+ "from utils.visualize import visualize_materials as visualize\n",
"\n",
- "# Get ZSL matches\n",
- "matches_01 = zsl_analyzer_01.zsl_match_holders\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "4989c48b4ed6a33d",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 2.6. Plot and Select First Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "32e05e63fea1b5a3",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from utils.plot import plot_strain_vs_area\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\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_area(matches_01, PLOT_SETTINGS)\n",
- "\n",
- "# Select the interface with the lowest strain and smallest number of atoms\n",
- "selected_index_01 = 0\n",
- "\n",
- "# Create the first interface using the newer approach\n",
- "interface_01 = create_zsl_interface_between_slabs(\n",
- " substrate_slab=material0_slab,\n",
- " film_slab=material1_slab,\n",
- " gap=INTERFACE_01_DISTANCE,\n",
- " vacuum=FINAL_INTERFACE_VACUUM,\n",
- " match_id=selected_index_01,\n",
- " max_area=MAX_AREA_01,\n",
- ")\n",
+ "# Create materials with titles for visualization\n",
+ "materials_with_titles = [\n",
+ " {\"material\": crystal, \"title\": f\"Layer {i}: {STRUCTURE_PARAMS[i].name}\"} \n",
+ " for i, crystal in enumerate(crystals)\n",
+ "]\n",
"\n",
- "selected_interfaces_01 = [interface_01]\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "342d6261ae79122",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 2.7. Preview the First Interface\n"
+ "visualize(materials_with_titles, repetitions=[3, 3, 1], rotation=\"0x\")\n"
]
},
- {
- "cell_type": "code",
- "id": "1148759314be11cc",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "visualize(selected_interfaces_01, repetitions=[3, 3, 1])\n",
- "visualize(selected_interfaces_01, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "df770aba2dbc2df0",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
- "## 3. Create Second Interface (First Interface + Material 2)\n",
- "\n",
- "### 3.1. Configure Slabs and Select Termination Pair for Second Interface\n",
+ "## 5. Create the Heterostructure\n",
+ "### 5.1. Create Stack Component Dictionaries\n",
"\n",
- "Now, use the first interface as the substrate to add **Material 2**.\n"
+ "Create a list of dictionaries for each layer's parameters using the simplified approach.\n"
]
},
{
"cell_type": "code",
- "id": "636e0e4c45b02925",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.modify import translate_to_z_level\n",
- "\n",
- "# Update substrate to be the first interface\n",
- "substrate_second = translate_to_z_level(selected_interfaces_01[0], \"top\")\n",
- "\n",
- "# Get possible terminations for Material 2 and the substrate (first interface)\n",
- "material2_slab_terminations = get_slab_terminations(material=material2, miller_indices=MATERIAL_2_MILLER_INDICES)\n",
- "# For the substrate (first interface), we'll use a simple approach since it's already an interface\n",
- "substrate_second_slab_terminations = [\"top\"] # Simple termination for the interface substrate\n",
- "\n",
- "# Visualize Material 2 terminations using analyzer approach\n",
- "material2_analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material2, miller_indices=MATERIAL_2_MILLER_INDICES)\n",
- "material2_slabs = [material2_analyzer.get_material_with_termination_without_vacuum(termination) for termination in material2_slab_terminations]\n",
- "\n",
- "material2_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in zip(material2_slabs, material2_slab_terminations)]\n",
- "\n",
- "visualize(material2_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
- "\n",
- "# Visualize the substrate (first interface)\n",
- "visualize([{\"material\": substrate_second, \"title\": \"First Interface (Substrate)\"}], repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "ac68ed5b9219b0dc",
- "metadata": {
- "collapsed": false
- },
"source": [
- "### 3.2. Print and Select Termination Pair for Second Interface\n"
+ "from mat3ra.made.tools.helpers import StackComponentDict\n",
+ "\n",
+ "stack_component_dicts = [\n",
+ " StackComponentDict(\n",
+ " crystal=crystals[i],\n",
+ " miller_indices=structure_param.slab_params.miller_indices,\n",
+ " thickness=structure_param.slab_params.thickness,\n",
+ " xy_supercell_matrix=structure_param.slab_params.xy_supercell_matrix if hasattr(structure_param.slab_params, 'xy_supercell_matrix') else None,\n",
+ " termination_top_formula=structure_param.termination_formula,\n",
+ " ) for i, structure_param in enumerate(STRUCTURE_PARAMS)\n",
+ "]\n",
+ "\n",
+ "print(f\"Created {len(stack_component_dicts)} stack components:\")\n",
+ "for i, component in enumerate(stack_component_dicts):\n",
+ " print(f\" Layer {i}: {STRUCTURE_PARAMS[i].name} - Miller: {component.miller_indices}, Thickness: {component.thickness}\")\n"
]
},
- {
- "cell_type": "code",
- "id": "41b3d541c1ebfe5a",
- "metadata": {
- "collapsed": false
- },
- "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}\")"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "822c79480c3d7965",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
- "### 3.3. Select Termination Pair for Second Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "f9d2b5429447338e",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "# Select terminations for Material 2 and the substrate using the newer approach\n",
- "material2_termination = select_slab_termination(material2_slab_terminations, None) # None means use first termination\n",
- "substrate_second_termination = substrate_second_slab_terminations[0] # Use the first (and only) termination\n",
- "\n",
- "# Create termination pair\n",
- "termination_pair_second = (material2_termination, substrate_second_termination)\n",
- "\n",
- "# Allow for interactive selection if enabled\n",
- "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n",
- " termination_pair_index_12 = TERMINATION_PAIR_INDEX_12\n",
- " termination_pair_second = termination_pairs_12[termination_pair_index_12]\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",
- " )"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "796e3604d6bd4c60",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 3.4. Initialize Interface Configuration for Second Interface\n"
- ]
- },
- {
- "cell_type": "code",
- "id": "fa7e6b937d2b78a0",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "# Create slab configurations and slabs for the second interface using the newer approach\n",
- "material2_termination, substrate_second_termination = termination_pair_second\n",
- "\n",
- "# Slab configuration for Material 2 - using correct parameters like ZSL notebook\n",
- "material2_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=material2,\n",
- " miller_indices=MATERIAL_2_MILLER_INDICES,\n",
- " number_of_layers=MATERIAL_2_THICKNESS,\n",
- " vacuum=0.0, # Set vacuum to 0 for interface creation\n",
- " termination_formula=None, # Will use selected termination\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "# Build the Material 2 slab\n",
- "material2_slab = SlabBuilder().get_material(material2_slab_config)\n",
+ "### 5.2. Create the Heterostructure\n",
"\n",
- "# For the substrate (first interface), we'll use it as-is since it's already built"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "3816e1b290f7e5d0",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 3.5. Set Strain Matching Parameters and Generate Second Interface\n"
+ "Using the `create_heterostructure` function with automatic strain matching and optimization.\n"
]
},
{
"cell_type": "code",
- "id": "6f30c6961f7abbfe",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "# Set up ZSL Interface Analyzer for the second interface\n",
- "# Note: For the second interface, we need to create a slab configuration for the substrate (first interface)\n",
- "substrate_second_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=substrate_second,\n",
- " miller_indices=(0, 0, 1), # Z-orientation for the first interface\n",
- " number_of_layers=1, # One unit cell thick\n",
- " vacuum=0.0,\n",
- " termination_formula=None,\n",
- " use_conventional_cell=True\n",
- ")\n",
+ "from mat3ra.made.tools.helpers import create_heterostructure\n",
"\n",
- "zsl_analyzer_12 = ZSLInterfaceAnalyzer(\n",
- " substrate_slab_configuration=substrate_second_slab_config,\n",
- " film_slab_configuration=material2_slab_config,\n",
- " max_area=MAX_AREA_12,\n",
- " max_area_ratio_tol=0.09, # Default tolerance\n",
- " max_angle_tol=0.03, # Default tolerance\n",
- " max_length_tol=0.03 # Default tolerance\n",
+ "heterostructure = create_heterostructure(\n",
+ " stack_component_dicts=stack_component_dicts,\n",
+ " gaps=GAPS,\n",
+ " vacuum=VACUUM,\n",
+ " use_conventional_cell=True,\n",
+ " optimize_layer_supercells=True,\n",
")\n",
"\n",
- "# Get ZSL matches for the second interface\n",
- "matches_12 = zsl_analyzer_12.zsl_match_holders"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "32ded9bdae6ef429",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "### 3.6. Plot and Select Second Interface\n"
+ "print(f\"Successfully created heterostructure with {len(crystals)} materials\")\n",
+ "print(f\"Final structure has {heterostructure.basis.number_of_atoms} atoms\")\n"
]
},
- {
- "cell_type": "code",
- "id": "43f233403393eb2a",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "plot_strain_vs_area(matches_12, PLOT_SETTINGS)\n",
- "\n",
- "# Select the interface with the lowest strain and smallest number of atoms\n",
- "selected_index_12 = 0\n",
- "\n",
- "# Create the second interface using the newer approach\n",
- "interface_12 = create_zsl_interface_between_slabs(\n",
- " substrate_slab=substrate_second,\n",
- " film_slab=material2_slab,\n",
- " gap=INTERFACE_12_DISTANCE,\n",
- " vacuum=FINAL_INTERFACE_VACUUM,\n",
- " match_id=selected_index_12,\n",
- " max_area=MAX_AREA_12,\n",
- ")\n",
- "\n",
- "selected_interfaces_12 = [interface_12]"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "ed109941d5e29522",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
- "### 3.7. Preview the Second Interface (Final Heterostructure)\n"
+ "## 6. Visualize the Heterostructure\n"
]
},
{
"cell_type": "code",
- "id": "fffbf9243911a98",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "visualize(selected_interfaces_12, repetitions=[3, 3, 1])\n",
- "visualize(selected_interfaces_12, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "e98176e806c4aace",
- "metadata": {
- "collapsed": false
- },
"source": [
- "## 4. Preview the Final Heterostructure\n"
+ "visualize(\n",
+ " heterostructure,\n",
+ " repetitions=[1, 1, 1],\n",
+ " viewer=\"wave\",\n",
+ " rotation='0x'\n",
+ ")"
]
},
- {
- "cell_type": "code",
- "id": "47f9a1aa1578c37",
- "metadata": {
- "collapsed": false
- },
- "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\")"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "946d5a41156bc1e1",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
- "## 5. Pass the Final Heterostructure to the Outside Runtime\n",
- "\n",
- "Pass the resulting heterostructure with an adjusted name to `set_materials()`.\n"
+ "## 7. Save the Heterostructure\n",
+ "\n"
]
},
{
"cell_type": "code",
- "id": "1b466c32b0d82431",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "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",
+ "# Set heterostructure name based on all materials\n",
+ "material_names = [param.name for param in STRUCTURE_PARAMS]\n",
+ "# heterostructure.name = \" - \".join(material_names) + \" Heterostructure\"\n",
"\n",
- "set_materials(final_heterostructure)"
- ],
- "outputs": [],
- "execution_count": null
+ "set_materials(heterostructure)"
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_interface_with_min_strain_zsl.ipynb b/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
index ceee6024..116ba943 100644
--- a/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
+++ b/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
@@ -34,19 +34,19 @@
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
"\n",
"Set the following flags to control the notebook behavior "
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"FILM_INDEX = 1 # Index in the list of materials, to access as materials[FILM_INDEX]\n",
"FILM_MILLER_INDICES = (0, 0, 1)\n",
@@ -81,22 +81,21 @@
"# Whether to reduce the resulting interface cell to the primitive cell after the interface creation.\n",
"# If the reduction causes unexpected results, try increasing the `MAX_AREA` for search.\n",
"REDUCE_RESULT_CELL_TO_PRIMITIVE = True"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -108,23 +107,21 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.3. Get input materials and assign `substrate` and `film`\n",
"Materials are loaded with `get_data()`. The first material is assigned as substrate and the second as film."
- ],
- "metadata": {}
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
@@ -135,83 +132,79 @@
"except IndexError:\n",
" print(\"Film material not found. Re-using substrate material as film.\")\n",
" film = substrate"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.4. Preview Substrate and Film"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 2. Configure slabs for interface\n"
+ "metadata": {},
+ "source": [
+ "## 2. Configure slabs for interface\n"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.1. Get possible terminations for the slabs"
+ "metadata": {},
+ "source": [
+ "### 2.1. Get possible terminations for the slabs"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"film_slab_terminations = get_slab_terminations(material=film, miller_indices=FILM_MILLER_INDICES)\n",
"substrate_slab_terminations = get_slab_terminations(material=substrate, miller_indices=SUBSTRATE_MILLER_INDICES)\n",
"print(\"Film slab terminations:\", film_slab_terminations)\n",
"print(\"Substrate slab terminations:\", substrate_slab_terminations)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.2. Visualize slabs for all possible terminations"
+ "metadata": {},
+ "source": [
+ "### 2.2. Visualize slabs for all possible terminations"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab, select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_interface_zsl_between_slabs as create_zsl_interface_between_slabs\n",
"\n",
- "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
+ "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination_top=termination, vacuum=0) for\n",
+ " termination\n",
" in\n",
" film_slab_terminations]\n",
"\n",
- "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
- " for termination in\n",
- " substrate_slab_terminations]\n",
+ "substrate_slabs = [\n",
+ " create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination_top=termination, vacuum=0)\n",
+ " for termination in\n",
+ " substrate_slab_terminations]\n",
"\n",
"film_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in\n",
" zip(film_slabs, film_slab_terminations)]\n",
@@ -220,28 +213,28 @@
"\n",
"visualize(film_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(substrate_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.3. Select terminations for the Slabs"
+ "metadata": {},
+ "source": [
+ "### 2.3. Select terminations for the Slabs"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"film_termination = select_slab_termination(film_slab_terminations, FILM_TERMINATION_FORMULA)\n",
"substrate_termination = select_slab_termination(substrate_slab_terminations, SUBSTRATE_TERMINATION_FORMULA)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 2.4. Create Substrate and Layer Slabs\n",
"Slab Configuration lets define the slab thickness, vacuum, and the Miller indices of the interfacial plane and get the slabs with possible terminations.\n",
@@ -249,18 +242,19 @@
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration, SlabBuilder\n",
"\n",
"substrate_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
" number_of_layers=SUBSTRATE_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
+ " termination_top_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -269,27 +263,27 @@
" miller_indices=FILM_MILLER_INDICES,\n",
" number_of_layers=FILM_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=FILM_TERMINATION_FORMULA,\n",
+ " termination_bottom_formula=FILM_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
"substrate_slab = SlabBuilder().get_material(substrate_slab_config)\n",
"film_slab = SlabBuilder().get_material(film_slab_config)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.2. Analyze possible interfaces with ZSL Analyzer\n",
"The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
"\n",
@@ -302,38 +296,37 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell=False # Reduces supercell matrices in analyzer\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.3. Generate interfaces with strain matcher\n",
"Interfaces are sorted by size and strain."
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
- "metadata": {},
"cell_type": "code",
- "source": "matches = zsl_analyzer.zsl_match_holders",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "matches = zsl_analyzer.zsl_match_holders"
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.4. Plot interfaces by size and strain\n"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_strain_vs_area\n",
"\n",
@@ -344,16 +337,11 @@
"}\n",
"\n",
"plot_strain_vs_area(matches, PLOT_SETTINGS)"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.5. Select the interface\n",
"\n",
@@ -361,17 +349,17 @@
]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
- "source": "selected_index = 0",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "selected_index = 0"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 3. Create the interface\n",
"\n",
@@ -379,10 +367,10 @@
]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"\n",
"interface = create_zsl_interface_between_slabs(\n",
@@ -397,30 +385,24 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell_to_primitive=REDUCE_RESULT_CELL_TO_PRIMITIVE,\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 4. Preview the selected material"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(interface, repetitions=[1, 1, 1])\n",
"visualize(interface, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -431,14 +413,14 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(interface)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -458,13 +440,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/materials_designer/create_interface_with_no_strain_matching.ipynb b/other/materials_designer/create_interface_with_no_strain_matching.ipynb
index 88a539c8..89cfc30e 100644
--- a/other/materials_designer/create_interface_with_no_strain_matching.ipynb
+++ b/other/materials_designer/create_interface_with_no_strain_matching.ipynb
@@ -28,9 +28,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## 1. Prepare Environment\n",
"### 1.1. Set notebook parameters"
@@ -38,7 +36,9 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"# Create slabs for the film and substrate when creating the interface, otherwise use provided materials directly.\n",
"CREATE_SLABS = True \n",
@@ -65,15 +65,11 @@
"\n",
"INTERFACE_DISTANCE = 3.0 # in Angstrom\n",
"INTERFACE_VACUUM = 20.0 # in Angstrom"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"\n",
"### 1.2. Install Packages\n",
@@ -82,9 +78,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -94,15 +90,11 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.3. Get input materials and assign `substrate` and `film`\n",
"Materials are loaded with `get_data()`. The first material is assigned as substrate and the second as film."
@@ -110,9 +102,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
@@ -123,30 +115,24 @@
"except IndexError:\n",
" print(\"Please select a film material. Film is set to substrate.\")\n",
" film = substrate"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.4. Preview Substrate and Film"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -165,15 +151,15 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"film_slab_terminations = get_slab_terminations(film, miller_indices=FILM_MILLER_INDICES)\n",
"substrate_slab_terminations = get_slab_terminations(substrate, miller_indices=SUBSTRATE_MILLER_INDICES)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -184,18 +170,18 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import select_slab_termination\n",
"\n",
- "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
+ "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination_top=termination, vacuum=0) for termination\n",
" in\n",
" film_slab_terminations]\n",
"\n",
- "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
+ "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination_top=termination, vacuum=0)\n",
" for termination in\n",
" substrate_slab_terminations]\n",
"\n",
@@ -206,9 +192,7 @@
"\n",
"visualize(film_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(substrate_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -219,13 +203,13 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"film_termination = select_slab_termination(film_slab_terminations, FILM_TERMINATION_FORMULA)\n",
"substrate_termination = select_slab_termination(substrate_slab_terminations, SUBSTRATE_TERMINATION_FORMULA)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -238,15 +222,17 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"if CREATE_SLABS:\n",
" film_slab = create_slab(\n",
" crystal=film,\n",
" miller_indices=FILM_MILLER_INDICES,\n",
- " termination=film_termination,\n",
+ " termination_bottom=film_termination,\n",
" number_of_layers=FILM_THICKNESS, # in atomic layers\n",
" vacuum=FILM_VACUUM, # in angstroms\n",
" xy_supercell_matrix=FILM_XY_SUPERCELL_MATRIX,\n",
@@ -257,7 +243,7 @@
" substrate_slab = create_slab(\n",
" crystal=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
- " termination=substrate_termination,\n",
+ " termination_top=substrate_termination,\n",
" number_of_layers=SUBSTRATE_THICKNESS, # in atomic layers\n",
" vacuum=SUBSTRATE_VACUUM, # in angstroms\n",
" xy_supercell_matrix=SUBSTRATE_XY_SUPERCELL_MATRIX,\n",
@@ -267,9 +253,7 @@
"else:\n",
" film_slab = film\n",
" substrate_slab = substrate\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -282,9 +266,11 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface.helpers import create_simple_interface_between_slabs\n",
+ "from mat3ra.made.tools.helpers import create_interface_simple_between_slabs as create_simple_interface_between_slabs\n",
"\n",
"interface = create_simple_interface_between_slabs(\n",
" film_slab=film_slab,\n",
@@ -293,19 +279,17 @@
" vacuum=INTERFACE_VACUUM,\n",
" xy_shift=FILM_XY_SHIFT\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"visualize([interface], repetitions=[3, 3, 1])\n",
"visualize([interface], repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -316,13 +300,13 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(interface)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -342,13 +326,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
index 10b252be..150af9bb 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -30,39 +30,36 @@
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the relaxation parameter\n"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"MATERIAL_INDEX = 0 # Index of the material in the list of materials, should be an interface\n",
"# Maximum force tolerance for the relaxation to stop, in eV/Å\n",
"FMAX = 0.05"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -72,66 +69,58 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.3. Get input interface material\n",
"Materials are loaded with `get_data()`."
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"interface = materials[MATERIAL_INDEX]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 1.4. Preview Interface"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize(interface, repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 2. Perform Relaxation\n",
"### 2.1. Set the optimization parameters"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from ase.optimize import BFGS\n",
"from ase.calculators.emt import EMT\n",
@@ -142,24 +131,20 @@
"OPTIMIZATION_PARAMETERS = {\n",
" \"FMAX\": FMAX\n",
"}"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 2.2. Optimize atomic coordinates of the interface and view energy/step plot"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.utils.jupyterlite.plot import create_realtime_plot, create_update_callback\n",
"from mat3ra.made.tools.convert import from_ase\n",
@@ -197,12 +182,7 @@
"\n",
"ase_final_interface = ase_interface\n",
"final_interface = Material.create(from_ase(ase_final_interface))"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -213,12 +193,12 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"visualize([{\"material\": interface, \"title\": \"original\"}, {\"material\":final_interface, \"title\":\"relaxed\"}], rotation= \"-90x\", repetitions=[3, 3, 1])\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -230,7 +210,9 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.calculate import calculate_total_energy, calculate_interfacial_energy\n",
"\n",
@@ -242,31 +224,25 @@
"print(f\"Starting interface energy: {original_energy:.4f} eV\")\n",
"print(f\"Relaxed interface energy: {relaxed_energy:.4f} eV\")\n",
"print(f\"Interfacial energy: {interfacial_energy:.4f} eV\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 3. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"final_interface.name = f\"{interface.name}, Relaxed with EMT\" if \"Relaxed\" not in interface.name else interface.name\n",
"set_materials(final_interface)"
- ],
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -286,13 +262,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/materials_designer/create_island_defect.ipynb b/other/materials_designer/create_island_defect.ipynb
index 02ea0fbb..2d10d11a 100644
--- a/other/materials_designer/create_island_defect.ipynb
+++ b/other/materials_designer/create_island_defect.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create island defect on a slab\n",
"\n",
@@ -19,26 +21,25 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
+ "from types import SimpleNamespace\n",
"\n",
"# Shape-specific parameters\n",
"# Choose the island shape: 'cylinder', 'sphere', 'box', or 'triangular_prism'\n",
@@ -74,13 +75,13 @@
"# 'shape': 'sphere',\n",
"# 'radius': 0.25\n",
"# }\n",
- "# \n",
+ "#\n",
"# SHAPE_PARAMETERS = {\n",
"# 'shape': 'box',\n",
"# 'min_coordinate': [0.25, 0.25, 0],\n",
"# 'max_coordinate': [0.75, 0.75, 1]\n",
"# }\n",
- "# \n",
+ "#\n",
"# SHAPE_PARAMETERS = {\n",
"# 'shape': 'triangular_prism',\n",
"# 'position_on_surface_1': [0.25, 0.25],\n",
@@ -89,28 +90,25 @@
"# 'min_z': 0,\n",
"# 'max_z': 1\n",
"# }\n",
- "\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ "\n",
+ "SHAPE_PARAMETERS = SimpleNamespace(**SHAPE_PARAMETERS)"
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bb64de5ff32649f8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -120,51 +118,43 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ef664b14457530fd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview Slab or create a new one"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"slab = materials[0]\n",
@@ -183,121 +173,121 @@
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}])\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7fcb1e02e84c5f35",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create the Target Material\n",
"### 2.1. Initialize the defect conditions"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.utils.coordinate import CylinderCoordinateCondition\n",
+ "from mat3ra.made.tools.entities.coordinate import CylinderCoordinateCondition, \\\n",
+ " SphereCoordinateCondition, BoxCoordinateCondition, TriangularPrismCoordinateCondition\n",
"\n",
- "condition = CylinderCoordinateCondition(\n",
- " center_position=CENTER_POSITION,\n",
- " radius=SHAPE_PARAMETERS['radius'],\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e2d24109d3068c9e",
- "outputs": [],
- "execution_count": null
+ "condition = None\n",
+ "\n",
+ "if SHAPE_PARAMETERS.shape == 'cylinder':\n",
+ " condition = CylinderCoordinateCondition(\n",
+ " center_position=CENTER_POSITION,\n",
+ " radius=SHAPE_PARAMETERS.radius,\n",
+ " min_z=SHAPE_PARAMETERS.min_z,\n",
+ " max_z=SHAPE_PARAMETERS.max_z)\n",
+ "elif SHAPE_PARAMETERS.shape == 'sphere':\n",
+ " condition = SphereCoordinateCondition(\n",
+ " center_coordinate=CENTER_POSITION,\n",
+ " radius=SHAPE_PARAMETERS.radius)\n",
+ "elif SHAPE_PARAMETERS.shape == 'box':\n",
+ " condition = BoxCoordinateCondition(\n",
+ " min_coordinate=SHAPE_PARAMETERS.min_coordinate,\n",
+ " max_coordinate=SHAPE_PARAMETERS.max_coordinate)\n",
+ "elif SHAPE_PARAMETERS.shape == 'triangular_prism':\n",
+ " condition = TriangularPrismCoordinateCondition(\n",
+ " position_on_surface_1=SHAPE_PARAMETERS.position_on_surface_1,\n",
+ " position_on_surface_2=SHAPE_PARAMETERS.position_on_surface_2,\n",
+ " position_on_surface_3=SHAPE_PARAMETERS.position_on_surface_3,\n",
+ " min_z=SHAPE_PARAMETERS.min_z,\n",
+ " max_z=SHAPE_PARAMETERS.max_z)\n",
+ "else:\n",
+ " raise ValueError(f\"Unknown shape: {SHAPE_PARAMETERS.shape}\")\n"
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.2. Create the island"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "489b51f0ee122c48"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.island.helpers import create_island_defect\n",
+ "from mat3ra.made.tools.helpers import create_island\n",
"\n",
- "slab_with_island = create_island_defect(\n",
+ "slab_with_island = create_island(\n",
" slab=slab,\n",
" condition=condition,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES,\n",
" number_of_added_layers=NUMBER_OF_ADDED_LAYERS,\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a990fa35742d7269",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
- " {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\"}] ,\n",
+ " {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS.shape})\"}] ,\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']})\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ " {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS.shape})\"}], rotation=\"-90x\")"
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(slab_with_island)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_island_defect_custom.ipynb b/other/materials_designer/create_island_defect_custom.ipynb
index 06c6e160..d1b4df64 100644
--- a/other/materials_designer/create_island_defect_custom.ipynb
+++ b/other/materials_designer/create_island_defect_custom.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create Custom Shape Island Defect on a Slab\n",
"\n",
@@ -20,26 +22,24 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e82522518cb8724c"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"from typing import List\n",
@@ -51,30 +51,25 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b1216c665d6cf493",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Create custom Coordinate Conditions"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c360bd0ea9a5f262"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import numpy as np\n",
- "from mat3ra.made.tools.utils.coordinate import CoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import CoordinateCondition\n",
"\n",
"# Custom Coordinate Condition for a torus shape\n",
"class CustomCoordinateCondition(CoordinateCondition):\n",
@@ -89,24 +84,22 @@
" # Calculate the distance from the torus surface\n",
" distance_to_torus = np.sqrt((xy_distance - self.major_radius) ** 2 + (coord[2] - self.center[2]) ** 2)\n",
" return distance_to_torus <= self.minor_radius\n"
- ],
- "id": "55f4289a6545c504",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Set the parameters\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "535bbac2c3f2832b"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"CENTER_POSITION = [0.5, 0.5, 0.5] # Center of the torus in crystal coordinates\n",
"MAJOR_RADIUS = 0.3 # Major radius of the torus\n",
@@ -124,74 +117,65 @@
" \"use_orthogonal_c\": True,\n",
" \"xy_supercell_matrix\": [[10, 0], [0, 10]]\n",
"}"
- ],
- "id": "4f6c437b81325730",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Initialize the Coordinate Condition"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8ab363bab5c5f7cc"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"coordinate_condition = CustomCoordinateCondition(\n",
" center=CENTER_POSITION,\n",
" major_radius=MAJOR_RADIUS,\n",
" minor_radius=MINOR_RADIUS\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "87c3850f6c7178b2",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 1.5. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 1.6. Preview Slab or create a new one"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"slab = materials[0]\n",
@@ -208,53 +192,47 @@
" \n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}])\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"}], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7fcb1e02e84c5f35",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 2. Create the Target Material",
- "metadata": {
- "collapsed": false
- },
- "id": "690241d87e7bbbe0"
+ "id": "13",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Target Material"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.island.helpers import create_island_defect\n",
+ "from mat3ra.made.tools.helpers import create_island\n",
"\n",
- "slab_with_island = create_island_defect(\n",
+ "slab_with_island = create_island(\n",
" slab=slab,\n",
" condition=coordinate_condition,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES,\n",
" number_of_added_layers=NUMBER_OF_ADDED_LAYERS,\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e2d24109d3068c9e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_island, \"title\": f\"Material with Island Defect\"}],\n",
@@ -262,37 +240,27 @@
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_island, \"title\": f\"Material with Island Defect\"}])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "17",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(slab_with_island)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_monolayer.ipynb b/other/materials_designer/create_monolayer.ipynb
index 628da7f9..5f2cc7d7 100644
--- a/other/materials_designer/create_monolayer.ipynb
+++ b/other/materials_designer/create_monolayer.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Monolayer\n",
"\n",
@@ -13,25 +15,23 @@
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Scroll down to view results. "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a79609c9bc772c5c"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up transformation parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "47d31d9834478007"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"XY_SUPERCELL_MATRIX = [\n",
" [3, 0],\n",
@@ -39,27 +39,23 @@
"]\n",
"\n",
"VACUUM = 10.0 # Angstrom"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a2c8922a4e627887",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6fab076ea1d7a223"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -71,157 +67,141 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b0c332f1c1f451fd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3e9934b458d6cb4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "74cd0d5a3881ab47",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d4535caf6debb8d4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize(material, repetitions=[3, 3, 1], rotation=\"0x\")\n",
"visualize(material, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d6bea39864c23ab5",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create Monolayer"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5473c36cd254aa89"
+ ]
},
{
"cell_type": "markdown",
- "source": "### 2.1. Create a monolayer unit cell",
- "metadata": {
- "collapsed": false
- },
- "id": "ee17958872d03410"
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "### 2.1. Create a monolayer unit cell"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.monolayer.helpers import create_monolayer\n",
+ "from mat3ra.made.tools.helpers import create_monolayer\n",
"\n",
"monolayer = create_monolayer(\n",
" crystal=material,\n",
" vacuum=VACUUM,\n",
")"
- ],
- "id": "f05c4872edfef910",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.2 Create a supercell",
- "id": "372400a5610d7247"
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.2 Create a supercell"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.operations.core.unary import supercell\n",
"\n",
"monolayer = supercell(\n",
" material=monolayer,\n",
" supercell_matrix=XY_SUPERCELL_MATRIX, )"
- ],
- "id": "25d6681d5c1bfb0",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 3. Visualize the result",
- "id": "82f9dfac4c711634"
+ "id": "14",
+ "metadata": {},
+ "source": [
+ "## 3. Visualize the result"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(monolayer, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(monolayer, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "id": "ab5c2f5ee249525c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6ce5f7dd9a919a08"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(monolayer)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "865c71d008d87beb",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_nanoribbon.ipynb b/other/materials_designer/create_nanoribbon.ipynb
index 9d4f5d28..aa24761d 100644
--- a/other/materials_designer/create_nanoribbon.ipynb
+++ b/other/materials_designer/create_nanoribbon.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Nanoribbon of a 2D material\n",
"\n",
@@ -22,25 +24,23 @@
"## Notes\n",
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "367a698b29e22bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up nanoribbon parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "193a4e6a78fd5bd7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Index in the list of materials, to access as materials[MATERIAL_INDEX]\n",
"MATERIAL_INDEX = 0\n",
@@ -51,27 +51,23 @@
"VACUUM_WIDTH = 10.0 # in Angstroms\n",
"VACUUM_LENGTH = 10.0 # in Angstroms\n",
"EDGE_TYPE = \"zigzag\" # \"zigzag\" or \"armchair\""
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a40d7b697c413113",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "49c9f5022d50517e"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -81,76 +77,66 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c6d9f8e57bef2f91",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials\n",
"Materials are loaded with `get_materials()`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "edf02101e27a2742"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e0c53233ce728cc1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview Material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cf29b7f6fe114d8f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"material = materials[MATERIAL_INDEX]\n",
"visualize(material, repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "897ba7aa4e402d24",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 2. Create the Nanoribbon\n",
- "metadata": {
- "collapsed": false
- },
- "id": "39a93c4635762a83"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Nanoribbon\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.lattice_lines import EdgeTypes\n",
- "from mat3ra.made.tools.build.nanoribbon.helpers import create_nanoribbon\n",
+ "from mat3ra.made.tools.helpers import EdgeTypesEnum\n",
+ "from mat3ra.made.tools.helpers import create_nanoribbon\n",
"\n",
"\n",
"nanoribbon = create_nanoribbon(\n",
@@ -160,61 +146,47 @@
" vacuum_width=VACUUM_WIDTH,\n",
" vacuum_length=VACUUM_LENGTH,\n",
" use_rectangular_lattice=True,\n",
- " edge_type=EdgeTypes.zigzag if EDGE_TYPE == \"zigzag\" else EdgeTypes.armchair\n",
+ " edge_type=EdgeTypesEnum.zigzag if EDGE_TYPE == \"zigzag\" else EdgeTypesEnum.armchair\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1991efeeebe39db4",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize the Nanoribbon"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "eecd561cd92fb18a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize([{\"material\": nanoribbon, \"title\": \"Nanoribbon\"}])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1ee393a7f2ec3bc8",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9e0b241366592109"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(nanoribbon)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "29dfa0a329cca2fa",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_nanowire.ipynb b/other/materials_designer/create_nanowire.ipynb
index 2bedf982..c673e7a5 100644
--- a/other/materials_designer/create_nanowire.ipynb
+++ b/other/materials_designer/create_nanowire.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a nanowire\n",
"\n",
@@ -13,52 +15,46 @@
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Scroll down to view results. "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c9f342d4ac1988c6"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up nanowire parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cbcd112c418fcaa4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"MILLER_INDICES= (0,0,1) # Miller indices of the nanowire direction\n",
"RADIUS = 5.0 # Wire radius in Angstroms\n",
"LENGTH = 30.0 # Wire length in Angstroms\n",
"VACUUM = 10.0 # Vacuum thickness on the sides in Angstroms\n",
"ALIGN_ALONG_X = True"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2269749714d81b93",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "65c906791f69bac9"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -69,81 +65,69 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6dac92b719d539ec",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2fe1d71e1b02aed9"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0] "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b95701d7a0e593fe",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a8ebe61794b2e803"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize(material, repetitions=[3,3,3], rotation=\"0x\")\n",
"visualize(material, repetitions=[3,3,3], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c98ec170f3ee6d24",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create nanowire\n",
"### 2.1. Create a slab and cut a cylinder"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "38ecf94e650e268d"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"import math\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"from mat3ra.made.tools.modify import filter_by_cylinder, add_vacuum_sides\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slab_unit_cell = create_slab(\n",
" crystal=material,\n",
@@ -159,84 +143,66 @@
"supercell = create_supercell(slab_unit_cell, supercell_matrix=[[n_for_x, 0, 0], [0, n_for_y, 0], [0, 0, n_for_z]])\n",
"nanowire_z = filter_by_cylinder(supercell, radius=RADIUS, use_cartesian_coordinates=True)\n",
"nanowire_z = add_vacuum_sides(nanowire_z, vacuum=VACUUM, on_x=True, on_y=True) "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c4b34b3287960dcc",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.2. Rotate to align along X axis (optional)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ae940638396f93a6"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"rotate_90_degree_matrix = [[0, 0, 1], [0, 1, 0], [-1, 0, 0]]\n",
"nanowire_x = create_supercell(nanowire_z, supercell_matrix=rotate_90_degree_matrix)\n",
"nanowire = nanowire_x if ALIGN_ALONG_X else nanowire_z"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7401ab24726bf4e5",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d8f41816d0b48edc"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"-90x\")\n",
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"-90y\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aea078560283ca95",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a212abe25bf59b4f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(nanowire)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cdaf612bc6198546",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_nanowire_custom_shape.ipynb b/other/materials_designer/create_nanowire_custom_shape.ipynb
index d34c9371..571f3484 100644
--- a/other/materials_designer/create_nanowire_custom_shape.ipynb
+++ b/other/materials_designer/create_nanowire_custom_shape.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a nanowire with a custom cross-section shape\n",
"\n",
@@ -13,35 +15,31 @@
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Scroll down to view results. "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bfcbf5c3f9adb668"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e3702ff2a5270ce6"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e4fdd50d405fcd11"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -52,26 +50,22 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bd0fdddfd8880b40",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set up transformation parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "dcf793dd6eecabb8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"from typing import List\n",
"\n",
@@ -88,7 +82,7 @@
"ALIGN_ALONG_X = True\n",
"\n",
"import numpy as np\n",
- "from mat3ra.made.tools.utils.coordinate import CoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import CoordinateCondition\n",
"\n",
"# Custom Coordinate Condition for a hollow cylinder shape\n",
"class CustomCoordinateCondition(CoordinateCondition):\n",
@@ -104,80 +98,68 @@
" distance_to_torus = np.sqrt((xy_distance - self.major_radius) ** 2 + (coord[2] - self.center[2]) ** 2)\n",
" return distance_to_torus <= self.minor_radius\n",
"condition = CustomCoordinateCondition(center=CENTER_COORDINATE, major_radius=MAJOR_RADIUS, minor_radius=MINOR_RADIUS).condition"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e93f72e7c37dea10",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f348991bf39a14e7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0] "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4b72580121ca40d0",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aa183a2ac1a6993"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize(material, repetitions=[3,3,3], rotation=\"0x\")\n",
"visualize(material, repetitions=[3,3,3], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d3cba46f185c1a1b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"## 2. Create nanowire\n",
"### 2.1. Create a slab and cut a cylinder"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ba9e20ebe63ffda7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"from mat3ra.made.tools.modify import add_vacuum_sides, filter_by_condition_on_coordinates\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slab_unit_cell = create_slab(\n",
" crystal=material,\n",
@@ -190,84 +172,66 @@
"supercell = create_supercell(slab_unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
"nanowire_z = filter_by_condition_on_coordinates(supercell, condition=condition, use_cartesian_coordinates=USE_CARTESIAN_COORDINATES)\n",
"nanowire_z = add_vacuum_sides(nanowire_z, vacuum=VACUUM, on_x=True, on_y=True) "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2795d5bdbbaafbe6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"### 2.2. Rotate the nanowire to align along X axis"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "751d9531a5e5bf86"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"rotate_90_degree_matrix = [[0, 0, 1], [0, 1, 0], [-1, 0, 0]]\n",
"nanowire_x = create_supercell(nanowire_z, supercell_matrix=rotate_90_degree_matrix)\n",
"nanowire = nanowire_x if ALIGN_ALONG_X else nanowire_z"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "87534e47ecdb9dc6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d8f41816d0b48edc"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"-90x\")\n",
"visualize(nanowire, repetitions=[1, 1, 1], rotation=\"-90y\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aea078560283ca95",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a212abe25bf59b4f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(nanowire)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cdaf612bc6198546",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_perturbation.ipynb b/other/materials_designer/create_perturbation.ipynb
index 1c0c9988..2672c096 100644
--- a/other/materials_designer/create_perturbation.ipynb
+++ b/other/materials_designer/create_perturbation.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Perturbation in a Material\n",
"\n",
@@ -18,25 +20,23 @@
"## Notes\n",
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "367a698b29e22bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up perturbation parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "193a4e6a78fd5bd7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# string representation of the perturbation function, function of x, y, z variables\n",
"perturbation_function = \"0.5 * sin (2 * pi * x) \"\n",
@@ -46,27 +46,23 @@
"SUPERCELL_MATRIX = [[30, 0, 0], [0, 30, 0], [0, 0, 1]]\n",
"\n",
"PRESERVE_GEODESIC_DISTANCE = False"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a40d7b697c413113",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "49c9f5022d50517e"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -78,82 +74,70 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c6d9f8e57bef2f91",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials\n",
"Materials are loaded with `get_materials()`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "edf02101e27a2742"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e0c53233ce728cc1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cf29b7f6fe114d8f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"unit_cell = materials[0]\n",
"supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "897ba7aa4e402d24",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create the SineWave Perturbation\n",
"### 2.1. Set sine wave perturbation parameters\n",
"Use perturbation function imported from `mat3ra.made.tools.utils.perturbation` folder."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "39a93c4635762a83"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.perturbation.helpers import create_perturbation\n",
+ "from mat3ra.made.tools.helpers import create_perturbation\n",
"\n",
"material_with_perturbation = create_perturbation(\n",
" material=supercell,\n",
@@ -161,26 +145,22 @@
" is_isometric=PRESERVE_GEODESIC_DISTANCE,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1991efeeebe39db4",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 3. Visualize the Result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "eecd561cd92fb18a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
@@ -188,37 +168,27 @@
" {\"material\": material_with_perturbation, \"title\": f\"Material with perturbation\"},\n",
" {\"material\": material_with_perturbation, \"title\": f\"Material with perturbation\", \"rotation\": \"-90x\"},\n",
" ])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1ee393a7f2ec3bc8",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9e0b241366592109"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(material_with_perturbation)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "29dfa0a329cca2fa",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_perturbation_custom.ipynb b/other/materials_designer/create_perturbation_custom.ipynb
index 1b04ee6e..7d6befe5 100644
--- a/other/materials_designer/create_perturbation_custom.ipynb
+++ b/other/materials_designer/create_perturbation_custom.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Custom Perturbation in a Material\n",
"\n",
@@ -19,35 +21,31 @@
"## Notes\n",
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "367a698b29e22bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "193a4e6a78fd5bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f38b2711726e5859"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -59,26 +57,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7a6e28cfae1a7b46",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set Generic Perturbation Parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "11db992e02891067"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Set whether to preserve geodesic distance and scale the cell accordingly to match PBC\n",
"PRESERVE_GEODESIC_DISTANCE = True\n",
@@ -88,27 +82,23 @@
"\n",
"# Set whether to use Cartesian coordinates for the perturbation function\n",
"USE_CARTESIAN_COORDINATES = False"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a40d7b697c413113",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Define Custom Perturbation Function\n",
"Provide a [SymPy](https://docs.sympy.org/latest/tutorials/intro-tutorial/intro.html) expression for the perturbation function. The expression should be a function of `x`, `y` and `z` variables."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e6a19c741406eafe"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sympy as sp\n",
"\n",
@@ -124,81 +114,69 @@
"# Define the perturbation function\n",
"custom_sympy_function = AMPLITUDE * sp.sin(2 * sp.pi * x / WAVELENGTH + PHASE) * sp.sin(\n",
" 2 * sp.pi * y / WAVELENGTH)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "203911c2413c7447",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 1.4. Get input materials\n",
"Materials are loaded with `get_materials()`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "edf02101e27a2742"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e0c53233ce728cc1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"### 1.5. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cf29b7f6fe114d8f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"unit_cell = materials[0]\n",
"supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "897ba7aa4e402d24",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"## 2. Create a target material\n",
"### 2.1. Set custom perturbation parameters\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6d4adf0d580e0340"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.perturbation.helpers import create_perturbation\n",
+ "from mat3ra.made.tools.helpers import create_perturbation\n",
"\n",
"\n",
"material_with_perturbation = create_perturbation(\n",
@@ -207,62 +185,48 @@
" is_isometric=PRESERVE_GEODESIC_DISTANCE,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8d90932312c418ee",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"### 3. Visualize the Material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "10e7ca8950839991"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize([\n",
" {\"material\": material_with_perturbation, \"title\": f\"Material with custom perturbation\"},\n",
" {\"material\": material_with_perturbation, \"title\": f\"Material with custom perturbation\", \"rotation\": \"-90x\"}\n",
"])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cbfe0878a16f6c83",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9e0b241366592109"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(material_with_perturbation)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "29dfa0a329cca2fa",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_point_defect.ipynb b/other/materials_designer/create_point_defect.ipynb
index 4aabdc74..0fc08a16 100644
--- a/other/materials_designer/create_point_defect.ipynb
+++ b/other/materials_designer/create_point_defect.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f2e1e795020d7b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Create Multiple Point Defects in a Bulk Material\n",
"\n",
@@ -26,10 +24,8 @@
},
{
"cell_type": "markdown",
- "id": "5e43ff288847b784",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
@@ -38,11 +34,13 @@
},
{
"cell_type": "code",
- "id": "9d8b1890b34d850a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
+ "from types import SimpleNamespace\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",
@@ -53,40 +51,39 @@
" \"element\": \"C\",\n",
" \"placement_method\": \"closest_site\",\n",
" },\n",
- " \n",
+ "\n",
" {\n",
" \"type\": \"vacancy\",\n",
- " \"coordinate\": [0.25, 0.25, 0.25], # Crystal coordinates \n",
+ " \"coordinate\": [0.25, 0.25, 0.25], # Crystal coordinates\n",
" \"placement_method\": \"closest_site\",\n",
" },\n",
- " \n",
+ "\n",
" {\n",
" \"type\": \"interstitial\",\n",
" \"coordinate\": [0.75, 0.75, 0.75], # Crystal coordinates\n",
" \"element\": \"N\",\n",
" \"placement_method\": \"voronoi_site\",\n",
" },\n",
- "]"
- ],
- "outputs": [],
- "execution_count": null
+ "]\n",
+ "\n",
+ "DEFECT_CONFIGS = [SimpleNamespace(**defect_config) for defect_config in DEFECT_CONFIGS]"
+ ]
},
{
"cell_type": "markdown",
- "id": "bb64de5ff32649f8",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -98,135 +95,121 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "id": "b0a44e0207ea7299"
+ ]
},
{
"cell_type": "markdown",
- "id": "919ad7af8dceeedd",
- "metadata": {
- "collapsed": false
- },
- "source": "### 1.3. Get input materials"
+ "id": "5",
+ "metadata": {},
+ "source": [
+ "### 1.3. Get input materials"
+ ]
},
{
"cell_type": "code",
- "id": "be38fdda1984c654",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a132fe0ef8bbf0d0",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
]
},
{
"cell_type": "code",
- "id": "e2d24109d3068c9e",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"unit_cell = materials[0]\n",
"supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5da5b0380583c952",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create Multiple Defects\n",
- "### 2.1. Prepare defect dictionaries for creation"
+ "### 2.1. Prepare defect dictionaries and validate them"
]
},
{
"cell_type": "code",
- "id": "e385e50ae11ed2b9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
+ "from mat3ra.made.tools.helpers import PointDefectDict\n",
+ "defect_dicts = [PointDefectDict(**defect_dict.__dict__) for defect_dict in DEFECT_CONFIGS]\n",
+ "\n",
"print(\"Defect configurations:\")\n",
"for i, defect_dict in enumerate(DEFECT_CONFIGS):\n",
- " print(f\"\\n{i+1}. {defect_dict['type'].upper()}:\")\n",
- " print(f\" - Coordinate: {defect_dict['coordinate']}\")\n",
- " print(f\" - Resolution method: {defect_dict['placement_method']}\")\n",
- " if \"element\" in defect_dict:\n",
- " print(f\" - Element: {defect_dict['element']}\")\n",
+ " print(f\"\\n{i+1}. {defect_dict.type.capitalize()} defect:\")\n",
+ " print(f\" - Coordinate: {defect_dict.coordinate}\")\n",
+ " print(f\" - Resolution method: {defect_dict.placement_method}\")\n",
+ " if hasattr(defect_dict, \"element\"):\n",
+ " print(f\" - Element: {defect_dict.element}\")\n",
" \n",
"print(f\"\\nTotal defects to create: {len(DEFECT_CONFIGS)}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "489b51f0ee122c48",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.2. Create multiple defects using the newer approach"
]
},
{
"cell_type": "code",
- "id": "a990fa35742d7269",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.point.helpers import create_multiple_defects\n",
+ "from mat3ra.made.tools.helpers import create_multiple_defects\n",
"\n",
"material_with_defects = create_multiple_defects(\n",
" material=supercell,\n",
- " defect_dicts=DEFECT_CONFIGS,\n",
+ " defect_dicts=defect_dicts,\n",
")\n",
"\n",
"print(f\"Original atoms: {len(supercell.basis.elements.ids)}\")\n",
"print(f\"Final atoms: {len(material_with_defects.basis.elements.ids)}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "462549d016073446",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
]
},
{
"cell_type": "code",
- "id": "509b18661a069e42",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
@@ -235,33 +218,29 @@
" rotation=\"-90x\")\n",
"visualize([{\"material\": supercell, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defects, \"title\": f\"Material with defects\"}])"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "d381df29a6bbdd82",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
},
{
- "metadata": {},
"cell_type": "code",
- "outputs": [],
"execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"# Set the material name and pass to outside runtime\n",
"material_with_defects.name = f\"{unit_cell.name} with {len(DEFECT_CONFIGS)} defects\"\n",
"set_materials([material_with_defects])"
- ],
- "id": "bd4fa88a015b0dd4"
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_point_defect_pair.ipynb b/other/materials_designer/create_point_defect_pair.ipynb
index b49b9792..c4c2fab7 100644
--- a/other/materials_designer/create_point_defect_pair.ipynb
+++ b/other/materials_designer/create_point_defect_pair.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a point defect pair in a bulk material\n",
"\n",
@@ -18,27 +20,24 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
"Defect Configuration parameters are described in [Defect Configuration](https://github.com/Exabyte-io/made/blob/8196b759242551c77d1791bf5bd2f4150763cfef/src/py/mat3ra/made/tools/build/defect/configuration.py#L102)."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"from types import SimpleNamespace\n",
"\n",
@@ -61,23 +60,23 @@
" # \"site_id\": 0, # Index of the atom in the host material\n",
" # \"coordinate\": None, # Exact position (override the approximate coordinate)\n",
")"
- ],
- "id": "71f275fbc0163e6f",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "id": "709d92aa693bd65f"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -89,81 +88,71 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "id": "d499bc9a7f6855f7",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials\n",
"Materials are loaded with `get_materials()`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"unit_cell = materials[0]\n",
"supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e2d24109d3068c9e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create the Defect\n",
"### 2.1. Initialize Configuration and Builder parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5da5b0380583c952"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.pair_defect.helpers import create_pair_defect\n",
+ "from mat3ra.made.tools.helpers import create_defect_pair\n",
"\n",
- "material_with_defect = create_pair_defect(\n",
+ "material_with_defect = create_defect_pair(\n",
" material=supercell,\n",
" defect_type_1=PRIMARY_DEFECT_CONFIG.defect_type,\n",
" coordinate_1=PRIMARY_DEFECT_CONFIG.coordinate,\n",
@@ -177,20 +166,22 @@
" placement_method_2=SECONDARY_DEFECT_CONFIG.placement_method if hasattr(SECONDARY_DEFECT_CONFIG,\n",
" 'placement_method') else None,\n",
")"
- ],
- "id": "c4f50fb621da6474",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 3. Visualize Result(s)",
- "id": "ae5f5d5e9be9113"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "## 3. Visualize Result(s)"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
@@ -199,34 +190,27 @@
" rotation=\"-90x\")\n",
"visualize([{\"material\": supercell, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defect, \"title\": f\"Material with defect\"}])"
- ],
- "id": "8308ef3260816859",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials([material_with_defect])"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_slab.ipynb b/other/materials_designer/create_slab.ipynb
index fba5772a..6a3df931 100644
--- a/other/materials_designer/create_slab.ipynb
+++ b/other/materials_designer/create_slab.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a slab with specified termination\n",
"\n",
@@ -21,25 +23,23 @@
"\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "95a274d80df28ccd"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d55eaee8bc55bffd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Enable interactive selection of terminations via UI prompt\n",
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
@@ -55,27 +55,23 @@
"SLAB_TERMINATION_FORMULA = None\n",
"# if None, the index of all possible terminations will be used\n",
"TERMINATION_INDEX = 0"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4b64735060047bec",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e0ce05f6f031b3f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -86,173 +82,147 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b457673560550933",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "1659a8e9afe434fb"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b588ccfe51967a86",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8c13970a869adfa9"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize(material, repetitions=[3, 3, 1], rotation=\"0x\")\n",
"visualize(material, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c4f6e2697f97965f",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Configure slab and select termination\n",
"\n",
"### 2.1. Create crystal lattice planes analyzer\n",
"CrystalLatticePlanesMaterialAnalyzer is used to analyze the crystal lattice planes of the material and determine possible terminations for the slab.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6634dae92a6c07b9"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
"\n",
"analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material, miller_indices=MILLER_INDICES)"
- ],
- "id": "3ad6765249610aa4",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.2. Get possible terminations for the slabs"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "afb4c9bb89c8690b"
+ ]
},
{
"cell_type": "code",
- "source": "slab_terminations = analyzer.terminations",
- "metadata": {
- "collapsed": false
- },
- "id": "70bec9d69d58b28a",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "slab_terminations = analyzer.terminations"
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"### 2.3. Visualize slabs for all possible terminations"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c6e2e18452972b21"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"\n",
"slabs = [analyzer.get_material_with_termination_without_vacuum(termination) for termination in slab_terminations]\n",
"\n",
"visualize([{\"material\":slab, \"title\": slab.name} for slab in slabs ], repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "246cb1f0437dbde0",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"### 2.4. Print terminations for the Slab"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c06cd779e3b76a5f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"Terminations\")\n",
"for idx, termination in enumerate(slab_terminations):\n",
" print(f\" {idx}: {termination}\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "92bdfc42a0d8e0c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "17",
+ "metadata": {},
"source": [
"### 2.5. Select termination for the Slab"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "51e59fdb80b92b2d"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import select_slab_termination\n",
"from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n",
"\n",
"termination_index = TERMINATION_INDEX\n",
@@ -266,33 +236,29 @@
" termination = await ui_prompt_select_array_element_by_index_pyodide(slab_terminations, element_name=\"termination\")\n",
" else:\n",
" termination = ui_prompt_select_array_element_by_index(slab_terminations, element_name=\"termination\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "905e116e59b3e16e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "19",
+ "metadata": {},
"source": [
"## 3. Create the slab with selected termination\n",
"\n",
"3.1. Create slab with specified termination"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "143bc82b430b37d5"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "20",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slab = create_slab(crystal=material,\n",
- " termination=termination,\n",
+ " termination_top=termination,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL,\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers= THICKNESS,\n",
@@ -300,59 +266,49 @@
" xy_supercell_matrix=XY_SUPERCELL_MATRIX,\n",
" use_orthogonal_c=USE_ORTHOGONAL_C,\n",
" )\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aeeac03a236fe058",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 4. Visualize the resulting slab",
- "metadata": {
- "collapsed": false
- },
- "id": "301dd99ed1425f62"
+ "id": "21",
+ "metadata": {},
+ "source": [
+ "## 4. Visualize the resulting slab"
+ ]
},
{
"cell_type": "code",
- "source": "visualize(slab, repetitions=[1, 1, 1], rotation=\"0x\")",
- "metadata": {
- "collapsed": false
- },
- "id": "19b8867953bc3f1b",
+ "execution_count": null,
+ "id": "22",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "visualize(slab, repetitions=[1, 1, 1], rotation=\"0x\")"
+ ]
},
{
"cell_type": "markdown",
+ "id": "23",
+ "metadata": {},
"source": [
"# 5. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d667623ad5f2e061"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "24",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(slab)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3705115f04ac0010",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": ".venv-3.11.2",
"language": "python",
"name": "python3"
},
@@ -366,7 +322,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
- "version": "2.7.6"
+ "version": "3.11.2"
}
},
"nbformat": 4,
diff --git a/other/materials_designer/create_supercell.ipynb b/other/materials_designer/create_supercell.ipynb
index 72fb5cb0..38522078 100644
--- a/other/materials_designer/create_supercell.ipynb
+++ b/other/materials_designer/create_supercell.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a supercell\n",
"\n",
@@ -13,25 +15,23 @@
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Scroll down to view results. "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bfcbf5c3f9adb668"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up transformation parameters "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e3702ff2a5270ce6"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"SUPERCELL_MATRIX = [\n",
" [3, 0, 0], \n",
@@ -41,27 +41,23 @@
"\n",
"# or use the scaling factor\n",
"SCALING_FACTOR = None # [3, 3, 1]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e93f72e7c37dea10",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9f3ffe460d75942f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -72,136 +68,110 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9eb0650f7183279c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f348991bf39a14e7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[0]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4b72580121ca40d0",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aa183a2ac1a6993"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"repetitions = SCALING_FACTOR if SCALING_FACTOR else [3, 3, 1]\n",
"visualize(material, repetitions=repetitions, rotation=\"0x\")\n",
"visualize(material, repetitions=repetitions, rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d3cba46f185c1a1b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ba9e20ebe63ffda7"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"if SUPERCELL_MATRIX:\n",
" supercell = create_supercell(material, supercell_matrix=SUPERCELL_MATRIX)\n",
"elif SCALING_FACTOR:\n",
" supercell = create_supercell(material, scaling_factor=SCALING_FACTOR)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2795d5bdbbaafbe6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d8f41816d0b48edc"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aea078560283ca95",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a212abe25bf59b4f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"set_materials(supercell)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cdaf612bc6198546",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_terrace_defect.ipynb b/other/materials_designer/create_terrace_defect.ipynb
index 5cd58ac7..61f60afd 100644
--- a/other/materials_designer/create_terrace_defect.ipynb
+++ b/other/materials_designer/create_terrace_defect.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Terrace Defect on a Slab\n",
"\n",
@@ -18,29 +20,26 @@
"## Notes\n",
"\n",
"1. The input material must be a Slab, or slab will be generated with provided parameters."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f5ca6879c3872454"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
"The cut direction, pivot coordinate, and number of added layers define the terrace defect, shown in the image below.\n",
"\n",
"
"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ff0f33c4e6ac1303"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"MATERIAL_INDEX = 0 # Which material to use from input list\n",
@@ -64,24 +63,23 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [3, 3, 1] # Structure repeat in view"
- ],
- "id": "581cb3ccf2a95f8a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ac4ec25db74d75f4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -93,48 +91,46 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "38574beae9a769cd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c0eab57550f40708"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"material = materials[MATERIAL_INDEX]"
- ],
- "id": "2eed23af0ec63634",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 1.4. Create a slab if the input material is not a slab",
- "id": "2c0d3e29ca42f099"
+ "id": "7",
+ "metadata": {},
+ "source": [
+ "### 1.4. Create a slab if the input material is not a slab"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab_if_not, SlabConfiguration\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration\n",
+ "from mat3ra.made.tools.helpers import create_slab_if_not\n",
"\n",
"default_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=material,\n",
@@ -144,23 +140,22 @@
")\n",
"\n",
"slab = create_slab_if_not(material, default_slab_config)"
- ],
- "id": "92ad17e2b0032fda",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 1.5. Visualize slab"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "916c8b16e01f86ff"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
@@ -168,29 +163,25 @@
" print(\"Initial slab structure:\")\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "16bb968a93de4b9",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 2. Create target material\n",
"### 2.1. Set up terrace configuration and builder\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9edaa3afb28ee0ad"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.terrace.helpers import create_terrace\n",
+ "from mat3ra.made.tools.helpers import create_terrace\n",
"\n",
"terrace_slab = create_terrace(\n",
" slab=slab,\n",
@@ -200,22 +191,22 @@
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES,\n",
" rotate_to_match_pbc=ROTATE_TO_MATCH_PBC\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c318fd03c7e667df",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 2.2. Print the parameters of the created terrace defect",
- "id": "8547862478ab0c7f"
+ "id": "13",
+ "metadata": {},
+ "source": [
+ "## 2.2. Print the parameters of the created terrace defect"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"\n",
"print(\"\\nTerrace defect created with:\")\n",
@@ -223,59 +214,47 @@
"print(f\"Pivot point: {PIVOT_COORDINATE}\")\n",
"print(f\"Added layers: {NUMBER_OF_ADDED_LAYERS}\")\n",
"print(f\"Number of atoms: {len(terrace_slab.basis.elements.ids)}\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "256bc04ff0aa1810",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9bee7a912a90e33c"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"Final structure with terrace:\")\n",
"visualize_materials(terrace_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
"visualize_materials(terrace_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4ffdd8589b02de16",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "17",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d65865cbab99478"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(terrace_slab)"
- ],
- "id": "a57ecc6fe9c89ceb",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_twisted_interface_with_commensurate_lattices.ipynb b/other/materials_designer/create_twisted_interface_with_commensurate_lattices.ipynb
index 15d28cfa..e40871aa 100644
--- a/other/materials_designer/create_twisted_interface_with_commensurate_lattices.ipynb
+++ b/other/materials_designer/create_twisted_interface_with_commensurate_lattices.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "536d623ca076bbdd",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
" # Create a Twisted Interface with Commensurate Lattices\n",
"\n",
@@ -39,10 +37,8 @@
},
{
"cell_type": "markdown",
- "id": "cc65bd914eecf844",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
@@ -51,10 +47,10 @@
},
{
"cell_type": "code",
- "id": "be4987fdf0286ebb",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection and basic parameters\n",
"FILM_INDEX = 0 # Index in the list of materials, to access as materials[FILM_INDEX]\n",
@@ -81,16 +77,12 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"VISUALIZE_REPETITIONS = [3, 3, 1]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5ffda79fd5cad69",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"Explanation is [here](under_the_hood.ipynb#1.2.-Install-packages)."
@@ -98,10 +90,10 @@
},
{
"cell_type": "code",
- "id": "9f851434739f468a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -112,16 +104,12 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "111e138010f911c",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input materials\n",
"Explanation is [here](under_the_hood.ipynb#2.-Data-Exchange)."
@@ -129,24 +117,20 @@
},
{
"cell_type": "code",
- "id": "d3a815612098f191",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8a01e2ba7092ecbe",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
" ## 2. Prepare Materials\n",
" ### 2.1. Select and visualize initial materials"
@@ -154,10 +138,10 @@
},
{
"cell_type": "code",
- "id": "c920d29700ada27a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
@@ -168,16 +152,12 @@
" visualize_materials(film, repetitions=VISUALIZE_REPETITIONS)\n",
" if substrate is not film:\n",
" visualize_materials(substrate, repetitions=VISUALIZE_REPETITIONS)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ce38ef341148321",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 3. Create Twisted Interface\n",
"### 3.1. Create slab and commensurate interface\n"
@@ -185,14 +165,14 @@
},
{
"cell_type": "code",
- "id": "d48726a8e99c5590",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.esse.models.core.reusable.axis_enum import AxisEnum\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.interface.helpers import create_commensurate_interface\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_interface_commensurate as create_commensurate_interface\n",
"\n",
"# Create slab from the material\n",
"slab = create_slab(\n",
@@ -216,26 +196,22 @@
" direction=AxisEnum[STACKING_DIRECTION], # Stacking direction for the interface\n",
" gap=INTERFACE_DISTANCE, # Gap between layers\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "211084a2225f5e98",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"### 3.2. Interface creation results\n"
]
},
{
"cell_type": "code",
- "id": "51acc60bf57a26d5",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"# The interface was created above using create_commensurate_interface\n",
"print(\"\\\\nInterface created successfully!\")\n",
@@ -249,16 +225,12 @@
" print(\"\\\\nVisualizing the created interface:\")\n",
" visualize_materials(interface, repetitions=[1, 1, 1])\n",
" visualize_materials(interface, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "370d3acc33cb8907",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Preview the selected material\n",
"By default, the first interface is selected. You can change the selection by changing the `selected_interface` index."
@@ -266,10 +238,10 @@
},
{
"cell_type": "code",
- "id": "8fa34c8952f76602",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"# The interface is already created above, so just display final results\n",
"selected_interface = interface\n",
@@ -284,33 +256,27 @@
"print(\"\\\\nFinal interface visualization:\")\n",
"visualize_materials(selected_interface, repetitions=[1, 1, 1])\n",
"visualize_materials(selected_interface, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "87b8655d47b47019",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"### 5. Pass data to the outside runtime\n"
]
},
{
"cell_type": "code",
- "id": "28bebacd2e299c2c",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(selected_interface)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/create_twisted_interface_with_nanoribbons.ipynb b/other/materials_designer/create_twisted_interface_with_nanoribbons.ipynb
index ce76d0d6..74e9bb0b 100644
--- a/other/materials_designer/create_twisted_interface_with_nanoribbons.ipynb
+++ b/other/materials_designer/create_twisted_interface_with_nanoribbons.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a Twisted Interface between Nanoribbons\n",
"\n",
@@ -26,27 +28,24 @@
"1. The top nanoribbon is rotated by the specified twist angle.\n",
"1. Vacuum is added along x and y directions to isolate the ribbons.\n",
"1. For more information, see [Introduction](Introduction.ipynb)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "66b6951c7a25247c"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
"Set the following flags to control the notebook behavior\n"
- ],
- "id": "edec1dd3f8ff0782"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection and basic parameters\n",
"FILM_INDEX = 0 # Index in the list of materials, to access as materials[FILM_INDEX]\n",
@@ -68,25 +67,23 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"VISUALIZE_REPETITIONS = [3, 3, 1]"
- ],
- "id": "746db0506f54aeb1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"Explanation is [here](under_the_hood.ipynb#1.2.-Install-packages)."
- ],
- "id": "7e386d88600feb21"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -97,48 +94,44 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"\")"
- ],
- "id": "e5ab0c9b90ba9901",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input materials\n",
"Explanation is [here](under_the_hood.ipynb#2.-Data-Exchange)."
- ],
- "id": "b38044cae8eca705"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "id": "d117934379d38f08",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
" ## 2. Prepare Materials\n",
" ### 2.1. Select and visualize initial materials"
- ],
- "id": "90d5d8e7cf4f4378"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
@@ -149,29 +142,27 @@
" visualize_materials(film, repetitions=VISUALIZE_REPETITIONS)\n",
" if substrate is not film:\n",
" visualize_materials(substrate, repetitions=VISUALIZE_REPETITIONS)"
- ],
- "id": "d934062047d9cef",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 3. Generate Twisted Interface\n",
"### 3.1. Set up interface configuration and builder\n"
- ],
- "id": "7dc8fddf36069105"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import create_twisted_interface\n",
+ "from mat3ra.made.tools.helpers import create_interface_twisted\n",
"# Create nanoribbons from the materials first\n",
- "from mat3ra.made.tools.build.nanoribbon.helpers import create_nanoribbon\n",
+ "from mat3ra.made.tools.helpers import create_nanoribbon\n",
"\n",
"# Create nanoribbons for both materials\n",
"nanoribbon1 = create_nanoribbon(\n",
@@ -191,7 +182,7 @@
")\n",
"\n",
"# Create the twisted interface using the manual approach\n",
- "interface = create_twisted_interface(\n",
+ "interface = create_interface_twisted(\n",
" material1=nanoribbon1,\n",
" material2=nanoribbon2,\n",
" angle=TARGET_TWIST_ANGLE,\n",
@@ -199,22 +190,22 @@
" vacuum_y=VACUUM_Y,\n",
" gap=INTERFACE_DISTANCE,\n",
")"
- ],
- "id": "28ed39605a8b29e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 3.2. Generate and analyze interfaces\n",
- "id": "53ced0bb45a414d5"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "### 3.2. Generate and analyze interfaces\n"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"# The interface was already created above using the manual approach\n",
"print(\"\\\\nInterface created successfully!\")\n",
@@ -229,47 +220,44 @@
" print(\"\\\\nVisualizing the created interface:\")\n",
" visualize_materials(interface, repetitions=[1, 1, 1])\n",
" visualize_materials(interface, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "id": "5b234db939623503",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Preview the selected material\n",
"By default, the first interface is selected. You can change the selection by changing the `selected_interface` index."
- ],
- "id": "3deba4978643a165"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 5. Pass data to the outside runtime\n",
- "id": "b1d073366e81aeaf"
+ "id": "14",
+ "metadata": {},
+ "source": [
+ "### 5. Pass data to the outside runtime\n"
+ ]
},
{
- "metadata": {
- "collapsed": false
- },
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"interface.name += f\" ({TARGET_TWIST_ANGLE} degrees)\"\n",
"set_materials(interface)"
- ],
- "id": "4660ac6aad47b522",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "code",
- "source": "",
- "id": "b231dde70694dd41",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": []
}
],
"metadata": {
diff --git a/other/materials_designer/custom_transformation.ipynb b/other/materials_designer/custom_transformation.ipynb
index f4aa1bb4..b57f3b39 100644
--- a/other/materials_designer/custom_transformation.ipynb
+++ b/other/materials_designer/custom_transformation.ipynb
@@ -2,24 +2,22 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Development Notebook\n",
"\n",
"This notebook enables loading materials and performing custom transformations with Python. The transformed materials can then be passed to the Materials Designer or saved to a folder. Necessary packages are installed and imported below.\n",
"## 1. Setup Notebook\n",
"### 1.1 Install packages"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "36708f17f40b64cb"
+ ]
},
{
"cell_type": "code",
- "id": "initial_id",
- "metadata": {
- "collapsed": true
- },
+ "execution_count": null,
+ "id": "1",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -31,108 +29,102 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.2 Import necessary packages"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8185aca94726dc8f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material class to hold structural data\n",
"from mat3ra.made.material import Material\n",
"# Materials class with JSONs of selected materials\n",
"from mat3ra.standata.materials import Materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b2fa69b96b195d30",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"## 2. Load materials\n",
"From the Materials Designer list, \"uploads\" folder, or Standata."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c783d38d94a627e4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
- "materials = get_materials(globals()) or [Material(Materials.get_by_name_first_match(\"Graphene\"))]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "54e68de6c6cc3e03",
- "outputs": [],
- "execution_count": null
+ "materials = get_materials(globals()) or [Material.create(Materials.get_by_name_first_match(\"Graphene\"))]"
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"## 3. Transform materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6ca73dec2609be4a"
+ ]
},
{
"cell_type": "code",
- "source": "new_material = materials[0]",
- "metadata": {
- "collapsed": false
- },
- "id": "91069f5712a65dbb",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "new_material = materials[0]"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 4. Preview transformed materials",
- "id": "eab6d997ef1eafd4"
+ "id": "8",
+ "metadata": {},
+ "source": [
+ "## 4. Preview transformed materials"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"visualize_materials(new_material, viewer=\"wave\")"
- ],
- "id": "1029505318aa3656",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 5. Save transformed materials",
- "metadata": {
- "collapsed": false
- },
- "id": "296f89e8dde270ed"
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "## 5. Save transformed materials"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
@@ -140,13 +132,7 @@
"set_materials(new_material)\n",
"# for idx, material in enumerate(new_materials):\n",
"# download_content_to_file(new_materials, f\"new_material_{idx}.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7973f7ee67bdc42a",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/import_material_from_jarvis_db_entry.ipynb b/other/materials_designer/import_material_from_jarvis_db_entry.ipynb
index 9aed8797..29296911 100644
--- a/other/materials_designer/import_material_from_jarvis_db_entry.ipynb
+++ b/other/materials_designer/import_material_from_jarvis_db_entry.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
- "id": "826fcc4c",
+ "id": "0",
"metadata": {},
"source": [
"# Import 2D material from JARVIS database\n",
@@ -27,7 +27,7 @@
},
{
"cell_type": "markdown",
- "id": "4299768d",
+ "id": "1",
"metadata": {},
"source": [
"## 1. Set Parameters"
@@ -35,21 +35,21 @@
},
{
"cell_type": "code",
- "id": "9c1f4e9e",
+ "execution_count": null,
+ "id": "2",
"metadata": {},
+ "outputs": [],
"source": [
"# Note: JVASP-670 is an entry for MoTe2 and JVASP-6838 is an entry for GaTe\n",
"JARVIS_IDS = [\n",
" \"JVASP-670\",\n",
" \"JVASP-6838\",\n",
"]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8b00ab6854f2263b",
+ "id": "3",
"metadata": {},
"source": [
"## 2. Install Packages"
@@ -57,10 +57,10 @@
},
{
"cell_type": "code",
- "id": "ef2b38a5-de7e-419e-b605-110e9e0095f5",
- "metadata": {
- "trusted": true
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -72,13 +72,11 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"import_material_from_jarvis_db_entry.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "f418c51a7f794f9f",
+ "id": "5",
"metadata": {},
"source": [
"## 3. Data Processing\n",
@@ -88,11 +86,10 @@
},
{
"cell_type": "code",
- "id": "b1ee775d1476f884",
- "metadata": {
- "collapsed": false,
- "trusted": true
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"import pandas as pd\n",
"from jarvis.db.figshare import data\n",
@@ -102,13 +99,11 @@
"dataframe_2d = pd.DataFrame(dft_2d)\n",
"dataframe_3d = pd.DataFrame(dft_3d)\n",
"dataframe = pd.concat([dataframe_2d, dataframe_3d])"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "57b0d358",
+ "id": "7",
"metadata": {},
"source": [
"### 3.2. Preview the dataframe"
@@ -116,17 +111,17 @@
},
{
"cell_type": "code",
- "id": "0e34472a",
+ "execution_count": null,
+ "id": "8",
"metadata": {},
+ "outputs": [],
"source": [
"dataframe"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "15fe5f9de299c935",
+ "id": "9",
"metadata": {},
"source": [
"### 3.3. Filter data"
@@ -134,8 +129,10 @@
},
{
"cell_type": "code",
- "id": "a771a36a",
+ "execution_count": null,
+ "id": "10",
"metadata": {},
+ "outputs": [],
"source": [
"import json\n",
"from express import ExPrESS\n",
@@ -143,13 +140,11 @@
"dataframe_entries_for_jarvis_ids = dataframe[(dataframe[\"jid\"].isin(JARVIS_IDS))]\n",
"dataframe_entries_as_json = dataframe_entries_for_jarvis_ids.to_json(orient=\"records\")\n",
"jarvis_db_entries = json.loads(dataframe_entries_as_json)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ef5f9e9d",
+ "id": "11",
"metadata": {},
"source": [
"### 3.4. Convert to ESSE format"
@@ -157,11 +152,10 @@
},
{
"cell_type": "code",
- "id": "c41fb68c6d25fe48",
- "metadata": {
- "collapsed": false,
- "trusted": true
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"def convert_jarvis_entry_to_esse(jarvis_db_entry):\n",
" jarvis_db_entry_json = json.dumps(jarvis_db_entry)\n",
@@ -178,13 +172,11 @@
"\n",
"esse_entries = list(map(lambda e: convert_jarvis_entry_to_esse(e)[0], jarvis_db_entries))\n",
"poscars = list(map(lambda e: convert_jarvis_entry_to_esse(e)[1], jarvis_db_entries))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8770ec48",
+ "id": "13",
"metadata": {},
"source": [
"### 3.5. Preview the data"
@@ -192,8 +184,10 @@
},
{
"cell_type": "code",
- "id": "860b5c1b",
+ "execution_count": null,
+ "id": "14",
"metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"from mat3ra.made.tools.convert import from_poscar\n",
@@ -205,13 +199,11 @@
"materials = [Material.create(from_poscar(poscar)) for poscar in poscars]\n",
"\n",
"visualize_materials(materials)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a4a48479c7ea090f",
+ "id": "15",
"metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
@@ -219,15 +211,15 @@
},
{
"cell_type": "code",
- "id": "00b187ab",
+ "execution_count": null,
+ "id": "16",
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(materials)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -247,13 +239,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/materials_designer/import_materials_from_files.ipynb b/other/materials_designer/import_materials_from_files.ipynb
index e89afed1..61f57625 100644
--- a/other/materials_designer/import_materials_from_files.ipynb
+++ b/other/materials_designer/import_materials_from_files.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
- "id": "826fcc4c",
+ "id": "0",
"metadata": {},
"source": [
"# Import materials from files in multiple formats (CIF, POSCAR, etc.)\n",
@@ -29,7 +29,7 @@
},
{
"cell_type": "markdown",
- "id": "4299768d",
+ "id": "1",
"metadata": {},
"source": [
"## 1. Set Parameters"
@@ -37,8 +37,10 @@
},
{
"cell_type": "code",
- "id": "9c1f4e9e",
+ "execution_count": null,
+ "id": "2",
"metadata": {},
+ "outputs": [],
"source": [
"# Upload files to this folder\n",
"FOLDER_PATH = \"./uploads\"\n",
@@ -52,13 +54,11 @@
"\n",
"# If set to true, the supported formats and required extensions will be printed below\n",
"SHOW_SUPPORTED_FORMATS = False"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8b00ab6854f2263b",
+ "id": "3",
"metadata": {},
"source": [
"## 2. Install Packages"
@@ -66,10 +66,10 @@
},
{
"cell_type": "code",
- "id": "ef2b38a5-de7e-419e-b605-110e9e0095f5",
- "metadata": {
- "trusted": true
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"if sys.platform == \"emscripten\":\n",
@@ -78,13 +78,11 @@
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
" await install_packages(\"import_materials_from_files.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "f418c51a7f794f9f",
+ "id": "5",
"metadata": {},
"source": [
"## 3. Data Processing\n",
@@ -94,11 +92,10 @@
},
{
"cell_type": "code",
- "id": "b1ee775d1476f884",
- "metadata": {
- "collapsed": false,
- "trusted": true
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"import os\n",
"from pathlib import Path\n",
@@ -124,30 +121,30 @@
" else:\n",
" unreadable_file_names.append(file_name)\n",
" print(\"Failed to read:\", file_name)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "57b0d358",
+ "id": "7",
"metadata": {},
- "source": "### 3.2. List imported the data"
+ "source": [
+ "### 3.2. List imported the data"
+ ]
},
{
"cell_type": "code",
- "id": "0e34472a",
+ "execution_count": null,
+ "id": "8",
"metadata": {},
+ "outputs": [],
"source": [
"print(f\"Successfully read {len(ase_atoms)} files: {readable_file_names}. \")\n",
"print(f\"Unreadable files: {unreadable_file_names}. \")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "15fe5f9de299c935",
+ "id": "9",
"metadata": {},
"source": [
"### 3.3. Troubleshoot data"
@@ -155,8 +152,10 @@
},
{
"cell_type": "code",
- "id": "a771a36a",
+ "execution_count": null,
+ "id": "10",
"metadata": {},
+ "outputs": [],
"source": [
"from ase.io.formats import ioformats\n",
"import pandas as pd\n",
@@ -166,13 +165,11 @@
" data = [[frmt.name, frmt.extensions, frmt.description] for frmt in ioformats.values()]\n",
" dataframe = pd.DataFrame(data, columns=[\"Format Name\", \"File Extensions\", \"Description\"])\n",
" print(dataframe.to_markdown())"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ef5f9e9d",
+ "id": "11",
"metadata": {},
"source": [
"### 3.4. Convert to ESSE format"
@@ -180,11 +177,10 @@
},
{
"cell_type": "code",
- "id": "c41fb68c6d25fe48",
- "metadata": {
- "collapsed": false,
- "trusted": true
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"import io\n",
"from ase import Atoms\n",
@@ -226,13 +222,11 @@
" return None\n",
"\n",
"esse_entries = [entry for entry in map(convert_ase_entry_to_esse, ase_atoms) if entry is not None]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8770ec48",
+ "id": "13",
"metadata": {},
"source": [
"### 3.5. Preview the data"
@@ -240,8 +234,10 @@
},
{
"cell_type": "code",
- "id": "860b5c1b",
+ "execution_count": null,
+ "id": "14",
"metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"from mat3ra.made.material import Material\n",
@@ -249,13 +245,11 @@
"materials = [Material(esse_entry) for esse_entry in esse_entries]\n",
"\n",
"visualize_materials(materials, viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a4a48479c7ea090f",
+ "id": "15",
"metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
@@ -263,15 +257,15 @@
},
{
"cell_type": "code",
- "id": "00b187ab",
+ "execution_count": null,
+ "id": "16",
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(materials)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -291,13 +285,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
diff --git a/other/materials_designer/import_materials_from_standata.ipynb b/other/materials_designer/import_materials_from_standata.ipynb
index 83c23a9f..7ad990f1 100644
--- a/other/materials_designer/import_materials_from_standata.ipynb
+++ b/other/materials_designer/import_materials_from_standata.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Import materials from Standata\n",
"\n",
@@ -13,24 +15,22 @@
"2. Run the second cell to get the list of available materials.\n",
"3. Run the third cell to select a material by name.\n",
"4. Run the fourth cell to select materials by categories\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ffad30f04755fde0"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Install the required libraries"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3a21510793fa71f1"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -43,52 +43,44 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7a8c49f4612498a6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"## 2. Get materials\n",
"### 2.1. List the names of available materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bd6a3ff0c7b23744"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"\n",
"Materials.get_names()"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "494aa9dceabed0e1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 2.2. Select a material by name\n",
"A partial name match can be used to select a material."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c29a8101462297ad"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.visualize import visualize_materials\n",
@@ -98,26 +90,22 @@
"material_by_name = Material.create(Materials.get_by_name(\"Graphene\")[0])\n",
"material_by_name_first_match = Material.create(Materials.get_by_name_first_match(\"Graphene\"))\n",
"visualize_materials([material_by_name, material_by_name_first_match], viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a570e2668e86dfab",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 2.3. Select materials by categories"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "456456a81a911d66"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"materials_2d_jsons = Materials.get_by_categories(\"2D\")\n",
"materials_2d = [Material.create(material_json) for material_json in materials_2d_jsons]\n",
@@ -127,37 +115,27 @@
"\n",
"visualize_materials(materials_2d)\n",
"visualize_materials(materials_3d_insulator)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5f192496ce7776af",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"## 3. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "937e08e1120711f0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(materials_2d + materials_3d_insulator)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "dcb45a2daead9d55",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/optimize_film_position.ipynb b/other/materials_designer/optimize_film_position.ipynb
index 721c445e..0c7346bb 100644
--- a/other/materials_designer/optimize_film_position.ipynb
+++ b/other/materials_designer/optimize_film_position.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Optimize Interface Film Position\n",
"\n",
@@ -23,14 +25,14 @@
"\n",
"## 1. Prepare the Environment\n",
"### 1.1. Install Packages\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4dc7b2ed495d66e0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "1",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -42,26 +44,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "dd86bee2985f1b50",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.2. Set optimization parameters\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cca70ab27ef1d01d"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"MATERIAL_INDEX = 0 # Index of the material to optimize\n",
"# Grid parameters\n",
@@ -73,77 +71,65 @@
"# Visualization parameters\n",
"SHOW_3D_LANDSCAPE = False # Whether to show 3D energy landscape\n",
"STRUCTURE_REPETITIONS = [3, 3, 1] # Repetitions for structure visualization\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "12878fd61f5a6b13",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"## 3. Load Material\n",
"### 3.1. Make sure that loaded material is an interface material (atoms must have labels \"0\" for the substrate and \"1\" for the film)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "463af646361cd982"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"\n",
"materials = get_materials(globals())\n",
"interface_material = materials[MATERIAL_INDEX]\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "3d982a1ca641f0d8",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 3.2. Visualize the Material\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e920a6dd4906d8e8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"visualize_materials([interface_material], repetitions=STRUCTURE_REPETITIONS)\n",
"visualize_materials([interface_material], repetitions=STRUCTURE_REPETITIONS, rotation='-90x')"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5f4afdb7ac0c865b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 3.3. Optimize Film Position"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "90255d774f62d1da"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.build.interface import get_optimal_film_displacement\n",
"from mat3ra.made.tools.modify import interface_displace_part\n",
@@ -174,27 +160,23 @@
")\n",
"\n",
"print(f\"\\nOptimal displacement vector: {optimal_displacement}\")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "eb0b6e59c24dda4",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"## 4. Visualize Results\n",
"### 4.1. Plot Energy Landscape"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2945179d3729935d"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.utils.jupyterlite.plot import plot_2d_heatmap, plot_3d_surface\n",
"\n",
@@ -211,26 +193,22 @@
" displacement=optimal_displacement,\n",
" use_cartesian_coordinates=USE_CARTESIAN\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "41ac6b383001db6b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"### 4.1. Visualize Original and Optimized Materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "82a1af573c6ca0e9"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"\\nVisualization of original and optimized materials:\")\n",
"visualize_materials([interface_material, optimized_material],\n",
@@ -238,38 +216,28 @@
"visualize_materials([interface_material, optimized_material],\n",
" repetitions=STRUCTURE_REPETITIONS,\n",
" rotation='-90x')\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e7972543ae747b68",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"## 5. Save Results\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b4f6308e795e4f3c"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"optimized_material.name = f\"{interface_material.name} Optimized XY\"\n",
"set_materials(optimized_material)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c81ec652fbb64316",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/passivate_edge.ipynb b/other/materials_designer/passivate_edge.ipynb
index 6f3ea75c..b8fd15d8 100644
--- a/other/materials_designer/passivate_edge.ipynb
+++ b/other/materials_designer/passivate_edge.ipynb
@@ -2,18 +2,14 @@
"cells": [
{
"cell_type": "markdown",
- "id": "759c70b8d39addc3",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": []
},
{
"cell_type": "markdown",
- "id": "4f5cab1ebbbe954",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"# Create Edge Passivation\n",
"Passivate material edges by detecting and adding passivants to undercoordinated atoms (atoms with fewer neighbors than bulk).\n",
@@ -35,7 +31,7 @@
},
{
"cell_type": "markdown",
- "id": "f63b28f159207878",
+ "id": "2",
"metadata": {},
"source": [
"## 1. Prepare the Environment\n",
@@ -48,8 +44,10 @@
},
{
"cell_type": "code",
- "id": "7e8d8696bb1035e5",
+ "execution_count": null,
+ "id": "3",
"metadata": {},
+ "outputs": [],
"source": [
"# Enable interactive selection of coordination threshold\n",
"IS_COORDINATION_SELECTION_INTERACTIVE = False\n",
@@ -71,16 +69,12 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "975da798561ccde8",
- "metadata": {
- "collapsed": false
- },
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`.\n"
@@ -88,10 +82,10 @@
},
{
"cell_type": "code",
- "id": "4b010bef5b031158",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -103,26 +97,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "7df321ca07e11daa",
- "metadata": {
- "collapsed": false
- },
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input material\n"
]
},
{
"cell_type": "code",
- "id": "3a53ff74253cb09a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"from utils.visualize import visualize_materials\n",
@@ -134,16 +124,12 @@
" print(\"Initial nanoribbon structure:\")\n",
" visualize_materials(nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
" visualize_materials(nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "b5940fc50c11c7b8",
- "metadata": {
- "collapsed": false
- },
+ "id": "8",
+ "metadata": {},
"source": [
"## 2. Analyze Coordination Numbers and Select Threshold\n",
"### 2.1. Plot RDF to estimate coordination search radius"
@@ -151,37 +137,33 @@
},
{
"cell_type": "code",
- "id": "575e8fba623c06e4",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_rdf\n",
"\n",
"plot_rdf(nanoribbon, cutoff=10.0)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "b89dc754926f1ce4",
- "metadata": {
- "collapsed": false
- },
+ "id": "10",
+ "metadata": {},
"source": [
"### 2.2. Get coordination numbers and set coordination threshold"
]
},
{
"cell_type": "code",
- "id": "54c265d8ca9408af",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.io import select_coordination_threshold\n",
- "from mat3ra.made.tools.build.passivation.helpers import get_unique_coordination_numbers, get_coordination_numbers_distribution\n",
+ "from mat3ra.made.tools.helpers import get_unique_coordination_numbers, get_coordination_numbers_distribution\n",
"\n",
"coordination_search_radius = None # Change this value according to the RDF plot if needed, Angstroms.\n",
"cutoff = coordination_search_radius or COORDINATION_SEARCH_RADIUS\n",
@@ -207,16 +189,12 @@
"\n",
"print(f\"\\nSelected coordination threshold: {coordination_threshold}\")\n",
"print(f\"Atoms with coordination <= {coordination_threshold} will be passivated\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "b873d2cb6eaa2bdb",
- "metadata": {
- "collapsed": false
- },
+ "id": "12",
+ "metadata": {},
"source": [
"## 3. Create Passivated Material\n",
"### 3.1. Set up passivation parameters\n"
@@ -224,10 +202,10 @@
},
{
"cell_type": "code",
- "id": "aca1c76a52e5376a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"passivation_params = {\n",
" \"shadowing_radius\": COORDINATION_SEARCH_RADIUS,\n",
@@ -241,28 +219,24 @@
"print(f\" Coordination threshold: {passivation_params['coordination_threshold']}\")\n",
"print(f\" Number of bonds to passivate: {passivation_params['number_of_bonds_to_passivate']}\")\n",
"print(f\" Symmetry tolerance: {passivation_params['symmetry_tolerance']}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "e40b5f67ef5b54aa",
- "metadata": {
- "collapsed": false
- },
+ "id": "14",
+ "metadata": {},
"source": [
"### 3.2. Generate passivated structure\n"
]
},
{
"cell_type": "code",
- "id": "3c36dc3654f544c1",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.passivation.helpers import passivate_dangling_bonds\n",
+ "from mat3ra.made.tools.helpers import passivate_dangling_bonds\n",
"\n",
"passivated_nanoribbon = passivate_dangling_bonds(\n",
" material=nanoribbon,\n",
@@ -277,58 +251,48 @@
"print(f\"Original atoms: {len(nanoribbon.basis.elements.ids)}\")\n",
"print(f\"Final atoms: {len(passivated_nanoribbon.basis.elements.ids)}\")\n",
"print(f\"Passivant atoms added: {len(passivated_nanoribbon.basis.elements.ids) - len(nanoribbon.basis.elements.ids)}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ad96b86aef8b28f5",
- "metadata": {
- "collapsed": false
- },
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Visualize the result"
]
},
{
"cell_type": "code",
- "id": "d08ff21e3650ba5d",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"Final passivated structure:\")\n",
"visualize_materials(passivated_nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
"visualize_materials(passivated_nanoribbon, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "7151e48eae3b1886",
- "metadata": {
- "collapsed": false
- },
+ "id": "18",
+ "metadata": {},
"source": [
"## 5. Pass data to the outside runtime\n"
]
},
{
"cell_type": "code",
- "id": "2d69736d0c71858c",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "19",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"passivated_nanoribbon.name = f\"{nanoribbon.name} {PASSIVANT}-passivated\"\n",
"set_materials(passivated_nanoribbon)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/passivate_slab.ipynb b/other/materials_designer/passivate_slab.ipynb
index cf7c1203..7d19de4a 100644
--- a/other/materials_designer/passivate_slab.ipynb
+++ b/other/materials_designer/passivate_slab.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "7d00c63281a63fa0",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Passivate Slab Surface\n",
"\n",
@@ -28,10 +26,8 @@
},
{
"cell_type": "markdown",
- "id": "d80280b47f767281",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
@@ -44,10 +40,10 @@
},
{
"cell_type": "code",
- "id": "92b3518bebdcf547",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"MATERIAL_INDEX = 0 # Which material to use from input list\n",
@@ -75,16 +71,12 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "11bd9b5fca1510fc",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
@@ -92,10 +84,10 @@
},
{
"cell_type": "code",
- "id": "42863fe84bfab53c",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -108,53 +100,46 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6983ab284dff18c0",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input material"
]
},
{
"cell_type": "code",
- "id": "a51551f4af6456c7",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import get_materials\n",
"from utils.visualize import visualize_materials\n",
"\n",
"materials = get_materials(globals())"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6b929ffec7c4876e",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create a slab if the input material is not a slab"
]
},
{
"cell_type": "code",
- "id": "ad71f877f76f0550",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab_if_not, SlabConfiguration\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration\n",
+ "from mat3ra.made.tools.helpers import create_slab_if_not\n",
"from mat3ra.made.tools.modify import translate_to_z_level\n",
"\n",
"material = materials[MATERIAL_INDEX]\n",
@@ -172,16 +157,12 @@
" print(\"Initial slab structure:\")\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "cee250785246811a",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create target material\n",
"### 2.1. Passivate the slab surface\n"
@@ -189,13 +170,13 @@
},
{
"cell_type": "code",
- "id": "a4ed473eb2129ac4",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.passivation.helpers import passivate_surface\n",
- "from mat3ra.made.tools.enums import SurfaceTypesEnum\n",
+ "from mat3ra.made.tools.helpers import passivate_surface\n",
+ "from mat3ra.made.tools.helpers import SurfaceTypesEnum\n",
"\n",
"passivated_slab = passivate_surface(\n",
" slab,\n",
@@ -211,57 +192,47 @@
"print(f\"Bond length: {BOND_LENGTH} Å\")\n",
"print(f\"Surfaces passivated: {SURFACE}\")\n",
"print(f\"Number of atoms: {len(passivated_slab.basis.elements.ids)}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "56ec05c6ed2f91cd",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
]
},
{
"cell_type": "code",
- "id": "c4b5e1e0ec0ab02a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"Final passivated structure:\")\n",
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
"visualize_materials(passivated_slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "eab7e14d2c7880a5",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"### 4. Pass data to the outside runtime\n"
]
},
{
"cell_type": "code",
- "id": "d66a15a29d27c6ea",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"set_materials(passivated_slab)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/custom_cutout_etched_silicon.ipynb b/other/materials_designer/specific_examples/custom_cutout_etched_silicon.ipynb
index bf32dd3f..5da95500 100644
--- a/other/materials_designer/specific_examples/custom_cutout_etched_silicon.ipynb
+++ b/other/materials_designer/specific_examples/custom_cutout_etched_silicon.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f2e1e795020d7b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Create a custom-shape cutout (Si)\n",
"\n",
@@ -28,10 +26,8 @@
},
{
"cell_type": "markdown",
- "id": "98aa134f51746218",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Install Packages\n",
@@ -40,10 +36,10 @@
},
{
"cell_type": "code",
- "id": "280f9794a876678b",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -55,26 +51,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "b3d4d3ea7b589f89",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Set up structure parameters "
]
},
{
"cell_type": "code",
- "id": "5177e239254e3601",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Slab parameters\n",
"MILLER_INDICES = (0, 0, 1)\n",
@@ -91,30 +83,26 @@
"CAVITY_TOP_Z = 0.5\n",
"\n",
"NAME = \"Custom Shape - Etching Pattern\""
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "361c291aaf3feb2a",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Create a condition on coordinates\n"
]
},
{
"cell_type": "code",
- "id": "56c8227695643174",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from typing import List\n",
"\n",
- "from mat3ra.made.tools.utils.coordinate import CoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import CoordinateCondition\n",
"\n",
"\n",
"# Example of a custom coordinate condition. Adapt coordinate conditions to your needs.\n",
@@ -176,55 +164,55 @@
" channel_top_z=CHANNEL_TOP_Z,\n",
" cavity_top_z=CAVITY_TOP_Z,\n",
").condition"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 1.4. Get input materials",
- "id": "73bcac566392be2e"
+ "id": "7",
+ "metadata": {},
+ "source": [
+ "### 1.4. Get input materials"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"material_json = Materials.get_by_name_first_match(\"Si\")\n",
"material = Material.create(material_json)"
- ],
- "id": "db7ec34d105a7f63",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 1.5. Preview the material",
- "id": "f85547bcf667a508"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "### 1.5. Preview the material"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize(material, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(material, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "id": "f00247a517992ddf",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "615800437b2ef7a",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 2. Create target material\n",
"### 2.1. Create a slab and visualize it"
@@ -232,10 +220,12 @@
},
{
"cell_type": "code",
- "id": "8938220048670941",
+ "execution_count": null,
+ "id": "12",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slab = create_slab(\n",
" crystal=material,\n",
@@ -248,13 +238,11 @@
")\n",
"\n",
"visualize(slab, viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "b52118b5a4fb494c",
+ "id": "13",
"metadata": {},
"source": [
"### 2.2. Apply the cutout condition and add vacuum"
@@ -262,61 +250,55 @@
},
{
"cell_type": "code",
- "id": "e1a13d9490a4d5ca",
+ "execution_count": null,
+ "id": "14",
"metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import filter_by_condition_on_coordinates, add_vacuum\n",
"resulting_material = filter_by_condition_on_coordinates(slab, condition)\n",
"resulting_material = add_vacuum(resulting_material, VACUUM)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "57cc38ec0df3c1f7",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"## 3. Visualize the result"
]
},
{
"cell_type": "code",
- "id": "20f499a8dd2362e0",
+ "execution_count": null,
+ "id": "16",
"metadata": {},
+ "outputs": [],
"source": [
"visualize(resulting_material, title=\"Resulting Material\", rotation=\"-90x\")\n",
"visualize(resulting_material, viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "c67e6f5363e80942",
- "metadata": {
- "collapsed": false
- },
+ "id": "17",
+ "metadata": {},
"source": [
"# 4. Pass material to the outside runtime"
]
},
{
"cell_type": "code",
- "id": "cbee60d4b936e5cb",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials\n",
"\n",
"resulting_material.name = NAME\n",
"set_materials(resulting_material)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 6a3327f7..b895ff09 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "415ed707e27a6c8e",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# A 2D grain boundary in Boron Nitride\n",
"\n",
@@ -25,10 +23,8 @@
},
{
"cell_type": "markdown",
- "id": "a080006df3785cc5",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
@@ -37,10 +33,10 @@
},
{
"cell_type": "code",
- "id": "338ee3c51155e086",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"MATERIAL_NAME = \"Boron_Nitride\" # Name of the material to import from Standata\n",
@@ -58,16 +54,12 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [3, 3, 1]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6463f9bbcd3be7c7",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
@@ -75,10 +67,10 @@
},
{
"cell_type": "code",
- "id": "7e22d1f4da825575",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -90,41 +82,33 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "4a1cfe15caa44c3e",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input material"
]
},
{
"cell_type": "code",
- "id": "a1635c31132962f6",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "32b3ad775543b06f",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"## 2. Prepare Material\n",
"### 2.1. Select and visualize initial material"
@@ -132,25 +116,21 @@
},
{
"cell_type": "code",
- "id": "61f0870d8104cd21",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"if SHOW_INTERMEDIATE_STEPS:\n",
" visualize_materials(material, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "34d6c7a337f1e40b",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 3. Generate Surface Grain Boundary\n",
"### 3.1. Set up grain boundary configuration and builder\n"
@@ -158,13 +138,13 @@
},
{
"cell_type": "code",
- "id": "33a2c8a9be436745",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.esse.models.core.reusable.axis_enum import AxisEnum\n",
- "from mat3ra.made.tools.build.grain_boundary import create_grain_boundary_linear\n",
+ "from mat3ra.made.tools.helpers import create_grain_boundary_linear\n",
"\n",
"grain_boundary = create_grain_boundary_linear(\n",
" material=material,\n",
@@ -178,81 +158,67 @@
"\n",
"# We need to remove overlapping atoms at the boundary line\n",
"grain_boundary.basis.resolve_colliding_coordinates(tolerance=OVERLAP_TOLERANCE)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "79e9378bf5e144d4",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"### 3.2. Generate and analyze grain boundaries\n"
]
},
{
"cell_type": "code",
- "id": "d7007fe825463e5a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"actual_angle = grain_boundary.metadata.build[-1].configuration.get(\"actual_angle\", \"unknown\")\n",
"print(f\"Target angle: {TARGET_TWIST_ANGLE}°\")\n",
"print(f\"Actual angle: {actual_angle}°\")\n",
"print(f\"Number of atoms: {len(grain_boundary.basis.elements.ids)}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8b2f0574a20089a5",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Preview the grain boundary"
]
},
{
"cell_type": "code",
- "id": "7f558a8e9d417cef",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize_materials(grain_boundary, title=\"Grain Boundary\", viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "afcc004c5878b56f",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"### 5. Pass data to the outside runtime\n"
]
},
{
"cell_type": "code",
- "id": "20e46167358d63",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
"set_materials(grain_boundary)\n",
"download_content_to_file(grain_boundary.to_json(), \"grain_boundary_2d_boron_nitride.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 564a9c39..bb033d75 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "aa0a426af23f6def",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Grain Boundary 3D FCC Metals (Copper)\n",
"\n",
@@ -26,10 +24,8 @@
},
{
"cell_type": "markdown",
- "id": "bff2f2c26b1fa6ba",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
@@ -39,10 +35,10 @@
},
{
"cell_type": "code",
- "id": "45730b0f5384262b",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"MATERIAL_NAME = \"Cu\"\n",
"\n",
@@ -60,16 +56,12 @@
"\n",
"# Maximum area for the superlattice search algorithm\n",
"MAX_AREA = 200 # in Angstrom^2\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "2460242f9e7d86f1",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
@@ -77,10 +69,10 @@
},
{
"cell_type": "code",
- "id": "bae18ae87d3cc5ba",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -92,65 +84,53 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_grain_boundary.ipynb\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "97eb71c0c9e31d2a",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
]
},
{
"cell_type": "code",
- "id": "950e5bef61bbd84a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.tools.build import MaterialWithBuildMetadata\n",
"\n",
"material = MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "c4eb191c2e23b464",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview Material"
]
},
{
"cell_type": "code",
- "id": "4ebde830102b0b94",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([material], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "916ab91fcc23c7df",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create grain boundary\n",
"\n",
@@ -160,22 +140,20 @@
},
{
"cell_type": "markdown",
- "id": "9e507e0b1534c0c5",
- "metadata": {
- "collapsed": false
- },
+ "id": "10",
+ "metadata": {},
"source": [
"### 2.2. Get possible terminations for the slabs"
]
},
{
"cell_type": "code",
- "id": "5bdc0e37e3ec9891",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"phase_1_terminations = get_slab_terminations(material=material, miller_indices=PHASE_1_MILLER_INDICES)\n",
"phase_2_terminations = get_slab_terminations(material=material, miller_indices=PHASE_2_MILLER_INDICES)\n",
@@ -186,57 +164,55 @@
"print(f\"Phase 2 Terminations:\")\n",
"for idx, termination in enumerate(phase_2_terminations):\n",
" print(f\" {idx}: {termination}\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "aebec268223b617c",
- "metadata": {
- "collapsed": false
- },
+ "id": "12",
+ "metadata": {},
"source": [
"### 2.3. Visualize slabs for all possible terminations"
]
},
{
"cell_type": "code",
- "id": "f75092312b399f84",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
- "phase_1_slabs = [create_slab(material, miller_indices=PHASE_1_MILLER_INDICES, termination=termination) for termination\n",
+ "phase_1_slabs = [create_slab(material, miller_indices=PHASE_1_MILLER_INDICES, termination_top=termination) for termination\n",
" in phase_1_terminations]\n",
- "phase_2_slabs = [create_slab(material, miller_indices=PHASE_2_MILLER_INDICES, termination=termination) for termination\n",
+ "phase_2_slabs = [create_slab(material, miller_indices=PHASE_2_MILLER_INDICES, termination_top=termination) for termination\n",
" in phase_2_terminations]\n",
"\n",
"visualize([{\"material\": slab, \"title\": slab.name} for slab in phase_1_slabs],\n",
" repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize([{\"material\": slab, \"title\": slab.name} for slab in phase_2_slabs],\n",
" repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.4. Create slabs with specified Miller indices and thickness",
- "id": "df2fe7c010c0e4d2"
+ "id": "14",
+ "metadata": {},
+ "source": [
+ "### 2.4. Create slabs with specified Miller indices and thickness"
+ ]
},
{
"cell_type": "code",
- "id": "29dd6499",
+ "execution_count": null,
+ "id": "15",
"metadata": {},
+ "outputs": [],
"source": [
"# Create phase 1 slab\n",
"phase_1_slab = create_slab(\n",
" crystal=material,\n",
- " termination=None, # Use default termination\n",
+ " termination_top=None, # Use default termination\n",
" miller_indices=PHASE_1_MILLER_INDICES,\n",
" number_of_layers=PHASE_1_THICKNESS,\n",
" vacuum=0.0,\n",
@@ -246,7 +222,7 @@
"# Create phase 2 slab \n",
"phase_2_slab = create_slab(\n",
" crystal=material,\n",
- " termination=None, # Use default termination\n",
+ " termination_top=None, # Use default termination\n",
" miller_indices=PHASE_2_MILLER_INDICES,\n",
" number_of_layers=PHASE_2_THICKNESS,\n",
" vacuum=0.0,\n",
@@ -256,26 +232,24 @@
"# Visualize the phase slabs\n",
"visualize([{\"material\": phase_1_slab, \"title\": \"Phase 1 Slab\"}, {\"material\": phase_2_slab, \"title\": \"Phase 2 Slab\"}],\n",
" repetitions=[2, 2, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8d87cbbb0d1ac1ab",
- "metadata": {
- "collapsed": false
- },
- "source": "### 2.5. Create Grain Boundary"
+ "id": "16",
+ "metadata": {},
+ "source": [
+ "### 2.5. Create Grain Boundary"
+ ]
},
{
"cell_type": "code",
- "id": "40b6c8662d071f18",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.grain_boundary.helpers import create_grain_boundary_planar\n",
+ "from mat3ra.made.tools.helpers import create_grain_boundary_planar\n",
"\n",
"\n",
"grain_boundary = create_grain_boundary_planar(\n",
@@ -290,51 +264,47 @@
" max_length_tol = 0.05,\n",
" max_angle_tol = 0.02,\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "3c6187f70eb5beac",
- "metadata": {
- "collapsed": false
- },
- "source": "## 3. Visualize the Material"
+ "id": "18",
+ "metadata": {},
+ "source": [
+ "## 3. Visualize the Material"
+ ]
},
{
"cell_type": "code",
- "id": "892c0e7c932cd725",
- "metadata": {
- "collapsed": false
- },
- "source": "visualize([grain_boundary], repetitions=[1, 1, 1], viewer=\"wave\")",
+ "execution_count": null,
+ "id": "19",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "visualize([grain_boundary], repetitions=[1, 1, 1], viewer=\"wave\")"
+ ]
},
{
"cell_type": "markdown",
- "id": "479d26e4a9e77d44",
- "metadata": {
- "collapsed": false
- },
- "source": "## 4. Save the final material"
+ "id": "20",
+ "metadata": {},
+ "source": [
+ "## 4. Save the final material"
+ ]
},
{
"cell_type": "code",
- "id": "503eff0dd5c1a160",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "21",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
"set_materials(grain_boundary)\n",
"download_content_to_file(grain_boundary.to_json(),\n",
" 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_adatom_island_molybdenum_disulfide_platinum.ipynb b/other/materials_designer/specific_examples/defect_point_adatom_island_molybdenum_disulfide_platinum.ipynb
index 3e048010..17e6bf3e 100644
--- a/other/materials_designer/specific_examples/defect_point_adatom_island_molybdenum_disulfide_platinum.ipynb
+++ b/other/materials_designer/specific_examples/defect_point_adatom_island_molybdenum_disulfide_platinum.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f2e1e795020d7b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Pt Adatoms Island on MoS2\n",
"\n",
@@ -25,10 +23,8 @@
},
{
"cell_type": "markdown",
- "id": "5e43ff288847b784",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
@@ -36,11 +32,12 @@
},
{
"cell_type": "code",
- "id": "9d8b1890b34d850a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
+ "\n",
"# Slab parameters\n",
"MATERIAL_NAME = \"MoS2.*2D\" # Name of the material (regex) to be loaded from Standata\n",
"MILLER_INDICES = (0, 0, 1) # Miller indices of the surface\n",
@@ -69,16 +66,12 @@
" [5 / 9, 7 / 9, 0], # 3rd atom, next clockwise atop Mo\n",
" [4 / 9, 5 / 9, 0], # 4th topmost atom, atop S\n",
"]\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "bb64de5ff32649f8",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -86,31 +79,28 @@
},
{
"cell_type": "code",
- "id": "ef664b14457530fd",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
"if sys.platform == \"emscripten\":\n",
" import micropip\n",
"\n",
- " await micropip.install(\"mat3ra-api-examples\", deps=False)\n",
+ " await micropip.install(\n",
+ " \"mat3ra-api-examples\", deps=False)\n",
" await micropip.install('mat3ra-utils')\n",
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "919ad7af8dceeedd",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material\n",
"Materials are loaded with `get_materials()`."
@@ -118,10 +108,10 @@
},
{
"cell_type": "code",
- "id": "be38fdda1984c654",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"from mat3ra.standata.materials import Materials\n",
@@ -132,32 +122,29 @@
"# Preview materials\n",
"visualize_materials([substrate])\n",
"visualize_materials([substrate], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a132fe0ef8bbf0d0",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Slab"
]
},
{
"cell_type": "code",
- "id": "f174b6be",
+ "execution_count": null,
+ "id": "8",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
- "\n",
"slab = create_slab(\n",
" crystal=substrate,\n",
- " termination=None, # Use default termination\n",
+ " termination_top=None, # Use default termination\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers=SLAB_THICKNESS,\n",
" vacuum=VACUUM,\n",
@@ -165,118 +152,110 @@
" xy_supercell_matrix=XY_SUPERCELL_MATRIX\n",
")\n",
"visualize([{\"material\": slab, \"rotation\": \"0x\"}, {\"material\": slab, \"rotation\": \"-90x\"}], repetitions=[1, 1, 1])\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5da5b0380583c952",
- "metadata": {
- "collapsed": false
- },
- "source": "## 2. Create the Defects"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defects"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "#### 2.1. Create the defct dictionaries",
- "id": "174048812b11801e"
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "#### 2.1. Create the defct dictionaries"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "\n",
+ "from mat3ra.made.tools.build.defective_structures.two_dimensional.adatom.types import AdatomDefectDict\n",
"DEFECT_DICTS = [\n",
- " {\n",
- " \"coordinate\": coordinate[0:2],\n",
+ " AdatomDefectDict(**{\n",
+ " \"coordinate_2d\": coordinate[0:2],\n",
" \"distance_z\": DISTANCE_Z_VALUES[i],\n",
" \"element\": CHEMICAL_ELEMENT,\n",
" \"use_cartesian_coordinates\": USE_CARTESIAN_COORDINATES\n",
" # placement method is common for all adatoms\n",
- " }\n",
+ " })\n",
" for i, coordinate in enumerate(COORDINATES)\n",
"]"
- ],
- "id": "15bb5f2376e31ea7",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.2. Create the defects",
- "id": "f31763784a1abb19"
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.2. Create the defects"
+ ]
},
{
"cell_type": "code",
- "id": "e385e50ae11ed2b9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.adatom.helpers import create_multiple_adatom_defects\n",
+ "from mat3ra.made.tools.helpers import create_multiple_adatom_defects\n",
"\n",
"slab_with_adatom = create_multiple_adatom_defects(\n",
" slab=slab,\n",
" defect_dicts=DEFECT_DICTS,\n",
" placement_method=PLACEMENT_METHOD,\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "462549d016073446",
- "metadata": {
- "collapsed": false
- },
+ "id": "14",
+ "metadata": {},
"source": [
"## 3. Visualize the Slabs with Adatom"
]
},
{
"cell_type": "code",
- "id": "509b18661a069e42",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_adatom, \"title\": f\"Material with adatom defect at {PLACEMENT_METHOD} position\"}],\n",
" viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "d381df29a6bbdd82",
- "metadata": {
- "collapsed": false
- },
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
},
{
"cell_type": "code",
- "id": "61daa5afcbc078a9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
"set_materials([slab_with_adatom])\n",
"download_content_to_file(slab_with_adatom.to_json(), \"MoS2_Pt_island.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/defect_point_interstitial_tin_oxide.ipynb b/other/materials_designer/specific_examples/defect_point_interstitial_tin_oxide.ipynb
index bd822e00..25c68833 100644
--- a/other/materials_designer/specific_examples/defect_point_interstitial_tin_oxide.ipynb
+++ b/other/materials_designer/specific_examples/defect_point_interstitial_tin_oxide.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Oxygen interstitial Defect(s) in SnO.\n",
"\n",
@@ -17,26 +19,24 @@
"
\n",
"\n",
"!Note: Voronoi site placement method is used for the interstitial defect, for a precise reproduction relaxation is needed."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f2e1e795020d7b3f"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
"Defect Configuration parameters are described in [Defect Configuration](https://github.com/Exabyte-io/made/blob/8196b759242551c77d1791bf5bd2f4150763cfef/src/py/mat3ra/made/tools/build/defect/configuration.py#L102)."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5e43ff288847b784"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"MATERIAL_NAME = \"SnO\"\n",
"SUPERCELL_MATRIX = [[2, 0, 0], [0, 2, 0], [0, 0, 2]]\n",
@@ -55,27 +55,23 @@
" \"placement_method\": \"voronoi_site\"\n",
" }\n",
"]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9d8b1890b34d850a",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bb64de5ff32649f8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -87,141 +83,150 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "ef664b14457530fd",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "919ad7af8dceeedd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "be38fdda1984c654",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a132fe0ef8bbf0d0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"supercell = create_supercell(material, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e2d24109d3068c9e",
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defects"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "### 2.1. Prepare defect dictionaries and validate them"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "from mat3ra.made.tools.build.defective_structures.zero_dimensional.point_defect.types import PointDefectDict\n",
+ "\n",
+ "defect_dicts = [PointDefectDict(**{\n",
+ " \"type\": defect_config[\"type\"],\n",
+ " \"coordinate\": defect_config[\"coordinate\"],\n",
+ " \"element\": defect_config.get(\"element\", None),\n",
+ " \"placement_method\": defect_config[\"placement_method\"]\n",
+ "}) for defect_config in DEFECT_CONFIGS]"
+ ]
},
{
"cell_type": "markdown",
- "source": "## 2. Create the Defects",
- "metadata": {
- "collapsed": false
- },
- "id": "5da5b0380583c952"
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.2. Create the defects"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.point.helpers import create_multiple_defects\n",
+ "from mat3ra.made.tools.helpers import create_multiple_defects\n",
"\n",
"material_with_defect = create_multiple_defects(\n",
" supercell,\n",
- " defect_dicts=DEFECT_CONFIGS,\n",
+ " defect_dicts=defect_dicts,\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a990fa35742d7269",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "462549d016073446"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": supercell, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defect, \"title\": f\"Material with defect\"}],\n",
" viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "509b18661a069e42",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d381df29a6bbdd82"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
"material_with_defect.name = \"Sn15 O17, Interstitial O Defect\"\n",
"set_materials([material_with_defect])\n",
"download_content_to_file(material_with_defect.to_json(), f\"{material_with_defect.name}.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61daa5afcbc078a9",
- "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 b94d2b2a..c8f54c42 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "4f901763903359e6",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Vacancy and Substitutional defect pair in GaN\n",
"\n",
@@ -16,10 +14,8 @@
},
{
"cell_type": "markdown",
- "id": "7863267c827cfbc2",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
@@ -28,8 +24,10 @@
},
{
"cell_type": "code",
- "id": "f941f8a0bb45817f",
+ "execution_count": null,
+ "id": "2",
"metadata": {},
+ "outputs": [],
"source": [
"from types import SimpleNamespace\n",
"\n",
@@ -48,13 +46,11 @@
" coordinate=[0.5, 0.5, 0.65],\n",
" placement_method=\"closest_site\",\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "808283dd8fe53a58",
+ "id": "3",
"metadata": {},
"source": [
"### 1.2. Install Packages\n",
@@ -63,8 +59,10 @@
},
{
"cell_type": "code",
- "id": "e02d623e22f90fc7",
+ "execution_count": null,
+ "id": "4",
"metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -76,16 +74,12 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "683ce558645b4465",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials\n",
"Materials are loaded with `get_materials()`."
@@ -93,10 +87,10 @@
},
{
"cell_type": "code",
- "id": "4a6bab14f63024d1",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
@@ -104,53 +98,47 @@
"\n",
"material = Material.create(Materials.get_by_name_first_match(\"GaN\"))\n",
"visualize(material)"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "code",
- "id": "c574c219",
- "metadata": {},
- "source": [
- "unit_cell = material\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "acfef1aa207eb977",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
]
},
{
"cell_type": "code",
- "id": "4580fda63efa927e",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
- "supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n",
+ "supercell = create_supercell(material, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defect"
+ ]
},
{
"cell_type": "code",
- "id": "85013c49",
+ "execution_count": null,
+ "id": "10",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.pair_defect.helpers import create_pair_defect\n",
+ "from mat3ra.made.tools.helpers import create_defect_pair\n",
"\n",
- "material_with_defect = create_pair_defect(\n",
+ "material_with_defect = create_defect_pair(\n",
" material=supercell,\n",
" defect_type_1=PRIMARY_DEFECT_CONFIG.defect_type,\n",
" coordinate_1=PRIMARY_DEFECT_CONFIG.coordinate,\n",
@@ -161,70 +149,50 @@
" element_2=SECONDARY_DEFECT_CONFIG.element if hasattr(SECONDARY_DEFECT_CONFIG, \"element\") else None,\n",
" placement_method_2=SECONDARY_DEFECT_CONFIG.placement_method if hasattr(SECONDARY_DEFECT_CONFIG, 'placement_method') else None,\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "4391a0f444f4b64a",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "## 2. Create the Defect"
]
},
{
"cell_type": "markdown",
- "id": "f99753a31e0123a",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
]
},
{
"cell_type": "code",
- "id": "951f0cffe9389d5e",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": supercell, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defect, \"title\": f\"Material with defect\"}],\n",
" viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "1c5d8e66b5b105ee",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
},
{
"cell_type": "code",
- "id": "b9e1aba13faf1bf0",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), \"Mg substitution and vacancy in GaN.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 10d384a9..27ce5140 100644
--- a/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb
+++ b/other/materials_designer/specific_examples/defect_point_substitution_graphene.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Substitutional Point Defects in Graphene\n",
"\n",
@@ -18,14 +20,12 @@
"\n",
"\n",
"In this notebook we will reproduce material from FIG. 1 b)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f0ccd3190ce70a68"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
@@ -33,14 +33,14 @@
"\n",
"Note that we use approximate coordinates in crystal coordinates to define the defect positions. The approximate coordinates are used to find the closest site in the crystal to the given coordinates. The approximate coordinates are in the range of [0, 1] for each axis. Adjust the approximate coordinates to place the defect at the desired site in the crystal. Using the visuals provided in the notebook could help in determining the approximate coordinates.\n",
"(Coordinates found using 3D editor in Materials Designer)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "aae97744e3023a1b"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Element to be placed at the site (ignored for vacancy)\n",
"CHEMICAL_ELEMENT = \"N\"\n",
@@ -78,27 +78,23 @@
" },\n",
"\n",
"]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "dff59577346dbece",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "14d161d4b61ca219"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -110,141 +106,145 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8c6ea8b36f1a6cc",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load input material\n",
"In this notebook we will use the material from the `uploads` folder that has a few pre-set materials."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "da6733a515019677"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import load_material_from_folder\n",
"\n",
"material = load_material_from_folder(\"../uploads\", \"Graphene\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "14c40630ba2974e6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9fcc51573071c301"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"\n",
"supercell = create_supercell(material, supercell_matrix=SUPERCELL_MATRIX)\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6d5a793dd5e45f16",
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defects"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
+ "source": [
+ "### 2.1. Prepare defect dictionaries and validate them"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "from mat3ra.made.tools.build.defective_structures.zero_dimensional.point_defect.types import PointDefectDict\n",
+ "\n",
+ "defect_dicts = [PointDefectDict(**defect_config) for defect_config in DEFECT_CONFIGS]"
+ ]
},
{
"cell_type": "markdown",
- "source": "## 2. Create the Defects",
- "metadata": {
- "collapsed": false
- },
- "id": "e41cf1646620915d"
+ "id": "12",
+ "metadata": {},
+ "source": [
+ "### 2.2. Create the defects"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.point.helpers import create_multiple_defects\n",
+ "from mat3ra.made.tools.helpers import create_multiple_defects\n",
"\n",
"material_with_defect = create_multiple_defects(\n",
" supercell,\n",
- " defect_dicts=DEFECT_CONFIGS,\n",
+ " defect_dicts=defect_dicts,\n",
")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "db2d621e2fd4bbeb",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "2b58b5e76bd167d8"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": supercell, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defect, \"title\": f\"Material with defect\"}],\n",
" viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d4a1e920884b1a48",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"## 4. Write resulting material to the folder"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "865c3b666e06fd10"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\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": {
- "collapsed": false
- },
- "id": "7dcf867f46422fa9",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"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 00c4d728..5abc5af0 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f0ccd3190ce70a68",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Vacancy Point Defect in boron nitride (h-BN)\n",
"\n",
@@ -28,10 +26,8 @@
},
{
"cell_type": "markdown",
- "id": "aae97744e3023a1b",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
@@ -43,10 +39,10 @@
},
{
"cell_type": "code",
- "id": "dff59577346dbece",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Matrix to get the supercell of primitive hBN exactly as shown in the manuscript\n",
"SUPERCELL_MATRIX = [[-6, -6, 0], [-2, 2, 0], [0, 0, 1]]\n",
@@ -57,16 +53,12 @@
" \"placement_method\": \"closest_site\",\n",
" \"use_cartesian_coordinates\": False\n",
" }\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "14d161d4b61ca219",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -74,10 +66,10 @@
},
{
"cell_type": "code",
- "id": "8c6ea8b36f1a6cc",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -89,16 +81,12 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "da6733a515019677",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load input material\n",
"In this notebook we will use the material from the `uploads` folder that has a few pre-set materials."
@@ -106,38 +94,34 @@
},
{
"cell_type": "code",
- "id": "14c40630ba2974e6",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = Material.create(Materials.get_by_name_and_categories(\"Boron_Nitride\", \"2D\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "9fcc51573071c301",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Nanoribbon"
]
},
{
"cell_type": "code",
- "id": "6d5a793dd5e45f16",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
+ "from mat3ra.made.tools.helpers import create_supercell\n",
"nanoribbon = create_supercell(\n",
" material=material,\n",
" supercell_matrix=SUPERCELL_MATRIX,\n",
@@ -145,88 +129,76 @@
")\n",
"visualize(nanoribbon, repetitions=[1, 1, 1], rotation=\"0x\")\n",
"visualize(nanoribbon, repetitions=[1, 1, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "e41cf1646620915d",
- "metadata": {
- "collapsed": false
- },
- "source": "## 2. Create the Defect\n"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defect\n"
+ ]
},
{
"cell_type": "code",
- "id": "db2d621e2fd4bbeb",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.point.helpers import create_point_defect_vacancy\n",
+ "from mat3ra.made.tools.helpers import create_vacancy\n",
"\n",
- "material_with_defect = create_point_defect_vacancy(\n",
+ "material_with_defect = create_vacancy(\n",
" material = nanoribbon,\n",
" coordinate=DEFECT_CONFIG[\"coordinate\"],\n",
" placement_method=DEFECT_CONFIG[\"placement_method\"],\n",
" use_cartesian_coordinates=DEFECT_CONFIG[\"use_cartesian_coordinates\"]\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "2b58b5e76bd167d8",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
]
},
{
"cell_type": "code",
- "id": "d4a1e920884b1a48",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": nanoribbon, \"title\": \"Original material\"},\n",
" {\"material\": material_with_defect, \"title\": \"Material with defect\"}],\n",
" viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "865c3b666e06fd10",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Write resulting material to the folder"
]
},
{
"cell_type": "code",
- "id": "7dcf867f46422fa9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"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\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 1af29eba..dd3dca32 100644
--- a/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb
+++ b/other/materials_designer/specific_examples/defect_surface_adatom_graphene.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Adatom Defect on Graphene surface\n",
"\n",
@@ -19,26 +21,24 @@
"\n",
"\n",
"\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c62d2c5007947f56"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
"Adatom Defect Configuration parameters are described in [Adatom Defect Configuration](https://github.com/Exabyte-io/made/blob/8196b759242551c77d1791bf5bd2f4150763cfef/src/py/mat3ra/made/tools/build/defect/configuration.py#L141).\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4d0772a456c9952c"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Name of material to find in Standata\n",
"MATERIAL_NAME = \"Graphene\"\n",
@@ -66,27 +66,23 @@
" {\"chemical_element\": \"Pd\", \"distance_z\": 2.21, \"position_on_surface\": BRIDGE_SITE_COORDINATE},\n",
" # {\"chemical_element\": \"Au\", \"distance_z\": 2.69, \"position_on_surface\": TOP_SITE_COORDINATE},\n",
"]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b5459bac655071be",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d572e8697122fef5"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -98,53 +94,45 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_point_defect.ipynb\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "58b0da5bbc87efc6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b342c025f3e369d4"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7ebdb82cd32c735c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Create and preview Supercell"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8f459296488702b1"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"supercell = create_slab(crystal=material,\n",
@@ -152,80 +140,70 @@
" xy_supercell_matrix=XY_SUPERCELL_MATRIX\n",
" )\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "926503f431d18cad",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 2. Create the Defect",
- "metadata": {
- "collapsed": false
- },
- "id": "2de6554d42e97c9d"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Defect"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.adatom.helpers import create_adatom_defect\n",
+ "from mat3ra.made.tools.helpers import create_adatom\n",
"\n",
- "materials_with_adatom = [create_adatom_defect(\n",
+ "materials_with_adatom = [create_adatom(\n",
" slab=supercell,\n",
" placement_method=PLACEMENT_METHOD,\n",
" element=adatom_parameters[\"chemical_element\"],\n",
" distance_z=adatom_parameters[\"distance_z\"],\n",
" position_on_surface=adatom_parameters[\"position_on_surface\"],\n",
") for adatom_parameters in ADATOM_PARAMETERS]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6fc8ad13e12845f",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize Result(s)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5ebf2d6bb1a82b9a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"for material_with_defect in materials_with_adatom:\n",
" title = f\"{material_with_defect.name} adatom\"\n",
" visualize([{\"material\": material_with_defect, \"title\": title}], viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "93a18e3e1d6e3e6e",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Download the Results"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "61176790d8d979e0"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
@@ -233,13 +211,7 @@
"for material_with_defect in materials_with_adatom:\n",
" download_content_to_file(material_with_defect.to_json(),\n",
" f\"{material_with_defect.name}.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "20ab1b4be207428c",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 094bc200..eba601a7 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f0ccd3190ce70a68",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Island Surface Defect Formation on TiN(001) Surface\n",
"\n",
@@ -24,10 +22,8 @@
},
{
"cell_type": "markdown",
- "id": "aae97744e3023a1b",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defects parameters \n",
@@ -36,10 +32,10 @@
},
{
"cell_type": "code",
- "id": "139422d7e6c3cb3e",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"NUMBER_OF_ADDED_LAYERS = 0.5\n",
"\n",
@@ -56,16 +52,12 @@
" \"USE_ORTHOGONAL_C\": True,\n",
" \"xy_supercell_matrix\": [[10, 0], [0, 10]]\n",
"}"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "bede1fdd496fb639",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -73,10 +65,10 @@
},
{
"cell_type": "code",
- "id": "a457db594c9e2b24",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -89,16 +81,12 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "7d419807867fb1c9",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material\n",
"In this notebook we will use materials from Standata."
@@ -106,40 +94,38 @@
},
{
"cell_type": "code",
- "id": "ba2d38ba55128111",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(\"TiN\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "3230f242ef26d70f",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview Slab or create a new one"
]
},
{
"cell_type": "code",
- "id": "df4c56a0",
+ "execution_count": null,
+ "id": "8",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"from utils.visualize import visualize_materials\n",
"\n",
"slab = create_slab(\n",
" crystal=material,\n",
- " termination=None, # Use default termination\n",
+ " termination_top=None, # Use default termination\n",
" miller_indices=SLAB_PARAMETERS[\"miller_indices\"],\n",
" number_of_layers=SLAB_PARAMETERS[\"thickness\"],\n",
" vacuum=SLAB_PARAMETERS[\"vacuum\"],\n",
@@ -148,93 +134,81 @@
")\n",
"\n",
"visualize_materials(slab)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "1098e7479b4ddbe",
- "metadata": {
- "collapsed": false
- },
- "source": "## 2. Create the Target Material"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Create the Target Material"
+ ]
},
{
"cell_type": "code",
- "id": "c1dfcb6ba96a8856",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.utils.coordinate import BoxCoordinateCondition\n",
- "from mat3ra.made.tools.build.defect.island.helpers import create_island_defect\n",
+ "from mat3ra.made.tools.entities.coordinate import BoxCoordinateCondition\n",
+ "from mat3ra.made.tools.helpers import create_island\n",
"\n",
"coordinate_condition = BoxCoordinateCondition(\n",
" min_coordinate=SHAPE_PARAMETERS['min_coordinate'],\n",
" max_coordinate=SHAPE_PARAMETERS['max_coordinate']\n",
")\n",
"\n",
- "slab_with_island = create_island_defect(\n",
+ "slab_with_island = create_island(\n",
" slab=slab,\n",
" condition=coordinate_condition,\n",
" number_of_added_layers=NUMBER_OF_ADDED_LAYERS,\n",
" use_cartesian_coordinates=False,\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "163254119be36953",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
]
},
{
"cell_type": "code",
- "id": "70d32719704d9ef2",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize_materials([{\"material\": slab, \"title\": \"Original material\", \"rotation\": \"-45x\"},\n",
" {\"material\": slab_with_island,\n",
" \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\",\"rotation\": \"-45x\"}],\n",
" # viewer=\"wave\"\n",
" )"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6ac5c59b901acf80",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
},
{
"cell_type": "code",
- "id": "3ec05765edc89d01",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), \"TiN_slab_with_island.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"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 75f8b0ee..d8a3178c 100644
--- a/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb
+++ b/other/materials_designer/specific_examples/defect_surface_step_platinum.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "95a274d80df28ccd",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Step on a Platinum (211) surface\n",
"\n",
@@ -27,10 +25,8 @@
},
{
"cell_type": "markdown",
- "id": "d55eaee8bc55bffd",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
@@ -38,10 +34,10 @@
},
{
"cell_type": "code",
- "id": "4b64735060047bec",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"MATERIAL_NAME = \"Pt\"\n",
"MILLER_INDICES = (2, 1, 1)\n",
@@ -52,16 +48,12 @@
"USE_CONVENTIONAL_CELL = True\n",
"\n",
"VISUALIZATION_REPETITIONS = [1, 1, 1]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5e0ce05f6f031b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -69,10 +61,10 @@
},
{
"cell_type": "code",
- "id": "b457673560550933",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -84,66 +76,54 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "1659a8e9afe434fb",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
]
},
{
"cell_type": "code",
- "id": "b588ccfe51967a86",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.build import MaterialWithBuildMetadata\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8c13970a869adfa9",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
]
},
{
"cell_type": "code",
- "id": "c4f6e2697f97965f",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize(material, repetitions=VISUALIZATION_REPETITIONS, rotation=\"0x\")\n",
"visualize(material, repetitions=VISUALIZATION_REPETITIONS, rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6634dae92a6c07b9",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"## 2. Create a step with a slab\n",
"\n",
@@ -153,10 +133,12 @@
},
{
"cell_type": "code",
- "id": "e9d81088",
+ "execution_count": null,
+ "id": "10",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slab_211 = create_slab(\n",
" crystal=material,\n",
@@ -167,37 +149,31 @@
" use_conventional_cell=USE_CONVENTIONAL_CELL,\n",
" xy_supercell_matrix=XY_SUPERCELL_MATRIX\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "c6e2e18452972b21",
- "metadata": {
- "collapsed": false
- },
- "source": "### 2.2. Visualize the slab"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "### 2.2. Visualize the slab"
+ ]
},
{
"cell_type": "code",
- "id": "246cb1f0437dbde0",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(slab_211, repetitions=VISUALIZATION_REPETITIONS, rotation=\"0x\")\n",
"visualize(slab_211, repetitions=VISUALIZATION_REPETITIONS, rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "c9ded02269a09c24",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Create a step with terrace builder\n",
"### 3.1. Setup terrace parameters"
@@ -205,10 +181,10 @@
},
{
"cell_type": "code",
- "id": "d6d9b6b5600a4eef",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from types import SimpleNamespace\n",
"# Material selection\n",
@@ -241,28 +217,24 @@
"SHOW_INTERMEDIATE_STEPS = True\n",
"# Structure repeat in view\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "12a15e84ec43f4f3",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"### 3.2. Configure a terrace defect"
]
},
{
"cell_type": "code",
- "id": "f838761790cb392c",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.defect.terrace.helpers import create_terrace\n",
+ "from mat3ra.made.tools.helpers import create_terrace\n",
"\n",
"slab_111 = create_slab(\n",
" crystal=material,\n",
@@ -281,55 +253,47 @@
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES,\n",
" rotate_to_match_pbc=ROTATE_TO_MATCH_PBC\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "847971b9e20420ec",
- "metadata": {
- "collapsed": false
- },
- "source": "### 3.3. Visualize the terrace defect"
+ "id": "17",
+ "metadata": {},
+ "source": [
+ "### 3.3. Visualize the terrace defect"
+ ]
},
{
"cell_type": "code",
- "id": "138a639f8a2b16bb",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(terrace_slab, viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "d667623ad5f2e061",
- "metadata": {
- "collapsed": false
- },
+ "id": "19",
+ "metadata": {},
"source": [
"## 4. Download materials"
]
},
{
"cell_type": "code",
- "id": "3705115f04ac0010",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "20",
+ "metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), \"Pt_211_step.json\")\n",
"download_content_to_file(terrace_slab.to_json(), \"Pt_111_terrace.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 eedaa8fb..d4fa6211 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
@@ -2,107 +2,94 @@
"cells": [
{
"cell_type": "markdown",
- "id": "3ae4cc7db0846f04",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
- "# Create High-k Metal Gate Stack Tutorial\n",
+ "# Create High-k Metal Gate Stack Tutorial (Simplified)\n",
+ "\n",
+ "This notebook demonstrates how to create a high-k metal gate stack heterostructure with four materials: Si (substrate), SiO2 (gate oxide), HfO2 (high-k dielectric), and TiN (metal gate) using the **new simplified `create_heterostructure` function**.\n",
"\n",
- "This notebook demonstrates how to create a high-k metal gate stack heterostructure with four materials: Si (substrate), SiO2 (gate oxide), HfO2 (high-k dielectric), and TiN (metal gate).\n",
+ "This approach replaces the complex multi-step interface creation with a single function call that automatically handles strain matching and layer stacking.\n",
"\n",
"We'll create a representation of the material from the [QuantumATK tutorial](https://docs.quantumatk.com/tutorials/hkmg_builder/hkmg_builder.html) without the amorphous step.\n",
"\n",
- "
\n"
+ "
\n",
+ "\n",
+ "## Key Improvements:\n",
+ "- **Simplified Configuration**: Replace complex `SimpleNamespace` structures with simple lists\n",
+ "- **Single Function Call**: Use `create_heterostructure()` instead of manual interface creation\n",
+ "- **Automatic Optimization**: Built-in strain matching and supercell optimization\n"
]
},
{
"cell_type": "markdown",
- "id": "f1db6e522c6716dc",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Configuration Parameters\n"
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"from types import SimpleNamespace\n",
"\n",
- "# Global parameters\n",
- "MAX_AREA = 200 # Maximum area for strain matching\n",
- "MAX_AREA_RATIO_TOL = 0.25 # Maximum area ratio tolerance for strain matching\n",
- "MAX_ANGLE_TOLERANCE = 0.15 # Maximum angle tolerance for strain matching\n",
- "MAX_LENGTH_TOLERANCE = 0.15 # Maximum length tolerance for strain matching\n",
- "\n",
"# Structure parameters for each layer\n",
"STRUCTURE_PARAMS = [\n",
" SimpleNamespace(\n",
" # Silicon substrate\n",
+ " name = \"Silicon\",\n",
" slab_params=SimpleNamespace(\n",
- " miller_indices=(1, 0, 0),\n",
- " thickness=4, # atomic layers\n",
- " vacuum=5.0, # Angstroms\n",
- " USE_ORTHOGONAL_C=True\n",
+ " miller_indices=(0, 0, 1),\n",
+ " thickness=3, # atomic layers\n",
+ " # xy_supercell_matrix=[[2, 0], [0, 2]],\n",
" ),\n",
" termination_formula=None, # Use default termination for substrate\n",
- " interface_distance=None # No interface for substrate\n",
" ),\n",
" SimpleNamespace(\n",
" # SiO2 layer\n",
+ " name = \"SiO2\",\n",
" slab_params=SimpleNamespace(\n",
- " miller_indices=(1, 0, 0),\n",
- " thickness=3,\n",
- " vacuum=5.0,\n",
- " USE_ORTHOGONAL_C=True\n",
+ " miller_indices=(1, 1, 1),\n",
+ " thickness=4,\n",
" ),\n",
" termination_formula=None, # Use default termination for SiO2\n",
- " interface_distance=2.5, # Distance to Si substrate\n",
- " vacuum=0.5 # Vacuum for SiO2-terminating interface layer\n",
" ),\n",
" SimpleNamespace(\n",
" # HfO2 layer\n",
+ " name = \"Hafnium.*MCL\",\n",
" slab_params=SimpleNamespace(\n",
" miller_indices=(0, 0, 1),\n",
" thickness=2,\n",
- " vacuum=0.5,\n",
- " xy_supercell_matrix=[[2, 0], [0, 2]],\n",
- " USE_ORTHOGONAL_C=True\n",
" ),\n",
" termination_formula=None, # Use default termination for HfO2\n",
- " interface_distance=3.0, # Distance to SiO2\n",
- " vacuum=0.5 # Vacuum for HfO2-terminating interface layer\n",
" ),\n",
" SimpleNamespace(\n",
" # TiN layer\n",
+ " name = \"TiN\",\n",
" slab_params=SimpleNamespace(\n",
- " miller_indices=(0, 0, 1),\n",
- " thickness=3,\n",
- " vacuum=5.0, # Add vacuum to final layer\n",
- " USE_ORTHOGONAL_C=True,\n",
- " xy_supercell_matrix=[[3, 0], [0, 3]]\n",
+ " miller_indices=(1, 1, 1),\n",
+ " thickness=5,\n",
" ),\n",
" termination_formula=None, # Use default termination for TiN\n",
- " interface_distance=2.5, # Distance to HfO2\n",
- " vacuum=10.0 # Vacuum for TiN-terminating interface layer\n",
" )\n",
"]\n",
"\n",
- "INTERFACE_1_INDEX = 11 # was found in the previous runs"
- ],
- "id": "d437c36db077a11c",
- "outputs": [],
- "execution_count": null
+ "# Gaps between layers, in Angstroms\n",
+ "GAPS = [1.0, 1.0, 1.0]\n",
+ "\n",
+ "# Vacuum thickness over the heterostructure, in Angstroms\n",
+ "VACUUM = 10.0"
+ ]
},
{
"cell_type": "markdown",
- "id": "a671bb0a66616061",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -110,10 +97,10 @@
},
{
"cell_type": "code",
- "id": "c11956a7712639b9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -125,16 +112,12 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "15599efa4b241366",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material\n",
"In this notebook we will use materials from Standata."
@@ -142,361 +125,126 @@
},
{
"cell_type": "code",
- "id": "474383a5e0f70d6",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.tools.build import MaterialWithBuildMetadata\n",
+ "from mat3ra.made.tools.helpers import StackComponentDict\n",
"\n",
- "materials_1 = [\n",
- " MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(\"SiO2\")), # SiO2\n",
- " MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(\"Silicon\")), # Si substrate\n",
- "]\n",
- "materials_2 = [\n",
- " MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(\"HfO2.*MCL\")), # HfO2\n",
- " MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(\"TiN\")), # TiN\n",
- "]"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "9fe9b39b05f1dc7e",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "## 2. Create Si/SiO2 Interface\n",
- "### 2.1. Create Si/SiO2 Interface"
+ "# Get materials from Standata\n",
+ "crystals = [MaterialWithBuildMetadata.create(Materials.get_by_name_first_match(params.name)) for params in STRUCTURE_PARAMS]"
]
},
- {
- "cell_type": "code",
- "id": "59c8eb0e549ee69e",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
- "from utils.visualize import visualize_materials as visualize\n",
- "\n",
- "film_1_params = STRUCTURE_PARAMS[1] # SiO2 layer\n",
- "substrate_1_params = STRUCTURE_PARAMS[0] # Silicon substrate\n",
- "\n",
- "# Create slab configurations\n",
- "substrate_1_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=materials_1[1], # Silicon \n",
- " miller_indices=substrate_1_params.slab_params.miller_indices,\n",
- " number_of_layers=substrate_1_params.slab_params.thickness,\n",
- " vacuum=0.0,\n",
- " termination_formula=substrate_1_params.termination_formula,\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "film_1_slab_config = SlabConfiguration.from_parameters(\n",
- " material_or_dict=materials_1[0], # SiO2\n",
- " miller_indices=film_1_params.slab_params.miller_indices,\n",
- " number_of_layers=film_1_params.slab_params.thickness,\n",
- " vacuum=0.0,\n",
- " termination_formula=film_1_params.termination_formula,\n",
- " use_conventional_cell=True\n",
- ")\n",
- "\n",
- "# Create slabs\n",
- "substrate_1_slab = SlabBuilder().get_material(substrate_1_slab_config)\n",
- "film_1_slab = SlabBuilder().get_material(film_1_slab_config)\n",
- "\n",
- "# Create Si/SiO2 interface using modern ZSL helper - select specified match\n",
- "interface_1 = create_zsl_interface_between_slabs(\n",
- " substrate_slab=substrate_1_slab,\n",
- " film_slab=film_1_slab,\n",
- " gap=film_1_params.interface_distance,\n",
- " vacuum=film_1_params.vacuum,\n",
- " match_id=INTERFACE_1_INDEX, # Use specified match from parameters\n",
- " max_area=MAX_AREA,\n",
- " max_area_ratio_tol=MAX_AREA_RATIO_TOL,\n",
- " max_length_tol=MAX_LENGTH_TOLERANCE,\n",
- " max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
- " reduce_result_cell_to_primitive=False,\n",
- ")"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "b4d5e3261b720c9d",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
- "### 2.2. Visualize the Si/SiO2 Interface"
+ "## 2. Create the heterostructure\n",
+ " ### 2.1. Create a list of dictionaries for each layer's parameters"
]
},
{
"cell_type": "code",
- "id": "49c046cf4517ad91",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "visualize(\n",
- " interface_1,\n",
- " repetitions=[1, 1, 1],\n",
- " title=\"Si/SiO2 Interface\"\n",
- ")\n",
- "\n",
- "visualize(\n",
- " interface_1,\n",
- " repetitions=[1, 1, 1],\n",
- " title=\"Si/SiO2 Interface\",\n",
- " rotation='-90x'\n",
- ")\n"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "4cc11d87adc5d979",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "## 3. Add HfO2 Layer\n",
- "### 3.1. Add a layer with SimpleInterfaceBuilder"
- ]
- },
- {
+ "execution_count": null,
+ "id": "8",
"metadata": {},
- "cell_type": "code",
- "source": [
- "from mat3ra.made.tools.build.interface import create_simple_interface_between_slabs\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "\n",
- "film_2_params = STRUCTURE_PARAMS[2] # HfO2 layer\n",
- "\n",
- "# Create HfO2 slab with specified supercell matrix\n",
- "film_2_slab = create_slab(\n",
- " crystal=materials_2[0], # HfO2\n",
- " termination=None, # Use default termination\n",
- " miller_indices=film_2_params.slab_params.miller_indices,\n",
- " number_of_layers=film_2_params.slab_params.thickness,\n",
- " vacuum=film_2_params.slab_params.vacuum,\n",
- " xy_supercell_matrix=film_2_params.slab_params.xy_supercell_matrix,\n",
- " use_orthogonal_c=film_2_params.slab_params.USE_ORTHOGONAL_C\n",
- ")\n",
- "\n",
- "interface_1_slab = create_slab(\n",
- " crystal=interface_1, # Use the Si/SiO2 interface slab\n",
- " miller_indices=(0,0,1),\n",
- " number_of_layers=film_2_params.slab_params.thickness,\n",
- " vacuum=0.0, # No vacuum for interface slab\n",
- " xy_supercell_matrix=film_2_params.slab_params.xy_supercell_matrix,\n",
- " use_orthogonal_c=film_2_params.slab_params.USE_ORTHOGONAL_C\n",
- ")\n",
- "\n",
- "# Create Si/SiO2/HfO2 interface using SimpleInterfaceBuilder\n",
- "interface_2 = create_simple_interface_between_slabs(\n",
- " film_slab=film_2_slab,\n",
- " substrate_slab=interface_1_slab,\n",
- " gap=film_2_params.interface_distance, # Distance to SiO2\n",
- " vacuum=film_2_params.vacuum # Vacuum for HfO2-terminating interface layer\n",
- ")\n"
- ],
- "id": "449228d73d589d08",
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "6f62d46be77dbf7f",
- "metadata": {
- "collapsed": false
- },
"source": [
- "### 3.2. Visualize the Si/SiO2/HfO2 Interface"
+ "stack_component_dicts = [\n",
+ " StackComponentDict(\n",
+ " crystal=crystals[i],\n",
+ " miller_indices=dict.slab_params.miller_indices,\n",
+ " thickness=dict.slab_params.thickness,\n",
+ " xy_supercell_matrix=dict.slab_params.xy_supercell_matrix if hasattr(dict.slab_params, 'xy_supercell_matrix') else None,\n",
+ " ) for i, dict in enumerate(STRUCTURE_PARAMS)\n",
+ "]"
]
},
- {
- "cell_type": "code",
- "id": "5ddc3d75b43a3926",
- "metadata": {
- "collapsed": false
- },
- "source": [
- "visualize(\n",
- " interface_2,\n",
- " repetitions=[1, 1, 1],\n",
- " title=\"Si/SiO2/HfO2 Interface\"\n",
- ")\n",
- "\n",
- "visualize(\n",
- " interface_2,\n",
- " repetitions=[1, 1, 1],\n",
- " title=\"Si/SiO2/HfO2 Interface\",\n",
- " rotation='-90x'\n",
- ")"
- ],
- "outputs": [],
- "execution_count": null
- },
{
"cell_type": "markdown",
- "id": "93705fda2bacc16e",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
- "## 4. Add TiN Layer\n",
- "### 4.1. Create a TiN Slab"
+ "### 2.1. Create the heterostructure\n",
+ "Using the `create_heterostructure` function, then flipping to match the example."
]
},
{
"cell_type": "code",
- "id": "9900d149e4148bfa",
+ "execution_count": null,
+ "id": "10",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.supercell import create_supercell\n",
- "\n",
- "film_3_params = STRUCTURE_PARAMS[3] # TiN layer\n",
+ "from mat3ra.made.tools.operations.core.unary import rotate\n",
+ "from mat3ra.made.tools.helpers import create_heterostructure\n",
"\n",
- "# Create TiN slab with specified supercell matrix\n",
- "tin_slab = create_slab(\n",
- " crystal=materials_2[1], # TiN\n",
- " termination=None, # Use default termination\n",
- " miller_indices=film_3_params.slab_params.miller_indices,\n",
- " number_of_layers=film_3_params.slab_params.thickness,\n",
- " vacuum=film_3_params.slab_params.vacuum,\n",
- " xy_supercell_matrix=film_3_params.slab_params.xy_supercell_matrix,\n",
- " use_orthogonal_c=film_3_params.slab_params.USE_ORTHOGONAL_C\n",
+ "heterostructure = create_heterostructure(\n",
+ " stack_component_dicts= stack_component_dicts,\n",
+ " gaps= GAPS,\n",
+ " vacuum=VACUUM,\n",
+ " use_conventional_cell=True,\n",
+ " optimize_layer_supercells=True,\n",
")\n",
"\n",
- "# Flip interface_2 for stacking TiN on top\n",
- "interface_2_flipped = create_supercell(interface_2, scaling_factor=[1, -1, -1])"
- ],
- "outputs": [],
- "execution_count": null
+ "flipped_heterostructure = rotate(heterostructure, angle=180, axis=[1,0,0])"
+ ]
},
{
"cell_type": "markdown",
- "id": "37ffd5a46a4b3f8",
+ "id": "11",
"metadata": {},
"source": [
- "### 4.2. Get terminations for TiN and Si/SiO2/HfO2"
+ "## 3. Visualize the material\n"
]
},
{
"cell_type": "code",
- "id": "2da4c0aae9175936",
+ "execution_count": null,
+ "id": "12",
"metadata": {},
- "source": [
- "# TiN slab and interface_2_flipped are ready for final interface creation\n",
- "print(\"TiN slab created successfully\")\n",
- "print(\"Si/SiO2/HfO2 interface prepared for TiN layer addition\")"
- ],
"outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "29288bf265f1175b",
- "metadata": {},
- "source": [
- "### 4.3. Add TiN layer with SimpleInterfaceBuilder"
- ]
- },
- {
- "metadata": {
- "jupyter": {
- "is_executing": true
- }
- },
- "cell_type": "code",
"source": [
- "# Create final Si/SiO2/HfO2/TiN interface configuration\n",
- "interface_2_flipped_slab = create_slab(\n",
- " crystal=interface_2_flipped, # Use the flipped Si/SiO2/HfO2 interface slab\n",
- " miller_indices=(0, 0, 1),\n",
- " number_of_layers=film_3_params.slab_params.thickness,\n",
- " vacuum=0.0, # No vacuum for interface slab\n",
- " xy_supercell_matrix=film_3_params.slab_params.xy_supercell_matrix,\n",
- " use_orthogonal_c=film_3_params.slab_params.USE_ORTHOGONAL_C\n",
- ")\n",
- "\n",
- "interface_3 = create_simple_interface_between_slabs(\n",
- " film_slab=tin_slab,\n",
- " substrate_slab=interface_2_flipped_slab,\n",
- " gap=film_3_params.interface_distance,\n",
- " vacuum=film_3_params.vacuum\n",
- ")\n",
+ "from utils.visualize import visualize_materials as visualize\n",
"\n",
- "# Invert the interface along the z-axis to match example orientation\n",
- "interface_3 = create_supercell(interface_3, scaling_factor=[1, -1, -1])"
- ],
- "id": "baf2ba664817c0bc",
- "outputs": [],
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "id": "de4385aa81264e6b",
- "metadata": {
- "collapsed": false
- },
- "source": "### 4.4. Visualize the Si/SiO2/HfO2/TiN Interface"
- },
- {
- "cell_type": "code",
- "id": "2b3fda71c801aeff",
- "metadata": {
- "collapsed": false
- },
- "source": [
"visualize(\n",
- " interface_3,\n",
- " title=\"Si/SiO2/HfO2/TiN Interface\",\n",
+ " flipped_heterostructure,\n",
+ " repetitions=[1, 1, 1],\n",
" viewer=\"wave\",\n",
" rotation='-90x'\n",
- ")"
- ],
- "outputs": [],
- "execution_count": null
+ ")\n"
+ ]
},
{
"cell_type": "markdown",
- "id": "ae16540b54491e35",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
- "## 5. Save final material\n"
+ "## 4. Save the material"
]
},
{
"cell_type": "code",
- "id": "803792030da3a97",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
- "interface_3.name = \"Si-SiO2-HfO2-TiN Heterostructure\"\n",
- "set_materials(interface_3)\n",
- "download_content_to_file(interface_3.to_json(), \"heterostructure_high_k_metal_gate.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ "\n",
+ "flipped_heterostructure.name = \"Si-SiO2-HfO2-TiN Heterostructure\"\n",
+ "set_materials(flipped_heterostructure)\n",
+ "download_content_to_file(flipped_heterostructure.to_json(), \"heterostructure_high_k_metal_gate.json\")\n"
+ ]
}
],
"metadata": {
"kernelspec": {
- "display_name": ".venv-3.11",
+ "display_name": ".venv-3.11.2",
"language": "python",
"name": "python3"
},
@@ -510,7 +258,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.7"
+ "version": "3.11.2"
}
},
"nbformat": 4,
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 25525cb1..14771a0b 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
@@ -24,9 +24,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
@@ -35,8 +33,10 @@
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"FILM_MILLER_INDICES = (0, 0, 1)\n",
"FILM_THICKNESS = 1 # in atomic layers\n",
@@ -63,15 +63,11 @@
"\n",
"# Whether to reduce the resulting interface cell to the primitive cell after the interface creation.\n",
"REDUCE_RESULT_CELL_TO_PRIMITIVE = True"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -79,9 +75,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -93,9 +89,7 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -106,39 +100,35 @@
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"film = Material.create(Materials.get_by_name_first_match(\"Graphene\"))\n",
"substrate = Material.create(Materials.get_by_name_and_categories(\"BN\", \"2D\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.4. Preview Substrate and Film"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -151,41 +141,38 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"film_slab_terminations = get_slab_terminations(material=film, miller_indices=FILM_MILLER_INDICES)\n",
"substrate_slab_terminations = get_slab_terminations(material=substrate, miller_indices=SUBSTRATE_MILLER_INDICES)\n",
"print(\"Film slab terminations:\", film_slab_terminations)\n",
"print(\"Substrate slab terminations:\", substrate_slab_terminations)\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.2. Visualize slabs for all possible terminations"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
- "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
+ "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination_top=termination, vacuum=0) for termination\n",
" in\n",
" film_slab_terminations]\n",
"\n",
- "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
+ "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination_top=termination, vacuum=0)\n",
" for termination in\n",
" substrate_slab_terminations]\n",
"\n",
@@ -196,30 +183,30 @@
"\n",
"visualize(film_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(substrate_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.3. Select terminations for the Slabs"
+ "metadata": {},
+ "source": [
+ "### 2.3. Select terminations for the Slabs"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
+ "from mat3ra.made.tools.helpers import select_slab_termination\n",
+ "\n",
"film_termination = select_slab_termination(film_slab_terminations, FILM_TERMINATION_FORMULA)\n",
"substrate_termination = select_slab_termination(substrate_slab_terminations, SUBSTRATE_TERMINATION_FORMULA)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.4. Create Substrate and Film Slabs\n",
"Slab Configuration lets define the slab thickness, vacuum, and the Miller indices of the interfacial plane and get the slabs with possible terminations.\n",
@@ -228,19 +215,18 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration, SlabBuilder\n",
"\n",
"substrate_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
" number_of_layers=SUBSTRATE_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
+ " termination_top_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -249,21 +235,17 @@
" miller_indices=FILM_MILLER_INDICES,\n",
" number_of_layers=FILM_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=FILM_TERMINATION_FORMULA,\n",
+ " termination_top_formula=FILM_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
"substrate_slab = SlabBuilder().get_material(substrate_slab_config)\n",
"film_slab = SlabBuilder().get_material(film_slab_config)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## 3. Analyze possible interfaces with ZSL Analyzer\n",
"### 3.1. Initialize ZSL Analyzer\n",
@@ -272,9 +254,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
"\n",
@@ -287,15 +269,11 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell=False # Reduces supercell matrices in analyzer\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 3.2. Generate matches with strain analyzer\n",
"Matches are sorted by size and strain."
@@ -303,29 +281,25 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"matches = zsl_analyzer.zsl_match_holders"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 3.3. Plot matches by area and strain"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_strain_vs_area\n",
"\n",
@@ -336,15 +310,11 @@
"}\n",
"\n",
"plot_strain_vs_area(matches, PLOT_SETTINGS)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 3.4. Select the interface\n",
"\n",
@@ -353,13 +323,13 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"selected_index = 0\n",
"\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
+ "from mat3ra.made.tools.helpers import create_interface_zsl_between_slabs as create_zsl_interface_between_slabs\n",
"\n",
"interface = create_zsl_interface_between_slabs(\n",
" substrate_slab=substrate_slab,\n",
@@ -373,9 +343,7 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell_to_primitive=REDUCE_RESULT_CELL_TO_PRIMITIVE,\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -387,26 +355,28 @@
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize(interface, repetitions=[3, 3, 1])\n",
"visualize(interface, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 4.2. Shift film along y-axis\n",
"Shifting with the step of a/sqrt(3)/2 angstroms, where a is the lattice constant of the interface."
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import numpy as np\n",
"from mat3ra.made.tools.modify import interface_displace_part\n",
@@ -419,46 +389,43 @@
" displacement=[0, n * a / np.sqrt(3) / 2, 0],\n",
" use_cartesian_coordinates=True)\n",
" shifted_interfaces.append(shifted_interface)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 4.3. Preview the shifted materials"
+ "metadata": {},
+ "source": [
+ "### 4.3. Preview the shifted materials"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
- "source": "visualize(shifted_interfaces, repetitions=[3, 3, 1])",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "visualize(shifted_interfaces, repetitions=[3, 3, 1])"
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 5. Pass data to the outside runtime"
+ "metadata": {},
+ "source": [
+ "## 5. Pass data to the outside runtime"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
"set_materials(shifted_interfaces)\n",
"for idx, shifted_interface in enumerate(shifted_interfaces):\n",
" download_content_to_file(shifted_interface.to_json(), f\"interface_{idx}.json\")"
- ],
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": "",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -478,13 +445,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
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 43ae3e3d..33c7f689 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
@@ -25,9 +25,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
@@ -37,9 +35,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"FILM_MILLER_INDICES = (0, 0, 1)\n",
"FILM_THICKNESS = 1 # in atomic layers\n",
@@ -66,15 +64,11 @@
"\n",
"# Whether to reduce the resulting interface cell to the primitive cell after the interface creation.\n",
"REDUCE_RESULT_CELL_TO_PRIMITIVE = True"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -82,9 +76,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -96,9 +90,7 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -109,40 +101,34 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"film = Material.create(Materials.get_by_name_first_match(\"Graphene\"))\n",
"substrate = Material.create(Materials.get_by_name_first_match(\"SiO2\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.4. Preview Substrate and Film"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -155,41 +141,38 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"film_slab_terminations = get_slab_terminations(material=film, miller_indices=FILM_MILLER_INDICES)\n",
"substrate_slab_terminations = get_slab_terminations(material=substrate, miller_indices=SUBSTRATE_MILLER_INDICES)\n",
"print(\"Film slab terminations:\", film_slab_terminations)\n",
"print(\"Substrate slab terminations:\", substrate_slab_terminations)\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.2. Visualize slabs for all possible terminations"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab, select_slab_termination\n",
"\n",
- "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
+ "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination_top=termination, vacuum=0) for termination\n",
" in\n",
" film_slab_terminations]\n",
"\n",
- "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
+ "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination_top=termination, vacuum=0)\n",
" for termination in\n",
" substrate_slab_terminations]\n",
"\n",
@@ -200,30 +183,24 @@
"\n",
"visualize(film_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(substrate_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.3. Select terminations for the Slabs"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"film_termination = select_slab_termination(film_slab_terminations, FILM_TERMINATION_FORMULA)\n",
"substrate_termination = select_slab_termination(substrate_slab_terminations, SUBSTRATE_TERMINATION_FORMULA)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -236,17 +213,19 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
+ "\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration, SlabBuilder\n",
"\n",
"substrate_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
" number_of_layers=SUBSTRATE_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
+ " termination_top_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -255,19 +234,17 @@
" miller_indices=FILM_MILLER_INDICES,\n",
" number_of_layers=FILM_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=FILM_TERMINATION_FORMULA,\n",
+ " termination_bottom_formula=FILM_TERMINATION_FORMULA, # film termination is on the bottom\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
"substrate_slab = SlabBuilder().get_material(substrate_slab_config)\n",
"film_slab = SlabBuilder().get_material(film_slab_config)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 3. Analyze possible interfaces with ZSL Analyzer\n",
"### 3.1. Initialize ZSL Analyzer\n",
@@ -276,7 +253,9 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
"\n",
@@ -289,13 +268,11 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell=False # Reduces supercell matrices in analyzer\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.2. Generate matches with strain analyzer\n",
"Matches are sorted by size and strain.\n"
@@ -303,21 +280,25 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"matches = zsl_analyzer.zsl_match_holders\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 3.3. Plot matches by area and strain\n"
+ "metadata": {},
+ "source": [
+ "### 3.3. Plot matches by area and strain\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_strain_vs_area\n",
"\n",
@@ -328,13 +309,11 @@
"}\n",
"\n",
"plot_strain_vs_area(matches, PLOT_SETTINGS)\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.4. Select the interface\n",
"\n",
@@ -343,11 +322,13 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"selected_index = 0\n",
"\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
+ "from mat3ra.made.tools.helpers import create_interface_zsl_between_slabs as create_zsl_interface_between_slabs\n",
"\n",
"interface = create_zsl_interface_between_slabs(\n",
" substrate_slab=substrate_slab,\n",
@@ -361,48 +342,50 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell_to_primitive=REDUCE_RESULT_CELL_TO_PRIMITIVE,\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 4. Preview the selected interface\n"
+ "metadata": {},
+ "source": [
+ "## 4. Preview the selected interface\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"visualize(interface, repetitions=[1, 1, 1])\n",
"visualize(interface, repetitions=[1, 1, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 5. Pass data to the outside runtime\n"
+ "metadata": {},
+ "source": [
+ "## 5. Pass data to the outside runtime\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
"set_materials(interface)\n",
"download_content_to_file(interface.to_json(), f\"{interface.name}.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "code",
- "source": "",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": []
}
],
"metadata": {
@@ -422,13 +405,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
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 0b648aee..1179cb32 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
@@ -25,9 +25,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook \n",
@@ -37,9 +35,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"FILM_MILLER_INDICES = (0, 0, 1)\n",
"FILM_THICKNESS = 3 # in atomic layers\n",
@@ -66,15 +64,11 @@
"\n",
"# Whether to reduce the resulting interface cell to the primitive cell after the interface creation.\n",
"REDUCE_RESULT_CELL_TO_PRIMITIVE = False"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -82,9 +76,9 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -96,9 +90,7 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_interface_with_min_strain_zsl.ipynb\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -110,40 +102,34 @@
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"film = Material.create(Materials.get_by_name_first_match(\"Copper\"))\n",
"substrate = Material.create(Materials.get_by_name_first_match(\"Cristobalite\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 1.4. Preview Substrate and Film"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -156,41 +142,38 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"\n",
"film_slab_terminations = get_slab_terminations(material=film, miller_indices=FILM_MILLER_INDICES)\n",
"substrate_slab_terminations = get_slab_terminations(material=substrate, miller_indices=SUBSTRATE_MILLER_INDICES)\n",
"print(\"Film slab terminations:\", film_slab_terminations)\n",
"print(\"Substrate slab terminations:\", substrate_slab_terminations)\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.2. Visualize slabs for all possible terminations"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
+ "from mat3ra.made.tools.helpers import create_slab, select_slab_termination\n",
"\n",
- "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
+ "film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination_top=termination, vacuum=0) for termination\n",
" in\n",
" film_slab_terminations]\n",
"\n",
- "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
+ "substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination_top=termination, vacuum=0)\n",
" for termination in\n",
" substrate_slab_terminations]\n",
"\n",
@@ -201,30 +184,24 @@
"\n",
"visualize(film_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n",
"visualize(substrate_slabs_with_titles, repetitions=[3, 3, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
"### 2.3. Select terminations for the Slabs"
]
},
{
"cell_type": "code",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"film_termination = select_slab_termination(film_slab_terminations, FILM_TERMINATION_FORMULA)\n",
"substrate_termination = select_slab_termination(substrate_slab_terminations, SUBSTRATE_TERMINATION_FORMULA)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
@@ -237,17 +214,18 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration, SlabBuilder\n",
"\n",
"substrate_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
" number_of_layers=SUBSTRATE_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
+ " termination_top_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -256,19 +234,17 @@
" miller_indices=FILM_MILLER_INDICES,\n",
" number_of_layers=FILM_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=FILM_TERMINATION_FORMULA,\n",
+ " termination_bottom_formula=FILM_TERMINATION_FORMULA, # film termination is on the bottom\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
"substrate_slab = SlabBuilder().get_material(substrate_slab_config)\n",
"film_slab = SlabBuilder().get_material(film_slab_config)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"## 3. Analyze possible interfaces with ZSL Analyzer\n",
"### 3.1. Initialize ZSL Analyzer\n",
@@ -277,7 +253,9 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
"\n",
@@ -290,13 +268,11 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell=False # Reduces supercell matrices in analyzer\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.2. Generate matches with strain analyzer\n",
"Matches are sorted by size and strain.\n"
@@ -304,21 +280,25 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"matches = zsl_analyzer.zsl_match_holders\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 3.3. Plot matches by area and strain\n"
+ "metadata": {},
+ "source": [
+ "### 3.3. Plot matches by area and strain\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_strain_vs_area\n",
"\n",
@@ -329,13 +309,11 @@
"}\n",
"\n",
"plot_strain_vs_area(matches, PLOT_SETTINGS)\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "metadata": {},
"source": [
"### 3.4. Select the interface\n",
"\n",
@@ -344,11 +322,13 @@
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"selected_index = 0\n",
"\n",
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
+ "from mat3ra.made.tools.helpers import create_interface_zsl_between_slabs as create_zsl_interface_between_slabs\n",
"\n",
"interface = create_zsl_interface_between_slabs(\n",
" substrate_slab=substrate_slab,\n",
@@ -362,41 +342,43 @@
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
" reduce_result_cell_to_primitive=REDUCE_RESULT_CELL_TO_PRIMITIVE,\n",
")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 4. Preview the selected interface\n"
+ "metadata": {},
+ "source": [
+ "## 4. Preview the selected interface\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"visualize(interface, repetitions=[1, 1, 1])\n",
"visualize(interface, repetitions=[1, 1, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 5. Pass data to the outside runtime\n"
+ "metadata": {},
+ "source": [
+ "## 5. Pass data to the outside runtime\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
"set_materials(interface)\n",
"download_content_to_file(interface.to_json(), f\"{interface.name}.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
@@ -416,13 +398,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
- },
- "widgets": {
- "application/vnd.jupyter.widget-state+json": {
- "state": {},
- "version_major": 2,
- "version_minor": 0
- }
}
},
"nbformat": 4,
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 0088668e..f35c7559 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "536d623ca076bbdd",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Twisted Molybdenum Disulfide bilayers at various angles.\n",
"\n",
@@ -24,10 +22,8 @@
},
{
"cell_type": "markdown",
- "id": "cc65bd914eecf844",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up the notebook\n",
@@ -35,8 +31,11 @@
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Uncomment lines to reproduce specific cases from the article\n",
"INTERFACE_PARAMETERS = [\n",
@@ -62,17 +61,12 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"VISUALIZE_REPETITIONS = [3, 3, 1]"
- ],
- "id": "81f392a7dbdd0acb",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5ffda79fd5cad69",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
" ### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -80,10 +74,10 @@
},
{
"cell_type": "code",
- "id": "9f851434739f468a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -95,24 +89,23 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "111e138010f911c",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material\n",
"We'll use the MoS2 material from Standata.\n"
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
@@ -127,28 +120,28 @@
"if SHOW_INTERMEDIATE_STEPS:\n",
" visualize_materials(material, repetitions=VISUALIZE_REPETITIONS)\n",
" visualize_materials(material, repetitions=VISUALIZE_REPETITIONS, rotation=\"-90x\")\n"
- ],
- "id": "a8d47cc0e54bca82",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
" ## 3. Generate Twisted Interface\n",
" ### 3.1. Create slab\n"
- ],
- "id": "fe47bcbd429ee0d5"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import translate_to_z_level\n",
"from mat3ra.esse.models.core.reusable.axis_enum import AxisEnum\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
- "from mat3ra.made.tools.build.interface.helpers import create_commensurate_interface\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_interface_commensurate as create_commensurate_interface\n",
"\n",
"slab = create_slab(\n",
" crystal=material,\n",
@@ -159,20 +152,22 @@
"slab = translate_to_z_level(slab, \"center\")\n",
"\n",
"visualize_materials(slab, rotation=\"-90x\")"
- ],
- "id": "dcf5e2daa1d04a62",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 3.2. Create twisted interfaces",
- "id": "8c4c87d9ff529b17"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "### 3.2. Create twisted interfaces"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"interfaces = []\n",
"for parameters in INTERFACE_PARAMETERS:\n",
@@ -188,43 +183,43 @@
" )\n",
" interfaces.append(interface)\n",
" print(f\"Created interface with twist angle {parameters['angle']}° and {len(interface.basis.elements.ids)} atoms\")\n"
- ],
- "id": "ec61eca814b922f5",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "370d3acc33cb8907",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"## 4. Preview the materials\n"
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"for interface in interfaces:\n",
" visualize_materials(interface, viewer=\"wave\")\n"
- ],
- "id": "65811e9ed95eb5db",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 5. Download materials\n",
- "id": "c395226b74ee0ea1"
+ "id": "13",
+ "metadata": {},
+ "source": [
+ "## 5. Download materials\n"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
@@ -232,10 +227,7 @@
"\n",
"for idx, interface in enumerate(interfaces):\n",
" download_content_to_file(interface.to_json(), f\"twisted_interface_{idx}.json\")"
- ],
- "id": "d548c123372d9205",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 13f43157..eb26c7cb 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
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Twisted bilayer Boron Nitride (TBBN).\n",
"\n",
@@ -23,25 +25,23 @@
"The image shows the twisted bilayer h-BN structure with a twist angle of 2.64° (a) and 62.64° (b).\n",
"\n",
"
"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6b26b3bd88c951b3"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up structure parameters\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "21f76cc671b0e835"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material and structure parameters\n",
"TWIST_ANGLE_A = 2.64 # Twist angle in degrees for A material\n",
@@ -60,26 +60,22 @@
"# Visualization settings\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"VISUALIZE_REPETITIONS = [1, 1, 1]"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "47af0a587ce80b91",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4b91848e28033a8b"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -91,27 +87,23 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f67b53c0f60f257c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input material\n",
"We'll use hexagonal boron nitride (h-BN) as our starting material.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c4370f1ce85b6507"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
@@ -126,30 +118,26 @@
"\n",
"if SHOW_INTERMEDIATE_STEPS:\n",
" visualize_materials(material, repetitions=VISUALIZE_REPETITIONS)\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f1c2ac4b7553961b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"## 2. Create Twisted Bilayer Structure\n",
"### 2.1. Create nanoribbon\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "26064d36be06507f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"\n",
- "from mat3ra.made.tools.build.nanoribbon.helpers import create_nanoribbon\n",
+ "from mat3ra.made.tools.helpers import create_nanoribbon\n",
"\n",
"nanoribbon = create_nanoribbon(\n",
" material=material,\n",
@@ -158,31 +146,30 @@
" vacuum_length=VACUUM_PADDING,\n",
" vacuum_width=VACUUM_PADDING,\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "80ac5dd96d8622b7",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 2.2. Generate and analyze interfaces\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f3019591d1ab5506"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {
+ "jupyter": {
+ "is_executing": true
+ }
+ },
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface.helpers import create_twisted_interface\n",
+ "from mat3ra.made.tools.helpers import create_interface_twisted\n",
"\n",
- "interface_a = create_twisted_interface(\n",
+ "interface_a = create_interface_twisted(\n",
" material1=nanoribbon,\n",
" material2=nanoribbon,\n",
" angle=TWIST_ANGLE_A,\n",
@@ -191,7 +178,7 @@
" vacuum_y=VACUUM_PADDING,\n",
")\n",
"\n",
- "interface_b = create_twisted_interface(\n",
+ "interface_b = create_interface_twisted(\n",
" material1=nanoribbon,\n",
" material2=nanoribbon,\n",
" angle=TWIST_ANGLE_B,\n",
@@ -199,46 +186,41 @@
" vacuum_x=VACUUM_PADDING,\n",
" vacuum_y=VACUUM_PADDING,\n",
")"
- ],
- "id": "2293065288b4308c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.3. Select and visualize the best interface\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "fe5b798439e5b43a"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize_materials([interface_a, interface_b], repetitions=VISUALIZE_REPETITIONS)\n",
"visualize_materials([interface_a, interface_b], repetitions=VISUALIZE_REPETITIONS, rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "c4049a69b2dcbaa1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "13",
+ "metadata": {},
"source": [
"## 5. Download the Materials\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d58a1e4ada9d1a74"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"interface_a.name += f\" ({TWIST_ANGLE_A} degrees)\"\n",
@@ -246,13 +228,7 @@
"set_materials([interface_a, interface_b])\n",
"download_content_to_file(interface_a.to_json(), \"twisted_bilayer_h-BN_A.json\")\n",
"download_content_to_file(interface_b.to_json(), \"twisted_bilayer_h-BN_B.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a64a81bb1ab4d47d",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/nanocluster_gold.ipynb b/other/materials_designer/specific_examples/nanocluster_gold.ipynb
index 2bb3513f..efb8e372 100644
--- a/other/materials_designer/specific_examples/nanocluster_gold.ipynb
+++ b/other/materials_designer/specific_examples/nanocluster_gold.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "f2e1e795020d7b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Nanoclusters of Gold\n",
"\n",
@@ -28,20 +26,16 @@
},
{
"cell_type": "markdown",
- "id": "5e43ff288847b784",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n"
]
},
{
"cell_type": "markdown",
- "id": "9adf37a8d2620dc4",
- "metadata": {
- "collapsed": false
- },
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -49,10 +43,10 @@
},
{
"cell_type": "code",
- "id": "d9e6be14343d00a1",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -64,27 +58,26 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "26066db067a41c93",
- "metadata": {
- "collapsed": false
- },
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set up cluster parameters\n",
"Parameters for the cuboctahedron and icosahedron shapes can be found at [ASE Clusters](https://wiki.fysik.dtu.dk/ase/ase/cluster/cluster.html#ase.cluster.Cluster)."
]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
+ "from mat3ra.made.tools.build.pristine_structures.zero_dimensional.nanoparticle import NanoparticleShapesEnum\n",
"from types import SimpleNamespace\n",
- "from mat3ra.made.tools.build.nanoparticle.enums import NanoparticleShapesEnum as Shapes\n",
"\n",
"ELEMENT = \"Au\" # Chemical symbol of the element to create nanoparticles from\n",
"\n",
@@ -96,119 +89,106 @@
"\n",
"NANOPARTICLE_CONFIGS = [\n",
" SimpleNamespace(\n",
- " shape=Shapes.OCTAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.OCTAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" length=length(2),\n",
" cutoff=2,\n",
" )\n",
" ),\n",
" SimpleNamespace(\n",
- " shape=Shapes.OCTAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.OCTAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" length=length(3),\n",
" cutoff=3,\n",
" )\n",
" ),\n",
" SimpleNamespace(\n",
- " shape=Shapes.OCTAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.OCTAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" length=length(4),\n",
" cutoff=4,\n",
" )\n",
" ),\n",
" SimpleNamespace(\n",
- " shape=Shapes.ICOSAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.ICOSAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" noshells=3,\n",
" )\n",
" ),\n",
" SimpleNamespace(\n",
- " shape=Shapes.ICOSAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.ICOSAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" noshells=4,\n",
" )\n",
" ),\n",
" SimpleNamespace(\n",
- " shape=Shapes.ICOSAHEDRON,\n",
+ " shape=NanoparticleShapesEnum.ICOSAHEDRON,\n",
" parameters=SimpleNamespace(\n",
" noshells=5,\n",
" )\n",
" )\n",
"]\n"
- ],
- "id": "56b9bd10",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "919ad7af8dceeedd",
- "metadata": {
- "collapsed": false
- },
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Get input material"
]
},
{
"cell_type": "code",
- "id": "be38fdda1984c654",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(\"Gold\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "690241d87e7bbbe0",
- "metadata": {
- "collapsed": false
- },
+ "id": "8",
+ "metadata": {},
"source": [
"## 2. Create the Target Material(s)"
]
},
{
"cell_type": "code",
- "id": "a990fa35742d7269",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.nanoparticle.helpers import create_nanoparticle_by_shape\n",
+ "from mat3ra.made.tools.helpers import create_nanoparticle_by_shape\n",
"\n",
"nanoparticles = [create_nanoparticle_by_shape(\n",
" crystal=material,\n",
" shape=config.shape,\n",
" parameters=config.parameters\n",
") for config in NANOPARTICLE_CONFIGS]"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "462549d016073446",
- "metadata": {
- "collapsed": false
- },
+ "id": "10",
+ "metadata": {},
"source": [
"## 3. Visualize the Result(s)"
]
},
{
"cell_type": "code",
- "id": "509b18661a069e42",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
@@ -216,35 +196,29 @@
"icosahedra_particles = nanoparticles[3:6]\n",
"visualize(cuboctahedra_particles, rotation=\"45y,45x\")\n",
"visualize(icosahedra_particles, rotation=\"60x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "d381df29a6bbdd82",
- "metadata": {
- "collapsed": false
- },
+ "id": "12",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
]
},
{
"cell_type": "code",
- "id": "61daa5afcbc078a9",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import set_materials, download_content_to_file\n",
"\n",
"set_materials(nanoparticles)\n",
"for idx, nanoparticle in enumerate(nanoparticles):\n",
" download_content_to_file(nanoparticle.to_json(), f\"gold_nanocluster_{idx}.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 fe80befa..0b26e417 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
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "567b1b812acb1718",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Optimize Interface Film Position in Gr/Ni(111) Interface\n",
"\n",
@@ -30,10 +28,10 @@
},
{
"cell_type": "code",
- "id": "6cc535057854a4d1",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "1",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -45,24 +43,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples|create_interface_with_min_strain_zsl.ipynb\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "63d36e1a062ae33a",
- "metadata": {
- "collapsed": false
- },
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.2. Set Parameters\n"
]
},
{
"cell_type": "code",
- "id": "a2b35c2f3e3b092a",
+ "execution_count": null,
+ "id": "3",
"metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"SUBSTRATE_NAME = \"Nickel\"\n",
@@ -105,16 +101,12 @@
"# Visualization parameters\n",
"SHOW_3D_LANDSCAPE = False # Whether to show 3D energy landscape\n",
"STRUCTURE_REPETITIONS = [3, 3, 1] # Repetitions for structure visualization\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "d4ee2a1c17a07fa7",
- "metadata": {
- "collapsed": false
- },
+ "id": "4",
+ "metadata": {},
"source": [
"## 2. Create Interface Material\n",
"### 2.1. Load Materials\n"
@@ -122,10 +114,10 @@
},
{
"cell_type": "code",
- "id": "f1047ca2cc30b87a",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"from mat3ra.standata.materials import Materials\n",
@@ -136,34 +128,31 @@
"\n",
"# Preview materials\n",
"visualize_materials([substrate, film], repetitions=STRUCTURE_REPETITIONS, rotation=\"0x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "14c4e4f9aa6721a",
- "metadata": {
- "collapsed": false
- },
+ "id": "6",
+ "metadata": {},
"source": [
"### 2.2. Create Slabs"
]
},
{
"cell_type": "code",
- "id": "4943dcc4a793f623",
+ "execution_count": null,
+ "id": "7",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
- "from mat3ra.made.tools.build.slab.builders import SlabBuilder\n",
+ "from mat3ra.made.tools.build.pristine_structures.two_dimensional.slab import SlabConfiguration, SlabBuilder\n",
"\n",
"substrate_slab_config = SlabConfiguration.from_parameters(\n",
" material_or_dict=substrate,\n",
" miller_indices=SUBSTRATE_MILLER_INDICES,\n",
" number_of_layers=SUBSTRATE_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
+ " termination_top_formula=SUBSTRATE_TERMINATION_FORMULA,\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -172,7 +161,7 @@
" miller_indices=FILM_MILLER_INDICES,\n",
" number_of_layers=FILM_THICKNESS,\n",
" vacuum=0.0,\n",
- " termination_formula=FILM_TERMINATION_FORMULA,\n",
+ " termination_bottom_formula=FILM_TERMINATION_FORMULA, # Termination for the bottom of the film slab\n",
" use_conventional_cell=USE_CONVENTIONAL_CELL\n",
")\n",
"\n",
@@ -182,13 +171,11 @@
"# Visualize the created slabs\n",
"visualize_materials([{\"material\": film_slab, \"title\": \"Film Slab\"}, {\"material\": substrate_slab, \"title\": \"Substrate Slab\"}],\n",
" repetitions=[3, 3, 1], rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a09ee4efe7c65600",
+ "id": "8",
"metadata": {},
"source": [
"### 2.3. Create Interface\n"
@@ -196,10 +183,12 @@
},
{
"cell_type": "code",
- "id": "e64b278750d997f0",
+ "execution_count": null,
+ "id": "9",
"metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
+ "from mat3ra.made.tools.helpers import create_interface_zsl_between_slabs as create_zsl_interface_between_slabs\n",
"\n",
"interface_material = create_zsl_interface_between_slabs(\n",
" substrate_slab=substrate_slab,\n",
@@ -219,16 +208,12 @@
"# Visualize interface\n",
"visualize_materials([interface_material], repetitions=STRUCTURE_REPETITIONS)\n",
"visualize_materials([interface_material], repetitions=STRUCTURE_REPETITIONS, rotation=\"-90x\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8b20dc13f57cfce7",
- "metadata": {
- "collapsed": false
- },
+ "id": "10",
+ "metadata": {},
"source": [
"## 3. Optimize Interface Position\n",
"### 3.1. Calculate Energy Landscape\n"
@@ -236,12 +221,12 @@
},
{
"cell_type": "code",
- "id": "3dd3a069a69b4be1",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import get_optimal_film_displacement\n",
+ "from mat3ra.made.tools.helpers import get_optimal_film_displacement\n",
"from mat3ra.made.tools.modify import interface_displace_part\n",
"from mat3ra.made.tools.optimize import evaluate_calculator_on_xy_grid\n",
"from mat3ra.made.tools.calculate.calculators import InterfaceMaterialCalculator\n",
@@ -269,24 +254,22 @@
" use_cartesian_coordinates=USE_CARTESIAN\n",
")\n",
"print(f\"\\nOptimal displacement vector: {optimal_displacement}\")\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "4028cb9ac8d438f0",
- "metadata": {
- "collapsed": false
- },
+ "id": "12",
+ "metadata": {},
"source": [
"### 3.2. Visualize Energy Landscape\n"
]
},
{
"cell_type": "code",
- "id": "291e197f524e12d2",
+ "execution_count": null,
+ "id": "13",
"metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.utils.jupyterlite.plot import plot_2d_heatmap, plot_3d_surface\n",
"\n",
@@ -308,13 +291,11 @@
" displacement=optimal_displacement,\n",
" use_cartesian_coordinates=USE_CARTESIAN\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ee1f1248729697af",
+ "id": "14",
"metadata": {},
"source": [
"### 3.3. Visualize Material\n"
@@ -322,8 +303,10 @@
},
{
"cell_type": "code",
- "id": "aa330d1c1a0b249e",
+ "execution_count": null,
+ "id": "15",
"metadata": {},
+ "outputs": [],
"source": [
"print(\"\\nVisualization of original and optimized materials:\")\n",
"visualize_materials([{\"material\": interface_material, \"title\": \"Original Interface\"},\n",
@@ -334,35 +317,29 @@
" {\"material\": optimized_material, \"title\": \"Optimized Interface\"}],\n",
" repetitions=STRUCTURE_REPETITIONS,\n",
" rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "78304054eca1564e",
- "metadata": {
- "collapsed": false
- },
+ "id": "16",
+ "metadata": {},
"source": [
"# 4. Save optimized material"
]
},
{
"cell_type": "code",
- "id": "fb3a1781c32f144f",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
"optimized_material.name = f\"{interface_material.name}_optimized_xy\"\n",
"set_materials(optimized_material)\n",
"download_content_to_file(optimized_material.to_json(), f\"{interface_material.name}_optimized_xy.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
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 1ff2f029..f68a0fa3 100644
--- a/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb
+++ b/other/materials_designer/specific_examples/passivation_edge_nanowire_silicon.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "81aa051ca1ca2e05",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Passivation of Silicon Nanowire\n",
"\n",
@@ -27,10 +25,8 @@
},
{
"cell_type": "markdown",
- "id": "af879d0489a86849",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the environment\n",
"### 1.1. Set up the notebook"
@@ -38,10 +34,10 @@
},
{
"cell_type": "code",
- "id": "f704e7abe8fbe895",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Enable interactive selection of coordination threshold\n",
"IS_COORDINATION_SELECTION_INTERACTIVE = False\n",
@@ -51,16 +47,12 @@
"COORDINATION_SEARCH_RADIUS = 2.5 # in Angstroms (sphere in which to search for neighbors)\n",
"COORDINATION_THRESHOLD = 3 # Coordination number below which to passivate\n",
"MAX_BONDS_TO_SATURATE = 2 # Maximum number of bonds to saturate"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "aca8179cd83de117",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
" ### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -68,10 +60,10 @@
},
{
"cell_type": "code",
- "id": "37904650f2478a1d",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -83,16 +75,12 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "25ed776c9802142e",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"## 2. Create the Silicon Nanowire\n",
"### 2.1. Get input material\n",
@@ -101,25 +89,21 @@
},
{
"cell_type": "code",
- "id": "6d48372afc12056e",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"silicon = Material.create(Materials.get_by_name_first_match('Silicon'))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "602e2ef359ef1b83",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 2.2. Create a silicon nanowire\n",
"Nanowire is cut from a slab of Silicon with a box filter, crystal is rotated at an angle to allow for precise cut."
@@ -127,13 +111,14 @@
},
{
"cell_type": "code",
- "id": "f8431fd833f6ed",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.modify import rotate, filter_by_box, add_vacuum_sides, translate_to_center\n",
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.operations.core.unary import rotate\n",
+ "from mat3ra.made.tools.modify import filter_by_box, add_vacuum_sides, translate_to_center\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"silicon_slab = create_slab(\n",
" crystal=silicon, \n",
@@ -152,64 +137,52 @@
"# visualize_materials([{\"material\": rotated_slab},{\"material\": silicon_nanowire}, {\"material\": silicon_nanowire, \"rotation\": \"-90x\"}])\n",
"nanowire_xy_pbc = rotate(silicon_nanowire, \"z\", 90+angle)\n",
"nanowire_xy_pbc = add_vacuum_sides(nanowire_xy_pbc, 10.0, on_x=True, on_y=True)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "ea153d126ac5695d",
- "metadata": {
- "collapsed": false
- },
+ "id": "9",
+ "metadata": {},
"source": [
"### 2.3. Visualize the Material"
]
},
{
"cell_type": "code",
- "id": "76a4b4b6318d2549",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
"visualize_materials([{\"material\": nanowire_xy_pbc}, {\"material\": nanowire_xy_pbc, \"rotation\": \"-90x\"}])"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "4eb261774078348f",
- "metadata": {
- "collapsed": false
- },
+ "id": "11",
+ "metadata": {},
"source": [
"### 2.4. Compute the radial distribution function (RDF) of the Material"
]
},
{
"cell_type": "code",
- "id": "bb206aac50a38bb6",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.plot import plot_rdf\n",
"\n",
"plot_rdf(nanowire_xy_pbc, cutoff=10.0)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "a79faa88a33c8fdb",
- "metadata": {
- "collapsed": false
- },
+ "id": "13",
+ "metadata": {},
"source": [
"## 3. Create passivated material\n",
"### 3.1. Set the passivation parameters including the coordination threshold"
@@ -217,13 +190,13 @@
},
{
"cell_type": "code",
- "id": "7b80ee26896bbbfb",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.io import select_coordination_threshold\n",
- "from mat3ra.made.tools.build.passivation.helpers import get_unique_coordination_numbers\n",
+ "from mat3ra.made.tools.helpers import get_unique_coordination_numbers\n",
"\n",
"coordination_numbers = get_unique_coordination_numbers(material = nanowire_xy_pbc, cutoff=10.0)\n",
"\n",
@@ -232,28 +205,24 @@
"coordination_threshold = COORDINATION_THRESHOLD\n",
"if IS_COORDINATION_SELECTION_INTERACTIVE:\n",
" coordination_threshold = await select_coordination_threshold(coordination_numbers, COORDINATION_THRESHOLD)"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "47744926ab328a82",
- "metadata": {
- "collapsed": false
- },
+ "id": "15",
+ "metadata": {},
"source": [
"### 3.2. Create the passivated material"
]
},
{
"cell_type": "code",
- "id": "398b2dedef23e0fc",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.passivation.helpers import passivate_dangling_bonds\n",
+ "from mat3ra.made.tools.helpers import passivate_dangling_bonds\n",
"\n",
"passivated_nanowire = passivate_dangling_bonds(\n",
" material=nanowire_xy_pbc,\n",
@@ -263,55 +232,47 @@
" coordination_threshold=coordination_threshold,\n",
" number_of_bonds_to_passivate=MAX_BONDS_TO_SATURATE,\n",
")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "2b1a300ab807ce6d",
- "metadata": {
- "collapsed": false
- },
+ "id": "17",
+ "metadata": {},
"source": [
"## 4. Preview the Material"
]
},
{
"cell_type": "code",
- "id": "cb85e7e42c0944f2",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"visualize_materials(passivated_nanowire, viewer=\"wave\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5d7fa9201651fa72",
- "metadata": {
- "collapsed": false
- },
+ "id": "19",
+ "metadata": {},
"source": [
"## 5. Download the Material"
]
},
{
"cell_type": "code",
- "id": "51a4fc8cbadfb526",
+ "execution_count": null,
+ "id": "20",
"metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), \"passivated_nanowire.json\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb b/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb
index 8acd46cc..92cbece0 100644
--- a/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb
+++ b/other/materials_designer/specific_examples/passivation_surface_silicon.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Passivation of Silicon (001) Surface\n",
"\n",
@@ -18,26 +20,23 @@
"This notebook will focus on recreating the material from Fig. 8.:\n",
"\n",
"
"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "81aa051ca1ca2e05"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the environment\n",
"### 1.1. Set up the notebook"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "af879d0489a86849"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Material selection\n",
"MATERIAL_NAME = \"Silicon.*100.*reconstructed\" # Name (regex) of the material to import from Standata\n",
@@ -54,24 +53,23 @@
"# Visualization parameters\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"CELL_REPETITIONS_FOR_VISUALIZATION = [1, 1, 1] # Structure repeat in view"
- ],
- "id": "8d5e0a40537f4bdc",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install`."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f6106dbafce082a1"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -83,52 +81,44 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d1eb85a3125e3839",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Load and preview input material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "43ee49c4858d165f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"slab = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f71a66a67f9ae8e6",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "7",
+ "metadata": {},
"source": [
"## 2. Prepare the material\n",
"### 2.1. Visualize original material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "51bb05eecc1f3abe"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials\n",
"\n",
@@ -136,27 +126,22 @@
" print(\"Initial slab structure:\")\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "83efe492d92bf80c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "9",
+ "metadata": {},
"source": [
"### 2.2. Adjust structure to match the one from the manuscript"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e14ecd35964002f3"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.tools.modify import translate_to_z_level\n",
"# Find coordinates of the Si atoms, list in descending order, and change the second one from the top\n",
@@ -175,43 +160,45 @@
"new_coordinates[index_to_adjust] = adjusted_coordinate\n",
"slab.set_coordinates(new_coordinates)\n",
"slab = translate_to_z_level(slab, \"center\")"
- ],
- "id": "36744eb087509500",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "### 2.3. Visualize adjusted material",
- "id": "b0f46550198b1b9d"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "### 2.3. Visualize adjusted material"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
"if SHOW_INTERMEDIATE_STEPS:\n",
" print(\"Adjusted slab structure:\")\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION)\n",
" visualize_materials(slab, repetitions=CELL_REPETITIONS_FOR_VISUALIZATION, rotation=\"-90x\")"
- ],
- "id": "9f86e4cc49f97922",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "source": "## 3. Create passivated material\n",
- "metadata": {
- "collapsed": false
- },
- "id": "751ab019a379e07e"
+ "id": "13",
+ "metadata": {},
+ "source": [
+ "## 3. Create passivated material\n"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.passivation.helpers import passivate_surface\n",
+ "from mat3ra.made.tools.helpers import passivate_surface\n",
"\n",
"passivated_slab = passivate_surface(\n",
" material=slab,\n",
@@ -227,58 +214,47 @@
"print(f\"Bond length: {BOND_LENGTH} Å\")\n",
"print(f\"Surfaces passivated: {SURFACE}\")\n",
"print(f\"Number of atoms: {len(passivated_slab.basis.elements.ids)}\")"
- ],
- "id": "12ddeb6233df033d",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "15",
+ "metadata": {},
"source": [
"## 4. Visualize the result"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e2118b4c4bcf322f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "16",
+ "metadata": {},
+ "outputs": [],
"source": [
"print(\"Final passivated structure:\")\n",
"visualize_materials(passivated_slab, viewer=\"wave\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "4680f4f7906f6f2c",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "17",
+ "metadata": {},
"source": [
"### 5. Pass data to the outside runtime\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bde2ccf31660d4fd"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "18",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.jupyterlite import download_content_to_file, set_materials\n",
"\n",
"set_materials(passivated_slab)\n",
"download_content_to_file(passivated_slab.to_json(), f\"{slab.name}_passivated.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "b3c536f6ca85e403",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb b/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb
index b8bf8121..24ec9ea5 100644
--- a/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb
+++ b/other/materials_designer/specific_examples/perturbation_ripple_graphene.ipynb
@@ -2,6 +2,8 @@
"cells": [
{
"cell_type": "markdown",
+ "id": "0",
+ "metadata": {},
"source": [
"# Ripple perturbation of a graphene sheet.\n",
"\n",
@@ -18,35 +20,31 @@
"Recreating material from Fig. 1:\n",
"\n",
"
\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "367a698b29e22bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "193a4e6a78fd5bd7"
+ ]
},
{
"cell_type": "markdown",
+ "id": "2",
+ "metadata": {},
"source": [
"### 1.1. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "f38b2711726e5859"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "3",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -58,26 +56,22 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7a6e28cfae1a7b46",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "4",
+ "metadata": {},
"source": [
"### 1.2. Set Nanoribbon and Perturbation Parameters"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "11db992e02891067"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "5",
+ "metadata": {},
+ "outputs": [],
"source": [
"# Set whether to preserve geodesic distance and scale the cell accordingly to match PBC\n",
"PRESERVE_GEODESIC_DISTANCE = False\n",
@@ -89,27 +83,23 @@
"# Set whether to use Cartesian coordinates for the perturbation function\n",
"USE_CARTESIAN_COORDINATES = False\n",
"MATERIAL_NAME = \"Graphene\""
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a40d7b697c413113",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "6",
+ "metadata": {},
"source": [
"### 1.3. Define Custom Perturbation Function\n",
"Provide a [SymPy](https://docs.sympy.org/latest/tutorials/intro-tutorial/intro.html) expression for the perturbation function. The expression should be a function of `x`, `y` and `z` variables."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e6a19c741406eafe"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "7",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sympy as sp\n",
"\n",
@@ -143,53 +133,45 @@
"\n",
"# Combine waves with edge mask\n",
"custom_sympy_function = AMPLITUDE * wave_pattern * edge_mask"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "203911c2413c7447",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "8",
+ "metadata": {},
"source": [
"### 1.4. Get input materials"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "edf02101e27a2742"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "9",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "e0c53233ce728cc1",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "10",
+ "metadata": {},
"source": [
"### 1.5. Create and preview Nanoribbon"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cf29b7f6fe114d8f"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "11",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.nanoribbon.helpers import create_nanoribbon\n",
+ "from mat3ra.made.tools.helpers import create_nanoribbon\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"supercell = create_nanoribbon(\n",
@@ -200,113 +182,93 @@
" vacuum_length=VACUUM_SIZE,\n",
")\n",
"visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "897ba7aa4e402d24",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "12",
+ "metadata": {},
"source": [
"## 2. Create a target material\n",
"### 2.1. Set custom perturbation parameters\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6d4adf0d580e0340"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "13",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.perturbation.helpers import PerturbationFunctionHolder\n",
- "from mat3ra.made.tools.utils.perturbation import PerturbationFunctionHolder\n",
+ "from mat3ra.made.tools.helpers import PerturbationFunctionHolder\n",
+ "from mat3ra.made.tools.helpers import PerturbationFunctionHolder\n",
"\n",
"custom_perturbation_function = PerturbationFunctionHolder(\n",
" function=custom_sympy_function,\n",
" variable_names=variable_names,\n",
" use_cartesian_coordinates=USE_CARTESIAN_COORDINATES\n",
")\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "8d90932312c418ee",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "14",
+ "metadata": {},
"source": [
"### 2.2. Apply perturbation to the material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "7695d5d1df6be2e3"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "15",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.perturbation.helpers import create_perturbation\n",
+ "from mat3ra.made.tools.helpers import create_perturbation\n",
"\n",
"material_with_custom_perturbation = create_perturbation(material=supercell,\n",
" perturbation_function=custom_sympy_function, use_cartesian_coordinates=USE_CARTESIAN_COORDINATES)"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "69ccc90b8c5c1191",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
+ "id": "16",
+ "metadata": {},
"source": [
"### 3. Visualize the Material"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "10e7ca8950839991"
+ ]
},
{
"cell_type": "code",
- "source": "visualize(material_with_custom_perturbation, viewer=\"wave\")",
- "metadata": {
- "collapsed": false
- },
- "id": "cbfe0878a16f6c83",
+ "execution_count": null,
+ "id": "17",
+ "metadata": {},
"outputs": [],
- "execution_count": null
+ "source": [
+ "visualize(material_with_custom_perturbation, viewer=\"wave\")"
+ ]
},
{
"cell_type": "markdown",
+ "id": "18",
+ "metadata": {},
"source": [
"## 4. Pass data to the outside runtime"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "9e0b241366592109"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "id": "19",
+ "metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), f\"{MATERIAL_NAME}_edge_perturbation.json\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "29dfa0a329cca2fa",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb b/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb
index cde34f05..21d35d2f 100644
--- a/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb
+++ b/other/materials_designer/specific_examples/slab_strontium_titanate.ipynb
@@ -2,10 +2,8 @@
"cells": [
{
"cell_type": "markdown",
- "id": "95a274d80df28ccd",
- "metadata": {
- "collapsed": false
- },
+ "id": "0",
+ "metadata": {},
"source": [
"# Slabs of SrTiO3(011) with specified terminations\n",
"\n",
@@ -26,10 +24,8 @@
},
{
"cell_type": "markdown",
- "id": "d55eaee8bc55bffd",
- "metadata": {
- "collapsed": false
- },
+ "id": "1",
+ "metadata": {},
"source": [
"## 1. Prepare the Environment\n",
"### 1.1. Set up defect parameters "
@@ -37,10 +33,10 @@
},
{
"cell_type": "code",
- "id": "4b64735060047bec",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "2",
+ "metadata": {},
+ "outputs": [],
"source": [
"MILLER_INDICES = (0, 1, 1)\n",
"THICKNESS = 3 # in atomic layers\n",
@@ -48,16 +44,12 @@
"XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n",
"USE_ORTHOGONAL_C = True\n",
"USE_CONVENTIONAL_CELL = True\n"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "5e0ce05f6f031b3f",
- "metadata": {
- "collapsed": false
- },
+ "id": "3",
+ "metadata": {},
"source": [
"### 1.2. Install Packages\n",
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
@@ -65,10 +57,10 @@
},
{
"cell_type": "code",
- "id": "b457673560550933",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "4",
+ "metadata": {},
+ "outputs": [],
"source": [
"import sys\n",
"\n",
@@ -80,100 +72,93 @@
" from mat3ra.utils.jupyterlite.packages import install_packages\n",
"\n",
" await install_packages(\"specific_examples\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "1659a8e9afe434fb",
- "metadata": {
- "collapsed": false
- },
+ "id": "5",
+ "metadata": {},
"source": [
"### 1.3. Get input materials"
]
},
{
"cell_type": "code",
- "id": "b588ccfe51967a86",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "6",
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = Material.create(Materials.get_by_name_first_match(\"SrTiO3\"))"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "8c13970a869adfa9",
- "metadata": {
- "collapsed": false
- },
+ "id": "7",
+ "metadata": {},
"source": [
"### 1.4. Preview the material"
]
},
{
"cell_type": "code",
- "id": "c4f6e2697f97965f",
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "id": "8",
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize(material, repetitions=[3, 3, 3], rotation=\"0x\")\n",
"visualize(material, repetitions=[3, 3, 3], rotation=\"-90x\")"
- ],
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "6634dae92a6c07b9",
- "metadata": {
- "collapsed": false
- },
- "source": "## 2. Get possible terminations for the slab\n"
+ "id": "9",
+ "metadata": {},
+ "source": [
+ "## 2. Get possible terminations for the slab\n"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "10",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import get_slab_terminations\n",
+ "from mat3ra.made.tools.helpers import get_slab_terminations\n",
"slab_terminations = get_slab_terminations(material, miller_indices=MILLER_INDICES)\n",
"\n",
"print(\"Terminations\")\n",
"for idx, termination in enumerate(slab_terminations):\n",
" print(f\" {idx}: {termination}\")"
- ],
- "id": "730569ace3c4024",
- "outputs": [],
- "execution_count": null
+ ]
},
{
"cell_type": "markdown",
- "id": "c6e2e18452972b21",
- "metadata": {
- "collapsed": false
- },
- "source": "## 3. Create and visualize slabs"
+ "id": "11",
+ "metadata": {},
+ "source": [
+ "## 3. Create and visualize slabs"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "12",
+ "metadata": {},
+ "outputs": [],
"source": [
- "from mat3ra.made.tools.build.slab.helpers import create_slab\n",
+ "from mat3ra.made.tools.helpers import create_slab\n",
"\n",
"slabs = [create_slab(\n",
" crystal=material,\n",
- " termination=termination,\n",
+ " termination_top=termination,\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers=THICKNESS,\n",
" vacuum=VACUUM,\n",
@@ -183,30 +168,29 @@
") for termination in slab_terminations]\n",
"\n",
"visualize([{\"material\": slab, \"title\": slab.name} for slab in slabs], repetitions=[3, 3, 1], viewer=\"wave\")\n"
- ],
- "id": "958bccf0c45b902b",
- "outputs": [],
- "execution_count": null
+ ]
},
{
- "metadata": {},
"cell_type": "markdown",
- "source": "## 4. Download materials",
- "id": "63ceec59586339f0"
+ "id": "13",
+ "metadata": {},
+ "source": [
+ "## 4. Download materials"
+ ]
},
{
- "metadata": {},
"cell_type": "code",
+ "execution_count": null,
+ "id": "14",
+ "metadata": {},
+ "outputs": [],
"source": [
"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.to_json(), f\"{slab.name}.json\")"
- ],
- "id": "6e7d16e2a84a9dbb",
- "outputs": [],
- "execution_count": null
+ ]
}
],
"metadata": {
diff --git a/other/materials_designer/under_the_hood.ipynb b/other/materials_designer/under_the_hood.ipynb
index 1ed26ba6..c217c30a 100644
--- a/other/materials_designer/under_the_hood.ipynb
+++ b/other/materials_designer/under_the_hood.ipynb
@@ -76,13 +76,13 @@
}
],
"metadata": {
- "language_info": {
- "name": "python"
- },
"kernelspec": {
- "name": "python3",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
- "display_name": "Python 3 (ipykernel)"
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
}
},
"nbformat": 4,
diff --git a/pyproject.toml b/pyproject.toml
index 42b15df5..7636bcf1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,7 +12,7 @@ dependencies = [
"matplotlib>=3.4.1",
"pandas>=1.5.3",
"pymatgen==2024.4.13",
- "mat3ra-made>=2025.8.1.post1",
+ "mat3ra-made==2025.8.9.post0",
"mat3ra-utils>=2024.6.11.post0",
]
diff --git a/utils/jupyterlite.py b/utils/jupyterlite.py
index 3f9f9218..e5fc7cb3 100644
--- a/utils/jupyterlite.py
+++ b/utils/jupyterlite.py
@@ -129,7 +129,7 @@ def get_materials(globals_dict: Optional[Dict] = None) -> List[Any]:
List[Material]: A list of Material objects.
"""
from mat3ra.made.material import Material
- from mat3ra.made.tools.build.metadata import MaterialWithBuildMetadata
+ from mat3ra.made.tools.build_components import MaterialWithBuildMetadata
if globals_dict is None:
# Get the globals of the caller for correct variable assignment during the execution of data_bridge extension
@@ -184,7 +184,7 @@ def load_materials_from_folder(folder_path: Optional[str] = None, verbose: bool
List[Material]: A list of Material objects loaded from the folder.
"""
from mat3ra.made.material import Material
- from mat3ra.made.tools.build.metadata import MaterialWithBuildMetadata
+ from mat3ra.made.tools.build_components import MaterialWithBuildMetadata
folder_path = folder_path or UPLOADS_FOLDER
@@ -291,7 +291,7 @@ def download_content_to_file(content: Any, filename: str):
filename (str): The name of the file to download.
"""
from mat3ra.made.material import Material
- from mat3ra.made.tools.build.metadata import MaterialWithBuildMetadata
+ from mat3ra.made.tools.build_components import MaterialWithBuildMetadata
if isinstance(content, dict):
content = json.dumps(content, indent=4)