From e15bd4a197468099ecb5048e9f8340d1a59675f6 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Fri, 10 May 2024 16:13:58 -0700
Subject: [PATCH 01/33] chore: update first 1-5 steps
---
...te_interface_with_relaxation_ase_emt.ipynb | 652 +++++++-----------
1 file changed, 240 insertions(+), 412 deletions(-)
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 ab11390a..c0eab3f6 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -4,28 +4,30 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Create an interface with minimal strain and relax it using ASE EMT\n",
+ "# Create an interface with ZSL and relax it using EMT potentials\n",
"\n",
- "Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials using the Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl). And then relax the interface using the EMT (Effective Medium Theory) potential. \n",
- "> NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt., as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\n",
+ "Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials using the Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl).\n",
"\n",
"
Usage
\n",
"\n",
- "1. Make sure to select Input Materials\n",
- "2. Set Input Parameters (e.g. `THICKNESS`, `MAX_AREA`, `FMAX`) below or use the default values\n",
- "3. Click \"Run\" > \"Run All\" to run all cells\n",
- "4. Wait for the run to complete (depending on the parameters it can take a few min or more). Scroll down to view cell results.\n",
- "5. Review the strain plot and modify its parameters as needed\n",
- "6. Apply relaxation to the selected interface and analyze the difference\n",
- "7. Pass the results back to the web application\n",
+ "1. Drop the materials files into the \"uploads\" folder in the JupyterLab file browser\n",
+ "1. Set Input Parameters (e.g. `distance_z`, `max_area`, `miller_indices`) below or use the default values\n",
+ "1. Click \"Run\" > \"Run All\" to run all cells\n",
+ "1. Wait for the run to complete (depending on the area, it can take 1-2 min or more). Scroll down to view cell results.\n",
+ "1. Review the strain plot and modify its parameters as needed\n",
"\n",
"## Methodology\n",
"\n",
"The following happens in the script below:\n",
"\n",
- "1. The steps from [create_interface_with_min_strain_zsl.ipynb](create_interface_with_min_strain_zsl.ipynb)\n",
+ "1. Create slabs for each input material. The materials data is passed in from and back to the web application according to this description (TBA).\n",
+ " We assume that two input materials are either in bulk form (e.g. Ni crystal) or layered (e.g. graphene). \n",
+ " \n",
+ " We construct the interface along the Z-axis. The material corresponding to the bottom of the interface is referred to as the \"**substrate**\", and the top - as the \"**layer**\". \n",
"\n",
- "2. The interface with the lowest strain is selected and relaxed using the optimizer selected below (BFGS, by default). The EMT potential is used as an energy calculator.\n"
+ "2. Perform strain matching on the slabs to extract the supercell dimensions. The algorithm has a set of parameters, such as the maximum area considered, that can be configured by editing the cells below.\n",
+ "\n",
+ "3. When the strain matching is finished, the interface with the lowest strain (and the smallest number of atoms) is selected. We create the corresponding supercells and place them at a specified distance from each other (note no shift is performed currently).\n"
]
},
{
@@ -34,7 +36,9 @@
"source": [
"## 1. Set Input Parameters\n",
"\n",
- "### 1.1. Select Substrate and Layer from Input Materials\n"
+ "### 1.1. Select Substrate and Layer from Input Materials\n",
+ "Imported `InterfaceSettings` is a class that specifies the parameters for the construction of the interface. The default values are assumed if properties are not set during the initialization.\n",
+ "Additionally, specify if the termination selection is done using interactive prompt, or the via selecting the termination index in the code."
]
},
{
@@ -43,28 +47,25 @@
"metadata": {},
"outputs": [],
"source": [
- "SUBSTRATE_PARAMETERS = {\n",
- " \"MATERIAL_INDEX\": 0, # the index of the material in the materials_in list\n",
- " \"MILLER_INDICES\": (1, 1, 1), # the miller indices of the interfacial plane\n",
- " \"THICKNESS\": 3, # in layers\n",
- "}\n",
+ "from mat3ra.made.tools.build.interface import InterfaceSettings\n",
"\n",
- "LAYER_PARAMETERS = {\n",
- " \"MATERIAL_INDEX\": 1, # the index of the material in the materials_in list\n",
- " \"MILLER_INDICES\": (0, 0, 1), # the miller indices of the interfacial plane\n",
- " \"THICKNESS\": 1, # in layers\n",
- "}\n",
+ "interface_settings = InterfaceSettings()\n",
+ "interface_settings.max_area = 50 # maximum area to consider when matching\n",
+ "interface_settings.SubstrateParameters.miller_indices = (1, 1, 1) # the Miller indices of the interfacial plane of the substrate\n",
+ "interface_settings.SubstrateParameters.thickness = 6 # substrate thickness in layers\n",
+ "interface_settings.LayerParameters.miller_indices = (0, 0, 1) # the Miller indices of the interfacial plane of the layer\n",
+ "interface_settings.LayerParameters.thickness = 1 # layer thickness in layers\n",
"\n",
- "USE_CONVENTIONAL_CELL = True # if True, the surface plane is constructed using miller indices of the conventional cell"
+ "IS_TERMINATION_SELECTION_INTERACTIVE = False # if True, the user can select the termination interactively\n",
+ "TERMINATION_INDEX = 0 # the default termination index that is used if no termination selected, ignored in interactive mode"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 1.2. Set Interface Parameters\n",
- "\n",
- "The distance between layer and substrate and maximum area to consider when matching.\n"
+ "### 1.2. Set Algorithm Parameters for Strain Matching (Optional)\n",
+ "The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
]
},
{
@@ -73,47 +74,41 @@
"metadata": {},
"outputs": [],
"source": [
- "INTERFACE_PARAMETERS = {\n",
- " \"DISTANCE_Z\": 3.0, # in Angstroms\n",
- " \"MAX_AREA\": 400, # in Angstroms^2\n",
- "}"
+ "from mat3ra.made.tools.build.interface import ZSLParameters\n",
+ "interface_settings.ZSLParameters = ZSLParameters(\n",
+ " max_area_tol=0.09, # maximum tolerance on ratio of super-lattices to consider equal\n",
+ " max_length_tol=0.03, # maximum length tolerance for two vectors to be considered equal\n",
+ " max_angle_tol=0.01, # maximum angle tolerance for two sets of vectors to have equal angles\n",
+ ")"
]
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "### 1.3. Set Algorithm Parameters\n"
- ]
+ "### 1.3. Set Relaxation Parameters"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "ZSL_PARAMETERS = {\n",
- " \"MAX_AREA\": INTERFACE_PARAMETERS[\"MAX_AREA\"], # The area to consider in Angstrom^2\n",
- " \"MAX_AREA_TOL\": 0.09, # The area within this tolerance is considered equal\n",
- " \"MAX_LENGTH_TOL\": 0.03, # supercell lattice vectors lengths within this tolerance are considered equal\n",
- " \"MAX_ANGLE_TOL\": 0.01, # supercell lattice angles within this tolerance are considered equal\n",
- " \"STRAIN_TOL\": 10e-6, # strains within this tolerance are considered equal\n",
- "}\n",
"RELAXATION_PARAMETERS = {\n",
- " # Relaxation stops when the largest force component is less than fmax.\n",
- " # In ev/Angstrom, per https://wiki.fysik.dtu.dk/ase/ase/optimize.html\n",
- " \"FMAX\": 0.05,\n",
- " # The optimization algorithm: BFGS, FIRE, etc.\n",
- " # per https://wiki.fysik.dtu.dk/ase/ase/optimize.html#local-optimization\n",
- " \"OPTIMIZER\": \"BFGS\",\n",
+ " \"FMAX\": 0.018,\n",
"}"
- ]
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 2. Install Packages\n"
+ "## 2. Install Packages\n",
+ "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` as directed in README."
]
},
{
@@ -123,44 +118,40 @@
"outputs": [],
"source": [
"import sys\n",
+ "\n",
"if sys.platform == \"emscripten\":\n",
" import micropip\n",
" await micropip.install('mat3ra-api-examples', deps=False)\n",
- "from utils.jupyterlite import install_packages\n",
- "await install_packages(\"create_interface_with_min_strain_zsl.ipynb\",\"../../config.yml\")"
+ " from utils.jupyterlite import install_packages\n",
+ " await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
]
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
- "## 3. Load and prepare Input Materials"
- ],
- "metadata": {
- "collapsed": false
- }
+ "## 3. Load input Materials\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "tags": [],
+ "trusted": true
+ },
"outputs": [],
"source": [
+ "from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
- "from pymatgen.analysis.structure_analyzer import SpacegroupAnalyzer\n",
- "from src.utils import to_pymatgen\n",
+ "\n",
+ "from utils.visualize import visualize_materials as visualize\n",
"\n",
"# Get the list of input materials and load them into `materials_in` variable\n",
"get_data(\"materials_in\", globals())\n",
- "\n",
- "if \"materials_in\" in globals():\n",
- " pymatgen_materials = [to_pymatgen(item) for item in materials_in]\n",
- " if USE_CONVENTIONAL_CELL: pymatgen_materials = [SpacegroupAnalyzer(item).get_conventional_standard_structure() for\n",
- " item in pymatgen_materials]\n",
- "\n",
- " for material in pymatgen_materials:\n",
- " print(material, \"\\n\")"
- ],
- "metadata": {
- "collapsed": false
- }
+ "materials = list(map(Material, globals()[\"materials_in\"]))\n",
+ "visualize(materials, repetitions=[1, 1, 1], rotation=\"0x\")"
+ ]
},
{
"cell_type": "markdown",
@@ -168,80 +159,32 @@
"source": [
"## 4. Create interfaces\n",
"\n",
- "### 4.1. Extract Interfaces and Terminations\n",
+ "### 4.1. Initialize the interface builder\n",
"\n",
- "Extract all possible layer/substrate supercell combinations within the maximum area including different terminations.\n"
+ "Initialize the interface builder with the materials and interface settings."
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "tags": [],
- "trusted": true
- },
+ "metadata": {},
"outputs": [],
"source": [
- "from src.pymatgen_coherent_interface_builder import CoherentInterfaceBuilder, ZSLGenerator\n",
- "from src.utils import translate_to_bottom\n",
- "\n",
- "# Translate the materials to the bottom of the cell to allow for multilayer heterostructures creation\n",
- "pymatgen_materials = [translate_to_bottom(item) for item in pymatgen_materials]\n",
- "\n",
- "def create_interfaces(settings: dict):\n",
- " print(\"Creating interfaces...\")\n",
- " zsl = ZSLGenerator(\n",
- " max_area_ratio_tol=settings[\"ZSL_PARAMETERS\"][\"MAX_AREA_TOL\"],\n",
- " max_area=settings[\"ZSL_PARAMETERS\"][\"MAX_AREA\"],\n",
- " max_length_tol=settings[\"ZSL_PARAMETERS\"][\"MAX_LENGTH_TOL\"],\n",
- " max_angle_tol=settings[\"ZSL_PARAMETERS\"][\"MAX_ANGLE_TOL\"],\n",
- " )\n",
- "\n",
- " cib = CoherentInterfaceBuilder(\n",
- " substrate_structure=pymatgen_materials[settings[\"SUBSTRATE_PARAMETERS\"][\"MATERIAL_INDEX\"]],\n",
- " film_structure=pymatgen_materials[settings[\"LAYER_PARAMETERS\"][\"MATERIAL_INDEX\"]],\n",
- " substrate_miller=settings[\"SUBSTRATE_PARAMETERS\"][\"MILLER_INDICES\"],\n",
- " film_miller=settings[\"LAYER_PARAMETERS\"][\"MILLER_INDICES\"],\n",
- " zslgen=zsl,\n",
- " strain_tol=settings[\"ZSL_PARAMETERS\"][\"STRAIN_TOL\"],\n",
- " )\n",
- "\n",
- " # Find terminations\n",
- " cib._find_terminations()\n",
- " terminations = cib.terminations\n",
- "\n",
- " # Create interfaces for each termination\n",
- " interfaces = {}\n",
- " for termination in terminations:\n",
- " interfaces[termination] = []\n",
- " for interface in cib.get_interfaces(\n",
- " termination,\n",
- " gap=settings[\"INTERFACE_PARAMETERS\"][\"DISTANCE_Z\"],\n",
- " film_thickness=settings[\"LAYER_PARAMETERS\"][\"THICKNESS\"],\n",
- " substrate_thickness=settings[\"SUBSTRATE_PARAMETERS\"][\"THICKNESS\"],\n",
- " in_layers=True,\n",
- " ):\n",
- " # Wrap atoms to unit cell\n",
- " interface[\"interface\"].make_supercell((1, 1, 1), to_unit_cell=True)\n",
- " interfaces[termination].append(interface)\n",
- " return interfaces, terminations\n",
- "\n",
- "\n",
- "interfaces, terminations = create_interfaces(\n",
- " settings={\n",
- " \"SUBSTRATE_PARAMETERS\": SUBSTRATE_PARAMETERS,\n",
- " \"LAYER_PARAMETERS\": LAYER_PARAMETERS,\n",
- " \"ZSL_PARAMETERS\": ZSL_PARAMETERS,\n",
- " \"INTERFACE_PARAMETERS\": INTERFACE_PARAMETERS,\n",
- " }\n",
- ")\n"
+ "from mat3ra.made.tools.build import init_interface_builder\n",
+ "\n",
+ "interface_builder = init_interface_builder(\n",
+ " substrate=materials[0],\n",
+ " layer=materials[1],\n",
+ " settings=interface_settings\n",
+ ")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 4.2. Print out the interfaces and terminations\n"
+ "### 4.2. Select the termination\n",
+ "Possible terminations for the interface are found by the interface builder. The user can select the termination interactively or use the default one."
]
},
{
@@ -250,18 +193,23 @@
"metadata": {},
"outputs": [],
"source": [
- "print(f'Found {len(terminations)} terminations')\n",
- "for termination in terminations:\n",
- " print(f\"Found {len(interfaces[termination])} interfaces for\", termination, \"termination\")"
+ "from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n",
+ "terminations = interface_builder.terminations\n",
+ "\n",
+ "if IS_TERMINATION_SELECTION_INTERACTIVE:\n",
+ " if sys.platform == \"emscripten\":\n",
+ " selected_termination = await ui_prompt_select_array_element_by_index_pyodide(terminations, element_name=\"termination\")\n",
+ " else:\n",
+ " selected_termination = ui_prompt_select_array_element_by_index(terminations, element_name=\"termination\")\n",
+ "else: \n",
+ " selected_termination = terminations[TERMINATION_INDEX]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 5. Sort interfaces by strain\n",
- "\n",
- "### 5.1. Sort all interfaces\n"
+ "### 4.3. Create interfaces for the selected termination"
]
},
{
@@ -270,28 +218,22 @@
"metadata": {},
"outputs": [],
"source": [
- "# Could be \"strain\", \"von_mises_strain\", \"mean_abs_strain\"\n",
- "strain_mode = \"mean_abs_strain\"\n",
- "\n",
- "\n",
- "# Sort interfaces by the specified strain mode and number of sites\n",
- "def sort_interfaces(interfaces, terminations):\n",
- " sorted_interfaces = {}\n",
- " for termination in terminations:\n",
- " sorted_interfaces[termination] = sorted(\n",
- " interfaces[termination], key=lambda x: (x[strain_mode], x[\"interface\"].num_sites)\n",
- " )\n",
- " return sorted_interfaces\n",
- "\n",
+ "from mat3ra.made.tools.build import create_interfaces\n",
"\n",
- "sorted_interfaces = sort_interfaces(interfaces, terminations)"
+ "interface_data_holder = create_interfaces(\n",
+ " settings=interface_settings,\n",
+ " sort_by_strain_and_size=True,\n",
+ " remove_duplicates=True,\n",
+ " interface_builder=interface_builder,\n",
+ " termination=selected_termination,\n",
+ ")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 5.2. Print out interfaces with lowest strain for each termination\n"
+ "### 4.3. Print out interface with the lowest strain for selected termination\n"
]
},
{
@@ -300,30 +242,29 @@
"metadata": {},
"outputs": [],
"source": [
- "for termination in terminations:\n",
- " print(f\"Interface with lowest strain for termination {termination} (index 0):\")\n",
- " first_interface = interfaces[termination][0]\n",
- " print(\" strain:\", first_interface[strain_mode] * 100, \"%\")\n",
- " print(\" number of atoms:\", first_interface[\"interface\"].num_sites)"
+ "print(f\"Interface with lowest strain for termination {selected_termination} (index 0):\")\n",
+ "interfaces = interface_data_holder.get_interfaces_for_termination(selected_termination)\n",
+ "first_interface = interfaces[0]\n",
+ "print(f\" strain: {first_interface.get_mean_abs_strain() * 100:.3f}%\")\n",
+ "print(\" number of atoms:\", first_interface.num_sites)"
]
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 6. Plot the results\n",
+ "## 5. Plot the results\n",
"\n",
- "Plot the number of atoms vs strain. Adjust the parameters as needed.\n"
- ]
+ "Plot the number of atoms vs strain. Adjust the parameters as needed."
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "import plotly.graph_objs as go\n",
- "from collections import defaultdict\n",
+ "from utils.plot import plot_strain_vs_atoms\n",
"\n",
"PLOT_SETTINGS = {\n",
" \"HEIGHT\": 600,\n",
@@ -331,82 +272,25 @@
" \"Y_SCALE\": \"log\", # or linear\n",
"}\n",
"\n",
+ "plot_strain_vs_atoms(interface_data_holder, PLOT_SETTINGS)\n",
"\n",
- "def plot_strain_vs_atoms(sorted_interfaces, terminations, settings):\n",
- " # Create a mapping from termination to its index\n",
- " termination_to_index = {termination: i for i, termination in enumerate(terminations)}\n",
- "\n",
- " grouped_interfaces = defaultdict(list)\n",
- " for termination, interfaces in sorted_interfaces.items():\n",
- " for index, interface_data in enumerate(interfaces):\n",
- " strain_percentage = interface_data[\"mean_abs_strain\"] * 100\n",
- " num_sites = interface_data[\"interface\"].num_sites\n",
- " key = (strain_percentage, num_sites)\n",
- " grouped_interfaces[key].append((index, termination))\n",
- "\n",
- " data = []\n",
- " for (strain, num_sites), indices_and_terminations in grouped_interfaces.items():\n",
- " termination_indices = defaultdict(list)\n",
- " for index, termination in indices_and_terminations:\n",
- " termination_indices[termination].append(index)\n",
- " all_indices = [index for indices in termination_indices.values() for index in indices]\n",
- " index_range = f\"{min(all_indices)}-{max(all_indices)}\" if len(all_indices) > 1 else str(min(all_indices))\n",
- "\n",
- " hover_text = \"
-----
\".join(\n",
- " f\"Termination: {termination}
Termination index: {termination_to_index[termination]}
Interfaces Index Range: {index_range}
Strain: {strain:.2f}%
Atoms: {num_sites}\"\n",
- " for termination, indices in termination_indices.items()\n",
- " )\n",
- " trace = go.Scatter(\n",
- " x=[strain],\n",
- " y=[num_sites],\n",
- " text=[hover_text],\n",
- " mode=\"markers\",\n",
- " hoverinfo=\"text\",\n",
- " name=f\"Indices: {index_range}\",\n",
- " )\n",
- " data.append(trace)\n",
- "\n",
- " layout = go.Layout(\n",
- " xaxis=dict(title=\"Strain (%)\", type=settings[\"X_SCALE\"]),\n",
- " yaxis=dict(title=\"Number of atoms\", type=settings[\"Y_SCALE\"]),\n",
- " hovermode=\"closest\",\n",
- " height=settings[\"HEIGHT\"],\n",
- " legend_title_text=\"Interfaces Index Range\",\n",
- " )\n",
- " fig = go.Figure(data=data, layout=layout)\n",
- " fig.show()\n",
- "\n",
- "\n",
- "plot_strain_vs_atoms(sorted_interfaces, terminations, PLOT_SETTINGS)\n",
- "\n",
- "for i, termination in enumerate(terminations):\n",
- " print(f\"Termination {i}:\", termination)"
- ]
+ "print(\"Terminations: \\n\", interface_data_holder.terminations)"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 7. Select the interface with the desired termination and strain\n",
- "\n",
- "The data in `sorted_interfaces` now contains an object with the following structure:\n",
- "\n",
- "```json\n",
- "{\n",
- " \"('C_P6/mmm_2', 'Si_R-3m_1')\": [\n",
- " { ...interface for ('C_P6/mmm_2', 'Si_R-3m_1') at index 0...},\n",
- " { ...interface for ('C_P6/mmm_2', 'Si_R-3m_1') at index 1...},\n",
- " ...\n",
- " ],\n",
- " \"\": [\n",
- " { ...interface for 'termination at index 1' at index 0...},\n",
- " { ...interface for 'termination at index 1' at index 1...},\n",
- " ...\n",
- " ]\n",
- "}\n",
- "```\n",
+ "## 6. Select the interface to relax\n",
+ "\n",
+ "### 6.1. Select the interface with the desired termination and strain\n",
"\n",
- "Select the index for termination first, and for it - the index in the list of corresponding interfaces sorted by strain (index 0 has minimum strain).\n"
+ "\n",
+ "Select the index for termination first, and for it - the index in the list of corresponding interfaces sorted by strain (index 0 has minimum strain)."
]
},
{
@@ -415,25 +299,46 @@
"metadata": {},
"outputs": [],
"source": [
- "termination_index = 0\n",
- "interface_index = 0\n",
- "\n",
- "termination = terminations[termination_index]\n",
- "\n",
- "interface = sorted_interfaces[termination][interface_index][\"interface\"]\n",
- "\n",
- "interface_strain = f\"{sorted_interfaces[termination][interface_index]['mean_abs_strain'] * 100:.2f}%\""
+ "# Could be either the termination as tuple, e.g. `('Ni_P6/mmm_1', 'C_C2/m_2')` or its index: `0`\n",
+ "termination_or_its_index = selected_termination\n",
+ "# select the first interface with the lowest strain and the smallest number of atoms\n",
+ "interfaces_slice_range_or_index = 0\n",
+ "interface = interface_data_holder.get_interfaces_as_materials(termination_or_its_index, interfaces_slice_range_or_index)"
]
},
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### 6.2. Visualize the selected interface(s)"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "visualize(interface, repetitions=[1, 1, 1], rotation=\"0x\")"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "collapsed": false
+ }
+ },
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 8. Apply relaxation to the interface\n",
- "\n",
- "### 8.1. Apply relaxation to the selected interface with ASE\n",
- "\n",
- "Optimizer is set from the available options in the settings and EMT is used as the energy calculator."
+ "## 7. Apply relaxation\n",
+ "### 7.1. Apply relaxation to the selected interface"
]
},
{
@@ -442,25 +347,31 @@
"metadata": {},
"outputs": [],
"source": [
- "import logging\n",
- "\n",
"import plotly.graph_objs as go\n",
"from IPython.display import display\n",
"from plotly.subplots import make_subplots\n",
+ "from src.utils import ase_to_poscar, pymatgen_to_ase\n",
+ "from ase.optimize import BFGS\n",
+ "from ase.calculators.emt import EMT\n",
"\n",
- "# Per https://github.com/materialsvirtuallab/matgl/blob/main/examples/Relaxations%20and%20Simulations%20using%20the%20M3GNet%20Universal%20Potential.ipynb\n",
- "from src.utils import poscar_to_ase, ase_to_poscar, ase_to_pymatgen, pymatgen_to_ase\n",
- "from ase.optimize import BFGS, FIRE\n",
- "from ase.calculators.emt import EMT, parameters as EMT_parameters\n",
- "\n",
+ "# Set up the calculator \n",
"calculator = EMT()\n",
- "ase_original_interface = pymatgen_to_ase(interface)\n",
"\n",
- "# Create a plotly figure widget to display energy convergence\n",
+ "# Set up the interface for relaxation\n",
+ "ase_interface = pymatgen_to_ase(interface)\n",
+ "ase_interface.set_calculator(calculator)\n",
+ "dyn = BFGS(ase_interface)\n",
+ "\n",
+ "# Initialize empty lists to store steps and energies\n",
+ "steps = []\n",
+ "energies = []\n",
+ "\n",
+ "# Create a plotly figure widget\n",
"fig = make_subplots(rows=1, cols=1, specs=[[{\"type\": \"scatter\"}]])\n",
"scatter = go.Scatter(x=[], y=[], mode='lines+markers', name='Energy')\n",
"fig.add_trace(scatter)\n",
- "fig.update_layout(title_text='Convergence', xaxis_title='Step', yaxis_title='Energy (eV)')\n",
+ "fig.update_layout(title_text='Real-time Optimization Progress', xaxis_title='Step', yaxis_title='Energy (eV)')\n",
+ "\n",
"# Display figure widget\n",
"f = go.FigureWidget(fig)\n",
"display(f)\n",
@@ -483,48 +394,29 @@
" f.data[0].y = energies\n",
"\n",
"\n",
- "# check if EMT potential is available for every element in the interface\n",
- "emt_elements = EMT_parameters.keys()\n",
- "unique_elements = set(site.species_string for site in interface.sites)\n",
- "if unique_elements.issubset(emt_elements):\n",
- " # select optimizer based on the setup parameters\n",
- " optimizer = {\"BFGS\": BFGS, \"FIRE\": FIRE}[RELAXATION_PARAMETERS[\"OPTIMIZER\"]]\n",
- "\n",
- " # relax the interface in place\n",
- " ase_interface = ase_original_interface.copy()\n",
- " ase_interface.set_calculator(calculator)\n",
- " dyn = optimizer(ase_interface)\n",
- " steps = []\n",
- " energies = []\n",
- "\n",
- " dyn.attach(plotly_callback, interval=1)\n",
- " dyn.run(fmax=RELAXATION_PARAMETERS[\"FMAX\"])\n",
- "\n",
- " # extract results\n",
- " ase_final_interface = ase_interface\n",
- " name_relaxation_suffix = f\"Relaxed {RELAXATION_PARAMETERS['OPTIMIZER']} fmax={RELAXATION_PARAMETERS['FMAX']}\"\n",
- " ase_original_interface.set_calculator(calculator)\n",
- " original_energy = ase_original_interface.get_total_energy()\n",
- " relaxed_energy = ase_final_interface.get_total_energy()\n",
- "\n",
- " # print out the final relaxed structure and energy\n",
- " print('Original structure:\\n', ase_to_poscar(ase_original_interface))\n",
- " print('\\nRelaxed structure:\\n', ase_to_poscar(ase_final_interface))\n",
- " print(f\"The final energy is {float(relaxed_energy):.3f} eV.\")\n",
- "\n",
- "else:\n",
- " logging.warning(\n",
- " f\"The EMT potential is not implemented for the following elements in the interface: {unique_elements - emt_elements}.\\nList of supported elements: {list(emt_elements)}.\")\n",
- " ase_final_interface = ase_original_interface\n",
- " name_relaxation_suffix = \"Non-relaxed\"\n",
- " relaxed_energy = original_energy = None\n"
+ "# Run the relaxation\n",
+ "dyn.attach(plotly_callback, interval=1)\n",
+ "dyn.run(fmax=RELAXATION_PARAMETERS[\"FMAX\"])\n",
+ "\n",
+ "# Extract results\n",
+ "ase_original_interface = pymatgen_to_ase(interface)\n",
+ "ase_original_interface.set_calculator(calculator)\n",
+ "ase_final_interface = ase_interface\n",
+ "\n",
+ "original_energy = ase_original_interface.get_total_energy()\n",
+ "relaxed_energy = ase_interface.get_total_energy()\n",
+ "\n",
+ "# Print out the final relaxed structure and energy\n",
+ "print('Original structure:\\n', ase_to_poscar(ase_original_interface))\n",
+ "print('\\nRelaxed structure:\\n', ase_to_poscar(ase_final_interface))\n",
+ "print(f\"The final energy is {float(relaxed_energy):.3f} eV.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 8.2. View structure before and after relaxation\n"
+ "### 7.2. View structure before and after relaxation"
]
},
{
@@ -538,7 +430,6 @@
"from ase.build import make_supercell\n",
"from IPython.display import HTML\n",
"import io\n",
- "from src.utils import calculate_average_interlayer_distance\n",
"\n",
"\n",
"def visualize_material_base64(material, title: str, rotation: str = '0x', number_of_repetitions: int = 3):\n",
@@ -571,150 +462,87 @@
"# Display the interfaces before and after relaxation\n",
"html_content = f'{html_original}{html_relaxed}
'\n",
"display(HTML(html_content))\n",
- "\n",
- "# Calculate the average interlayer distance, see References [1] and [2] below\n",
- "average_distance = calculate_average_interlayer_distance(ase_final_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"],\n",
- " LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "print(\"Interfacial distance:\")\n",
- "print(f\" Original: {INTERFACE_PARAMETERS['DISTANCE_Z']:.3f} Å\")\n",
- "print(f\"Final average: {average_distance:.3f} Å\")\n",
- "print(f\" Delta: {average_distance - INTERFACE_PARAMETERS['DISTANCE_Z']:.3f} Å\")"
+ "\n"
]
},
{
"cell_type": "markdown",
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"source": [
- "### 8.3. Calculate the energy metrics\n",
- "Calculate the energy metrics for the relaxed interface.\n",
- "The effective delta energy per area calculation accounts for the energy contribution of each component (substrate and layer) relative to their proportion in the overall interface. \n"
+ "### 7.3. Calculate energy energy using ASE EMT"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
- "import numpy as np\n",
- "from ase import Atoms\n",
- "from ase.calculators.calculator import Calculator\n",
- "\n",
- "\n",
- "def filter_atoms_by_tag(atoms: Atoms, material_index):\n",
+ "def filter_atoms_by_tag(atoms, material_index):\n",
" \"\"\"Filter atoms by their tag, corresponding to the material index.\"\"\"\n",
" return atoms[atoms.get_tags() == material_index]\n",
"\n",
"\n",
- "def get_surface_area(atoms: Atoms):\n",
- " \"\"\"Calculate the surface area of the atoms.\"\"\"\n",
- " matrix = atoms.cell\n",
- " return np.linalg.norm(np.cross(matrix[0], matrix[1]))\n",
- "\n",
- "\n",
- "def get_total_energy(atoms: Atoms, calculator: Calculator):\n",
+ "def calculate_energy(atoms, calculator):\n",
" \"\"\"Set calculator for atoms and return their total energy.\"\"\"\n",
" atoms.set_calculator(calculator)\n",
" return atoms.get_total_energy()\n",
"\n",
"\n",
- "def get_total_energy_per_atom(atoms: Atoms, calculator: Calculator):\n",
- " \"\"\"Calculate the energy per atom.\"\"\"\n",
- " return get_total_energy(atoms, calculator) / atoms.get_global_number_of_atoms()\n",
- "\n",
- "\n",
- "def get_surface_energy(slab: Atoms, bulk: Atoms, calculator: Calculator):\n",
- " \"\"\"Calculate the surface energy by subtracting the bulk energy from the slab energy.\"\"\"\n",
- " number_of_atoms = slab.get_global_number_of_atoms()\n",
- " area = get_surface_area(slab)\n",
- " return (get_total_energy(slab, calculator) - get_total_energy_per_atom(bulk, calculator) * number_of_atoms) / (\n",
- " 2 * area)\n",
- "\n",
- "\n",
- "def get_adhesion_energy(interface: Atoms, substrate_slab: Atoms, layer_slab: Atoms, calculator: Calculator):\n",
- " \"\"\"Calculate the adhesion energy.\n",
- " The adhesion energy is the difference between the energy of the interface and the sum of the energies of the substrate and layer.\n",
- " According to: 10.1088/0953-8984/27/30/305004\n",
- " \"\"\"\n",
- " energy_substrate_slab = get_total_energy(substrate_slab, calculator)\n",
- " energy_layer_slab = get_total_energy(layer_slab, calculator)\n",
- " energy_interface = get_total_energy(interface, calculator)\n",
- " area = get_surface_area(interface)\n",
- " return (energy_substrate_slab + energy_layer_slab - energy_interface) / area\n",
- "\n",
- "\n",
- "def get_interfacial_energy(interface: Atoms, substrate_slab: Atoms, substrate_bulk: Atoms, layer_slab: Atoms,\n",
- " layer_bulk: Atoms, calculator: Calculator):\n",
- " \"\"\"Calculate the interfacial energy.\n",
- " The interfacial energy is the sum of the surface energies of the substrate and layer minus the adhesion energy.\n",
- " According to Dupré's formula\"\"\"\n",
- "\n",
- " surface_energy_substrate = get_surface_energy(substrate_slab, substrate_bulk, calculator)\n",
- " surface_energy_layer = get_surface_energy(layer_slab, layer_bulk, calculator)\n",
- " adhesion_energy = get_adhesion_energy(interface, substrate_slab, layer_slab, calculator)\n",
- " return surface_energy_layer + surface_energy_substrate - adhesion_energy\n",
- "\n",
- "\n",
- "# Create necessary structures\n",
- "original_substrate_slab = filter_atoms_by_tag(ase_original_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "original_substrate_bulk = pymatgen_to_ase(pymatgen_materials[SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"]])\n",
- "original_layer_slab = filter_atoms_by_tag(ase_original_interface, LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "original_layer_bulk = pymatgen_to_ase(pymatgen_materials[LAYER_PARAMETERS[\"MATERIAL_INDEX\"]])\n",
- "\n",
- "# Calculate the energy metrics\n",
- "surface_energy_substrate = get_surface_energy(original_substrate_slab, original_substrate_bulk, calculator)\n",
- "surface_energy_layer = get_surface_energy(original_layer_slab, original_layer_bulk, calculator)\n",
- "adhesion_energy = get_adhesion_energy(ase_final_interface, original_substrate_slab, original_layer_slab, calculator)\n",
- "interfacial_energy = surface_energy_layer + surface_energy_substrate - adhesion_energy\n",
- "\n",
- "print(\"Energy metrics:\")\n",
- "print(\n",
- " f\"Original surface energy substrate: {surface_energy_substrate:.3f} eV/Å^2 ({surface_energy_substrate / 0.16:.3f} J/m^2)\")\n",
- "print(f\"Original surface energy layer: {surface_energy_layer:.3f} eV/Å^2 ({surface_energy_layer / 0.16:.3f} J/m^2)\")\n",
- "print(f\"Adhesion energy: {adhesion_energy:.3f} eV/Å^2 ({adhesion_energy / 0.16:.3f} J/m^2)\")\n",
- "print(f\"Interfacial energy: {interfacial_energy:.3f} eV/Å^2 ({interfacial_energy / 0.16:.3f} J/m^2)\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## 9. Pass relaxed interface to Materials Designer"
+ "def calculate_delta_energy(total_energy, *component_energies):\n",
+ " \"\"\"Calculate the delta energy by subtracting component energies from the total energy.\"\"\"\n",
+ " return total_energy - sum(component_energies)\n",
+ "\n",
+ "\n",
+ "# Filter atoms for original and relaxed interfaces\n",
+ "substrate_original_interface = filter_atoms_by_tag(ase_original_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"])\n",
+ "layer_original_interface = filter_atoms_by_tag(ase_original_interface, LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
+ "substrate_relaxed_interface = filter_atoms_by_tag(ase_final_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"])\n",
+ "layer_relaxed_interface = filter_atoms_by_tag(ase_final_interface, LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
+ "\n",
+ "# Calculate energies\n",
+ "original_substrate_energy = calculate_energy(substrate_original_interface, calculator)\n",
+ "original_layer_energy = calculate_energy(layer_original_interface, calculator)\n",
+ "relaxed_substrate_energy = calculate_energy(substrate_relaxed_interface, calculator)\n",
+ "relaxed_layer_energy = calculate_energy(layer_relaxed_interface, calculator)\n",
+ "\n",
+ "# Calculate delta energies\n",
+ "delta_original = calculate_delta_energy(original_energy, original_substrate_energy, original_layer_energy)\n",
+ "delta_relaxed = calculate_delta_energy(relaxed_energy, relaxed_substrate_energy, relaxed_layer_energy)\n",
+ "\n",
+ "# Calculate area and effective delta per area\n",
+ "area = ase_original_interface.get_volume() / ase_original_interface.cell[2, 2]\n",
+ "number_of_interface_atoms = ase_final_interface.get_global_number_of_atoms()\n",
+ "number_of_substrate_atoms = substrate_relaxed_interface.get_global_number_of_atoms()\n",
+ "number_of_layer_atoms = layer_relaxed_interface.get_global_number_of_atoms()\n",
+ "effective_delta_relaxed = (relaxed_energy/number_of_interface_atoms - (relaxed_substrate_energy/number_of_substrate_atoms + relaxed_layer_energy/number_of_layer_atoms)) / (2 * area)\n",
+ "\n",
+ "# Print out the metrics\n",
+ "print(f\"Original Substrate energy: {original_substrate_energy:.4f} eV\")\n",
+ "print(f\"Relaxed Substrate energy: {relaxed_substrate_energy:.4f} eV\")\n",
+ "print(f\"Original Layer energy: {original_layer_energy:.4f} eV\")\n",
+ "print(f\"Relaxed Layer energy: {relaxed_layer_energy:.4f} eV\")\n",
+ "print(\"\\nDelta between interface energy and sum of component energies\")\n",
+ "print(f\"Original Delta: {delta_original:.4f} eV\")\n",
+ "print(f\"Relaxed Delta: {delta_relaxed:.4f} eV\")\n",
+ "print(f\"Original Delta per area: {delta_original / area:.4f} eV/Ang^2\")\n",
+ "print(f\"Relaxed Delta per area: {delta_relaxed / area:.4f} eV/Ang^2\")\n",
+ "print(f\"Relaxed interface energy: {relaxed_energy:.4f} eV\")\n",
+ "print(f\"Effective relaxed Delta per area: {effective_delta_relaxed:.4f} eV/Ang^2 ({effective_delta_relaxed / 0.16:.4f} J/m^2)\\n\")\n",
+ "\n",
+ "# Print out the POSCARs\n",
+ "print(\"Relaxed interface:\\n\", ase_to_poscar(ase_final_interface))\n",
+ "print(\"Relaxed substrate:\\n\", ase_to_poscar(substrate_relaxed_interface))\n",
+ "print(\"Relaxed layer:\\n\", ase_to_poscar(layer_relaxed_interface))"
]
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
- "source": [
- "from utils.jupyterlite import set_data\n",
- "from src.utils import from_pymatgen\n",
- "\n",
- "esse_final_interface = from_pymatgen(ase_to_pymatgen(ase_final_interface))\n",
- "esse_final_interface[\n",
- " 'name'] = f\"{esse_final_interface['name']}, Interface, Strain: {interface_strain}, {name_relaxation_suffix}\"\n",
- "\n",
- "materials_out = [esse_final_interface]\n",
- "set_data(\"materials\", materials_out)"
- ]
- },
- {
- "cell_type": "markdown",
+ "source": [],
"metadata": {
"collapsed": false
- },
- "source": [
- "## References\n",
- "\n",
- "[1] Tesch, J., Leicht, P., Blumenschein, F. et al., \"Structural and electronic properties of graphene nanoflakes on Au(111) and Ag(111).\" Sci Rep 6, 23439 (2016). (https://doi.org/10.1038/srep23439). *Summary*: has Graphene/Au(111) and Graphene/Ag(111) interfaces with distances of 3.23 A and 3.13 A respectively.\n",
- "\n",
- "[2] Dahal, A., Batzill M., \"Graphene–nickel interfaces: a review.\" Nanoscale, 2014,6, 2548-2562. (https://doi.org/10.1039/C3NR05279F). *Summary*: has notion of Graphene-nickel interface with distance: 2.1 A."
- ]
+ }
}
],
"metadata": {
@@ -733,7 +561,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.2"
+ "version": "3.10.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
From 877d402eaec0ca9a478ac0dd67d13c5bb720646f Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Fri, 10 May 2024 21:18:25 -0700
Subject: [PATCH 02/33] update: use relaxation from made-tools
---
...te_interface_with_relaxation_ase_emt.ipynb | 57 +++++++++++++++++--
1 file changed, 51 insertions(+), 6 deletions(-)
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 c0eab3f6..5c435310 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -97,11 +97,19 @@
"source": [
"RELAXATION_PARAMETERS = {\n",
" \"FMAX\": 0.018,\n",
- "}"
+ "}\n",
+ "\n",
+ "from mat3ra.made.tools.modify import RelaxationSettings, CalculatorEnum, OptimizerEnum\n",
+ "relaxation_settings = RelaxationSettings()\n",
+ "\n",
+ "relaxation_settings.optimizer = OptimizerEnum.BFGS\n",
+ "relaxation_settings.calculator = CalculatorEnum.EMT\n",
+ "relaxation_settings.fmax = 0.05"
],
"metadata": {
"collapsed": false
- }
+ },
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -303,7 +311,7 @@
"termination_or_its_index = selected_termination\n",
"# select the first interface with the lowest strain and the smallest number of atoms\n",
"interfaces_slice_range_or_index = 0\n",
- "interface = interface_data_holder.get_interfaces_as_materials(termination_or_its_index, interfaces_slice_range_or_index)"
+ "interface = interface_data_holder.get_interfaces_as_materials(termination_or_its_index, interfaces_slice_range_or_index)[0]"
]
},
{
@@ -341,6 +349,29 @@
"### 7.1. Apply relaxation to the selected interface"
]
},
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "from utils.plot import create_realtime_plot, update_plot\n",
+ "\n",
+ "from mat3ra.made.tools.modify import relax_atoms\n",
+ "from mat3ra.made.tools.convert import to_ase\n",
+ "\n",
+ "final_interface = relax_atoms(Material(interface), relaxation_settings)\n",
+ "\n",
+ "f = create_realtime_plot()\n",
+ "steps = []\n",
+ "energies = []\n",
+ "update_plot(f, steps, energies)\n",
+ "\n",
+ "visualize(final_interface, repetitions=[1, 1, 1], rotation=\"0x\")"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -354,14 +385,24 @@
"from ase.optimize import BFGS\n",
"from ase.calculators.emt import EMT\n",
"\n",
+ "\n",
"# Set up the calculator \n",
"calculator = EMT()\n",
+ "print(calculator)\n",
"\n",
"# Set up the interface for relaxation\n",
- "ase_interface = pymatgen_to_ase(interface)\n",
+ "ase_interface = to_ase(interface)\n",
+ "print(ase_interface)\n",
"ase_interface.set_calculator(calculator)\n",
+ "print(ase_interface)\n",
"dyn = BFGS(ase_interface)\n",
- "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
"# Initialize empty lists to store steps and energies\n",
"steps = []\n",
"energies = []\n",
@@ -410,7 +451,11 @@
"print('Original structure:\\n', ase_to_poscar(ase_original_interface))\n",
"print('\\nRelaxed structure:\\n', ase_to_poscar(ase_final_interface))\n",
"print(f\"The final energy is {float(relaxed_energy):.3f} eV.\")"
- ]
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
},
{
"cell_type": "markdown",
From 8e4efbc21218cf649943da959d731ebdae0ee6dd Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 15 May 2024 20:35:16 -0700
Subject: [PATCH 03/33] chore: actual merge
---
...create_interface_with_min_strain_zsl.ipynb | 93 +++++++++++--------
1 file changed, 55 insertions(+), 38 deletions(-)
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 73e33034..71fddb1e 100644
--- a/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
+++ b/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
@@ -11,7 +11,7 @@
"Usage
\n",
"\n",
"1. Make sure to select Input Materials\n",
- "2. Set Interface Parameters (e.g. `distance_z`, `max_area`, `miller_indices`) below or use the default values\n",
+ "2. Set Input Parameters (e.g. `MILLER_INDICES`, `THICKNESS`, `MAX_AREA`) below or use the default values\n",
"3. Click \"Run\" > \"Run All Cells\" to run all cells\n",
"4. Wait for the run to complete (depending on the area, it can take 1-2 min or more). Scroll down to view cell results.\n",
"5. Review the strain plot and modify its parameters as needed\n",
@@ -34,10 +34,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 1. Set Interface Parameters\n",
+ "## 1. Set Input Parameters\n",
"\n",
"### 1.1. Set Substrate and Layer Parameters \n",
- "Imported `InterfaceSettings` is a class that specifies the parameters for the construction of the interface. The default values are assumed if properties are not set during the initialization.\n",
"Additionally, specify if the termination selection is done using interactive prompt, or the via selecting the termination index in the code."
]
},
@@ -47,20 +46,17 @@
"metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import InterfaceSettings\n",
+ "SUBSTRATE_PARAMETERS = {\n",
+ " \"MILLER_INDICES\": (1, 1, 1), # the miller indices of the interfacial plane\n",
+ " \"THICKNESS\": 3, # in layers\n",
+ "}\n",
"\n",
- "# Parameters can be set during the class initialization:\n",
- "interface_settings = InterfaceSettings(\n",
- " distance_z=3.0, # distance between two planes, in Angstroms\n",
- " max_area=400, # maximum area of the generated interfaces, in Angstroms^2\n",
- " use_conventional_cell=True, # if True, the surface plane is constructed using miller indices of the conventional cell\n",
- ")\n",
+ "LAYER_PARAMETERS = {\n",
+ " \"MILLER_INDICES\": (0, 0, 1), # the miller indices of the interfacial plane\n",
+ " \"THICKNESS\": 1, # in layers\n",
+ "}\n",
"\n",
- "# Parameters can be set after the initialization:\n",
- "interface_settings.SubstrateParameters.miller_indices = (1, 1, 1) # the Miller indices of the interfacial plane of the substrate\n",
- "interface_settings.SubstrateParameters.thickness = 3 # substrate thickness in layers\n",
- "interface_settings.LayerParameters.miller_indices = (0, 0, 1) # the Miller indices of the interfacial plane of the layer\n",
- "interface_settings.LayerParameters.thickness = 1 # layer thickness in layers\n",
+ "USE_CONVENTIONAL_CELL = True # if True, the surface plane is constructed using miller indices of the conventional cell\n",
"\n",
"IS_TERMINATION_SELECTION_INTERACTIVE = False # if True, the user can select the termination interactively\n",
"TERMINATION_INDEX = 0 # the default termination index that is used if no termination selected, ignored in interactive mode"
@@ -68,29 +64,55 @@
},
{
"cell_type": "markdown",
+ "metadata": {},
"source": [
- "### 1.2. Set Algorithm Parameters (Optional)\n",
- "The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
- ],
- "metadata": {
- "collapsed": false
- }
+ "### 1.2. Set Interface Parameters\n",
+ "\n",
+ "The distance between layer and substrate and maximum area to consider when matching.\n"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import ZSLParameters\n",
- "interface_settings.ZSLParameters = ZSLParameters(\n",
- " max_area_tol=0.09, # maximum tolerance on ratio of super-lattices to consider equal\n",
- " max_length_tol=0.03, # maximum length tolerance for two vectors to be considered equal\n",
- " max_angle_tol=0.01, # maximum angle tolerance for two sets of vectors to have equal angles\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
+ "INTERFACE_PARAMETERS = {\n",
+ " \"DISTANCE_Z\": 3.0, # in Angstroms\n",
+ " \"MAX_AREA\": 400, # in Angstroms^2\n",
+ "}"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 1.3. Set Algorithm Parameters"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "ZSL_PARAMETERS = {\n",
+ " \"MAX_AREA\": INTERFACE_PARAMETERS[\"MAX_AREA\"], # The area to consider in Angstrom^2\n",
+ " \"MAX_AREA_TOL\": 0.09, # The area within this tolerance is considered equal\n",
+ " \"MAX_LENGTH_TOL\": 0.03, # supercell lattice vectors lengths within this tolerance are considered equal\n",
+ " \"MAX_ANGLE_TOL\": 0.01, # supercell lattice angles within this tolerance are considered equal\n",
+ " \"STRAIN_TOL\": 10e-6, # strains within this tolerance are considered equal\n",
+ "}\n",
+ "\n",
+ "# unify the parameters\n",
+ "interface_settings = {\n",
+ " \"SUBSTRATE_PARAMETERS\": SUBSTRATE_PARAMETERS,\n",
+ " \"LAYER_PARAMETERS\": LAYER_PARAMETERS,\n",
+ " \"USE_CONVENTIONAL_CELL\": USE_CONVENTIONAL_CELL,\n",
+ " \"ZSL_PARAMETERS\": ZSL_PARAMETERS,\n",
+ " \"INTERFACE_PARAMETERS\": INTERFACE_PARAMETERS,\n",
+ "}"
+ ]
},
{
"cell_type": "markdown",
@@ -337,8 +359,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 6.3. Pass data to the outside runtime\n",
- "Enrich the selected interfaces names with the strain values and pass them to the application runtime."
+ "### 6.3. Pass data to the outside runtime"
]
},
{
@@ -349,10 +370,6 @@
"source": [
"from utils.jupyterlite import set_data\n",
"\n",
- "for interface in selected_interfaces:\n",
- " if \"Interface, Strain:\" not in interface[\"name\"]:\n",
- " interface[\"name\"] = f'{interface[\"name\"]}, Interface, Strain:{interface[\"metadata\"][\"interface_properties\"][\"mean_abs_strain\"]*100:.3f}%'\n",
- "\n",
"set_data(\"materials\", selected_interfaces)"
]
}
From ff5478a7f6348957f8823e2d08d8b9b9aa184448 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 15 May 2024 20:37:08 -0700
Subject: [PATCH 04/33] wip1
---
.../create_interface_with_relaxation_ase_emt.ipynb | 2 ++
1 file changed, 2 insertions(+)
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 5c435310..165a2d14 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -4,6 +4,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
+ "\n",
+ "\n",
"# Create an interface with ZSL and relax it using EMT potentials\n",
"\n",
"Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials using the Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl).\n",
From befc08d84827015fb9df457724809bb4ae52675c Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 15 May 2024 20:53:56 -0700
Subject: [PATCH 05/33] chore: apply changes from zsl nb
---
...te_interface_with_relaxation_ase_emt.ipynb | 91 ++++++++++---------
1 file changed, 49 insertions(+), 42 deletions(-)
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 165a2d14..bedf9e29 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -14,6 +14,7 @@
"\n",
"1. Drop the materials files into the \"uploads\" folder in the JupyterLab file browser\n",
"1. Set Input Parameters (e.g. `distance_z`, `max_area`, `miller_indices`) below or use the default values\n",
+ "3. Additionally, specify whether termination is selected using interactive prompt, or the via the variable in the code.\n",
"1. Click \"Run\" > \"Run All\" to run all cells\n",
"1. Wait for the run to complete (depending on the area, it can take 1-2 min or more). Scroll down to view cell results.\n",
"1. Review the strain plot and modify its parameters as needed\n",
@@ -34,14 +35,44 @@
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 1. Set Input Parameters\n",
+ "## 1. Install Packages\n",
+ "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` as directed in README."
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "import sys\n",
+ "\n",
+ "if sys.platform == \"emscripten\":\n",
+ " import micropip\n",
+ " await micropip.install('mat3ra-api-examples', deps=False)\n",
+ " from utils.jupyterlite import install_packages\n",
+ " await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
+ ],
+ "metadata": {
+ "collapsed": false,
+ "is_executing": true
+ },
+ "execution_count": null
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## 2. Set Interface Parameters\n",
"\n",
- "### 1.1. Select Substrate and Layer from Input Materials\n",
+ "### 2.1. Set Substrate and Layer Parameters \n",
"Imported `InterfaceSettings` is a class that specifies the parameters for the construction of the interface. The default values are assumed if properties are not set during the initialization.\n",
"Additionally, specify if the termination selection is done using interactive prompt, or the via selecting the termination index in the code."
- ]
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
@@ -51,12 +82,11 @@
"source": [
"from mat3ra.made.tools.build.interface import InterfaceSettings\n",
"\n",
- "interface_settings = InterfaceSettings()\n",
- "interface_settings.max_area = 50 # maximum area to consider when matching\n",
- "interface_settings.SubstrateParameters.miller_indices = (1, 1, 1) # the Miller indices of the interfacial plane of the substrate\n",
- "interface_settings.SubstrateParameters.thickness = 6 # substrate thickness in layers\n",
- "interface_settings.LayerParameters.miller_indices = (0, 0, 1) # the Miller indices of the interfacial plane of the layer\n",
- "interface_settings.LayerParameters.thickness = 1 # layer thickness in layers\n",
+ "interface_builder_settings = InterfaceSettings()\n",
+ "interface_builder_settings.SubstrateParameters.miller_indices = (1, 1, 1) # the Miller indices of the interfacial plane of the substrate\n",
+ "interface_builder_settings.SubstrateParameters.thickness = 6 # substrate thickness in layers\n",
+ "interface_builder_settings.LayerParameters.miller_indices = (0, 0, 1) # the Miller indices of the interfacial plane of the layer\n",
+ "interface_builder_settings.LayerParameters.thickness = 1 # layer thickness in layers\n",
"\n",
"IS_TERMINATION_SELECTION_INTERACTIVE = False # if True, the user can select the termination interactively\n",
"TERMINATION_INDEX = 0 # the default termination index that is used if no termination selected, ignored in interactive mode"
@@ -64,11 +94,13 @@
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "### 1.2. Set Algorithm Parameters for Strain Matching (Optional)\n",
+ "### 2.2. Set Strain Matching Algorithm Parameters (Optional)\n",
"The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
- ]
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
@@ -77,7 +109,8 @@
"outputs": [],
"source": [
"from mat3ra.made.tools.build.interface import ZSLParameters\n",
- "interface_settings.ZSLParameters = ZSLParameters(\n",
+ "interface_builder_settings.ZSLParameters = ZSLParameters(\n",
+ " max_area=50, # maximum area of the generated interfaces, in Angstroms^2\n",
" max_area_tol=0.09, # maximum tolerance on ratio of super-lattices to consider equal\n",
" max_length_tol=0.03, # maximum length tolerance for two vectors to be considered equal\n",
" max_angle_tol=0.01, # maximum angle tolerance for two sets of vectors to have equal angles\n",
@@ -87,7 +120,7 @@
{
"cell_type": "markdown",
"source": [
- "### 1.3. Set Relaxation Parameters"
+ "### 2.3. Set Relaxation Parameters"
],
"metadata": {
"collapsed": false
@@ -113,29 +146,6 @@
},
"execution_count": null
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## 2. Install Packages\n",
- "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` as directed in README."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "import sys\n",
- "\n",
- "if sys.platform == \"emscripten\":\n",
- " import micropip\n",
- " await micropip.install('mat3ra-api-examples', deps=False)\n",
- " from utils.jupyterlite import install_packages\n",
- " await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -185,7 +195,7 @@
"interface_builder = init_interface_builder(\n",
" substrate=materials[0],\n",
" layer=materials[1],\n",
- " settings=interface_settings\n",
+ " settings=interface_builder_settings,\n",
")"
]
},
@@ -231,9 +241,6 @@
"from mat3ra.made.tools.build import create_interfaces\n",
"\n",
"interface_data_holder = create_interfaces(\n",
- " settings=interface_settings,\n",
- " sort_by_strain_and_size=True,\n",
- " remove_duplicates=True,\n",
" interface_builder=interface_builder,\n",
" termination=selected_termination,\n",
")"
From 78ac0f02a8001df93832231f49da0e583ff51f02 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Thu, 16 May 2024 12:44:03 -0700
Subject: [PATCH 06/33] update: wip
---
...create_interface_with_min_strain_zsl.ipynb | 59 +++++++++++++++++--
utils/plot.py | 21 +++++++
2 files changed, 74 insertions(+), 6 deletions(-)
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 4509c883..54327ada 100644
--- a/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
+++ b/other/materials_designer/create_interface_with_min_strain_zsl.ipynb
@@ -54,9 +54,13 @@
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-05-16T19:38:52.309620Z",
+ "start_time": "2024-05-16T19:38:52.304575Z"
+ }
},
- "execution_count": null
+ "execution_count": 1
},
{
"cell_type": "markdown",
@@ -71,11 +75,28 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 2,
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2024-05-16T19:38:58.178616Z",
+ "start_time": "2024-05-16T19:38:52.440485Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "ImportError",
+ "evalue": "cannot import name 'InterfaceSettings' from 'mat3ra.made.tools.build.interface' (/Users/mat3ra/code/GREEN/api-examples/.venv/lib/python3.11/site-packages/mat3ra/made/tools/build/interface.py)",
+ "output_type": "error",
+ "traceback": [
+ "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
+ "\u001B[0;31mImportError\u001B[0m Traceback (most recent call last)",
+ "Cell \u001B[0;32mIn[2], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmade\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mtools\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbuild\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01minterface\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m InterfaceSettings\n\u001B[1;32m 3\u001B[0m \u001B[38;5;66;03m# Parameters can be set during the class initialization:\u001B[39;00m\n\u001B[1;32m 4\u001B[0m interface_builder_settings \u001B[38;5;241m=\u001B[39m InterfaceSettings(\n\u001B[1;32m 5\u001B[0m distance_z\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m3.0\u001B[39m, \u001B[38;5;66;03m# distance between substrate and layer, in Angstroms\u001B[39;00m\n\u001B[1;32m 6\u001B[0m use_conventional_cell\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m, \u001B[38;5;66;03m# if True, the surface plane is constructed using miller indices of the conventional cell\u001B[39;00m\n\u001B[1;32m 7\u001B[0m )\n",
+ "\u001B[0;31mImportError\u001B[0m: cannot import name 'InterfaceSettings' from 'mat3ra.made.tools.build.interface' (/Users/mat3ra/code/GREEN/api-examples/.venv/lib/python3.11/site-packages/mat3ra/made/tools/build/interface.py)"
+ ]
+ }
+ ],
"source": [
- "from mat3ra.made.tools.build.interface import InterfaceSettings\n",
+ "from mat3ra.made.tools.build.interface import InterfaceBuilderSettings\n",
"\n",
"# Parameters can be set during the class initialization:\n",
"interface_builder_settings = InterfaceSettings(\n",
@@ -176,6 +197,32 @@
},
"execution_count": null
},
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "from mat3ra.made.tools.build import create_interfaces\n",
+ "\n",
+ "default_interfaces = create_interfaces(materials[1], materials[1])"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "from utils.visualize import visualize_materials as visualize\n",
+ "default_interface = default_interfaces.get_interfaces_as_materials(0,(0,2))\n",
+ "visualize(default_interface, repetitions=[1, 1, 1], rotation=\"0x\")"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
{
"cell_type": "markdown",
"source": [
diff --git a/utils/plot.py b/utils/plot.py
index 2e484690..905f16a2 100644
--- a/utils/plot.py
+++ b/utils/plot.py
@@ -41,3 +41,24 @@ def plot_strain_vs_atoms(interface_data_holder: InterfaceDataHolder, settings: D
fig = go.Figure(data=data, layout=layout)
fig.show()
+
+
+import plotly.graph_objs as go
+from IPython.display import display
+from plotly.subplots import make_subplots
+
+
+def create_realtime_plot():
+ fig = make_subplots(rows=1, cols=1, specs=[[{"type": "scatter"}]])
+ scatter = go.Scatter(x=[], y=[], mode="lines+markers", name="Energy")
+ fig.add_trace(scatter)
+ fig.update_layout(title_text="Real-time Optimization Progress", xaxis_title="Step", yaxis_title="Energy (eV)")
+ f = go.FigureWidget(fig)
+ display(f)
+ return f
+
+
+def update_plot(f, steps, energies):
+ with f.batch_update():
+ f.data[0].x = steps
+ f.data[0].y = energies
From 6ad02236805c5c4f408ca1b022b578db2c766b25 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 3 Jun 2024 13:06:19 -0700
Subject: [PATCH 07/33] update: add message to wheel server
---
wheel_server.py | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/wheel_server.py b/wheel_server.py
index facf7113..9ee9aa00 100644
--- a/wheel_server.py
+++ b/wheel_server.py
@@ -1,17 +1,5 @@
-# This script is used to serve the static files from the 'dist' directory for installation of python wheels.
-# 1. Install deps with `pip install ".[dev]"`,
-# 2. Install build tool with `pip install build`
-# 3. Run `python -m build`
-# You should see something alongside:
-# ```Successfully built mat3ra_api_examples-dev9+g7c6e8d9.tar.gz and
-# mat3ra_api_examples-dev9+g7c6e8d9-py3-none-any.whl
-# ```
-# 4. Copy the wheel file name
-# 5. Run the server with `python wheel_server.py`
-# The server will be available at http://localhost:8080,
-# 6. use micropip in pyodide to install wheel from that URL `/`, i.e:
-# await micropip.install("http://localhost:8080/mat3ra_api_examples-dev9+g7c6e8d9-py3-none-any.whl", deps=False)
-
+import argparse
+import glob
import os
import socket
from http.server import HTTPServer, SimpleHTTPRequestHandler
@@ -30,10 +18,22 @@ def check_port(host, port):
return s.connect_ex((host, port)) == 0
+def inform_user(port):
+ whl_files = glob.glob("*.whl")
+ file = whl_files[0] if whl_files else None
+ url_str = f"http://localhost:{port}/{file}"
+ print("Copy URL to use in notebook or `config.yml`: ", url_str)
+
+
if __name__ == "__main__":
- port = 8080
+ parser = argparse.ArgumentParser(description="Python wheel server.")
+ parser.add_argument("--port", type=int, default=8080, help="Port to run the server on.")
+ parser.add_argument("--dir", type=str, default="./dist", help="Directory to serve.")
+ args = parser.parse_args()
+
+ port = args.port
bind_addr = "localhost"
- directory = "./dist" # make sure this is the correct relative path to your 'dist' directory
+ directory = args.dir # Change this line
os.chdir(directory) # Change the current working directory to the specified 'directory'
@@ -43,4 +43,5 @@ def check_port(host, port):
httpd = HTTPServer((bind_addr, port), CORSHTTPRequestHandler)
print(f"Serving at http://{bind_addr}:{port}")
+ inform_user(port)
httpd.serve_forever()
From 792ea0f705e059cf07fb723cdf40f8e0e57c986c Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 3 Jun 2024 13:34:32 -0700
Subject: [PATCH 08/33] chore: return the description
---
wheel_server.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/wheel_server.py b/wheel_server.py
index 9ee9aa00..d80d1d1a 100644
--- a/wheel_server.py
+++ b/wheel_server.py
@@ -1,3 +1,17 @@
+# This script is used to serve the static files from the 'dist' directory for installation of python wheels.
+# 1. Install deps with `pip install ".[dev]"`,
+# 2. Install build tool with `pip install build`
+# 3. Run `python -m build`
+# You should see something alongside:
+# ```Successfully built mat3ra_api_examples-dev9+g7c6e8d9.tar.gz and
+# mat3ra_api_examples-dev9+g7c6e8d9-py3-none-any.whl
+# ```
+# 4. Copy the wheel file name
+# 5. Run the server with `python wheel_server.py`
+# The server will be available at http://localhost:8080,
+# 6. use micropip in pyodide to install wheel from that URL `/`, i.e:
+# await micropip.install("http://localhost:8080/mat3ra_api_examples-dev9+g7c6e8d9-py3-none-any.whl", deps=False)
+
import argparse
import glob
import os
From 8014d9ceb4ea80faa02a215e1673e9b2f9068679 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 3 Jun 2024 13:56:33 -0700
Subject: [PATCH 09/33] chore: update interface creation parts
---
...te_interface_with_relaxation_ase_emt.ipynb | 398 +++++++++++-------
1 file changed, 248 insertions(+), 150 deletions(-)
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 bedf9e29..065422be 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -8,36 +8,62 @@
"\n",
"# Create an interface with ZSL and relax it using EMT potentials\n",
"\n",
- "Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials using the Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl).\n",
+ "Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials with minimal strain and then relax the resulting interface using the EMT potentials.\n",
"\n",
"Usage
\n",
"\n",
- "1. Drop the materials files into the \"uploads\" folder in the JupyterLab file browser\n",
- "1. Set Input Parameters (e.g. `distance_z`, `max_area`, `miller_indices`) below or use the default values\n",
- "3. Additionally, specify whether termination is selected using interactive prompt, or the via the variable in the code.\n",
- "1. Click \"Run\" > \"Run All\" to run all cells\n",
- "1. Wait for the run to complete (depending on the area, it can take 1-2 min or more). Scroll down to view cell results.\n",
- "1. Review the strain plot and modify its parameters as needed\n",
- "\n",
- "## Methodology\n",
- "\n",
- "The following happens in the script below:\n",
- "\n",
- "1. Create slabs for each input material. The materials data is passed in from and back to the web application according to this description (TBA).\n",
- " We assume that two input materials are either in bulk form (e.g. Ni crystal) or layered (e.g. graphene). \n",
- " \n",
- " We construct the interface along the Z-axis. The material corresponding to the bottom of the interface is referred to as the \"**substrate**\", and the top - as the \"**layer**\". \n",
- "\n",
- "2. Perform strain matching on the slabs to extract the supercell dimensions. The algorithm has a set of parameters, such as the maximum area considered, that can be configured by editing the cells below.\n",
- "\n",
- "3. When the strain matching is finished, the interface with the lowest strain (and the smallest number of atoms) is selected. We create the corresponding supercells and place them at a specified distance from each other (note no shift is performed currently).\n"
+ "1. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
+ "1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
+ "1. Set slab parameters for the substrate and film in cell 2.1. (or use default).\n",
+ "1. Set interface parameters in cell 3.1. (or use default).\n",
+ "1. Click “Run” > “Run All” to run all cells. \n",
+ "1. Wait for the run to complete (depending on the parameters can take a few min). \n",
+ "1. Scroll down to view results. \n",
+ "\n",
+ "## Summary\n",
+ "1. Prepare the Environment: Set up the notebook and install packages, preview the input materials\n",
+ "1. Create substrate and film slabs and select the terminations\n",
+ "1. Generate interfaces with strain matcher and plot strain vs number of atoms \n",
+ "1. Select the interface with the desired strain and visualize it\n",
+ "\n",
+ "## Notes\n",
+ "1. We perform strain matching on the slabs to extract the supercell dimensions. The algorithm has a set of parameters, such as the maximum area considered.\n",
+ "1. When the strain matching is finished, the interface with the lowest strain (and the smallest number of atoms) is selected. \n",
+ "1. ZSL strain matching is performed using Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl).\n",
+ "1. For more information, see [Introduction](Introduction.ipynb)\n",
+ "\n"
]
},
{
"cell_type": "markdown",
"source": [
- "## 1. Install Packages\n",
- "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` as directed in README."
+ "## 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
+ }
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "# Enable interactive selection of terminations via UI prompt\n",
+ "IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
+ "# Maximum area for the superlattice search algorithm\n",
+ "MAX_AREA = 50"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "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
@@ -64,11 +90,8 @@
{
"cell_type": "markdown",
"source": [
- "## 2. Set Interface Parameters\n",
- "\n",
- "### 2.1. Set Substrate and Layer Parameters \n",
- "Imported `InterfaceSettings` is a class that specifies the parameters for the construction of the interface. The default values are assumed if properties are not set during the initialization.\n",
- "Additionally, specify if the termination selection is done using interactive prompt, or the via selecting the termination index in the code."
+ "### 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": {
"collapsed": false
@@ -80,23 +103,20 @@
"metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import InterfaceSettings\n",
- "\n",
- "interface_builder_settings = InterfaceSettings()\n",
- "interface_builder_settings.SubstrateParameters.miller_indices = (1, 1, 1) # the Miller indices of the interfacial plane of the substrate\n",
- "interface_builder_settings.SubstrateParameters.thickness = 6 # substrate thickness in layers\n",
- "interface_builder_settings.LayerParameters.miller_indices = (0, 0, 1) # the Miller indices of the interfacial plane of the layer\n",
- "interface_builder_settings.LayerParameters.thickness = 1 # layer thickness in layers\n",
+ "from mat3ra.made.material import Material\n",
+ "from utils.jupyterlite import get_data\n",
"\n",
- "IS_TERMINATION_SELECTION_INTERACTIVE = False # if True, the user can select the termination interactively\n",
- "TERMINATION_INDEX = 0 # the default termination index that is used if no termination selected, ignored in interactive mode"
+ "# Get the list of input materials and load them into `materials_in` variable\n",
+ "get_data(\"materials_in\", globals())\n",
+ "materials = list(map(Material, globals()[\"materials_in\"]))\n",
+ "substrate = materials[0]\n",
+ "film = materials[1]"
]
},
{
"cell_type": "markdown",
"source": [
- "### 2.2. Set Strain Matching Algorithm Parameters (Optional)\n",
- "The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
+ "### 1.4. Preview Substrate and Film"
],
"metadata": {
"collapsed": false
@@ -108,19 +128,18 @@
"metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build.interface import ZSLParameters\n",
- "interface_builder_settings.ZSLParameters = ZSLParameters(\n",
- " max_area=50, # maximum area of the generated interfaces, in Angstroms^2\n",
- " max_area_tol=0.09, # maximum tolerance on ratio of super-lattices to consider equal\n",
- " max_length_tol=0.03, # maximum length tolerance for two vectors to be considered equal\n",
- " max_angle_tol=0.01, # maximum angle tolerance for two sets of vectors to have equal angles\n",
- ")"
+ "from utils.visualize import visualize_materials as visualize\n",
+ "visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
]
},
{
"cell_type": "markdown",
"source": [
- "### 2.3. Set Relaxation Parameters"
+ "## 2. Configure slabs and select termination pair\n",
+ "\n",
+ "### 2.1. 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",
+ "Define the substrate slab cell that will be used as a base for the interface and the film slab cell that will be placed on top of the substrate slab."
],
"metadata": {
"collapsed": false
@@ -130,148 +149,207 @@
"cell_type": "code",
"outputs": [],
"source": [
- "RELAXATION_PARAMETERS = {\n",
- " \"FMAX\": 0.018,\n",
- "}\n",
- "\n",
- "from mat3ra.made.tools.modify import RelaxationSettings, CalculatorEnum, OptimizerEnum\n",
- "relaxation_settings = RelaxationSettings()\n",
- "\n",
- "relaxation_settings.optimizer = OptimizerEnum.BFGS\n",
- "relaxation_settings.calculator = CalculatorEnum.EMT\n",
- "relaxation_settings.fmax = 0.05"
+ "from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n",
+ "\n",
+ "film_slab_configuration = SlabConfiguration(\n",
+ " bulk=film,\n",
+ " miller_indices=(0, 0, 1),\n",
+ " thickness=1, # in atomic layers\n",
+ " vacuum=0, # in atomic layers\n",
+ " xy_supercell_matrix=[[1, 0], [0, 1]],\n",
+ " use_orthogonal_z=True\n",
+ ")\n",
+ "\n",
+ "substrate_slab_configuration = SlabConfiguration(\n",
+ " bulk=substrate,\n",
+ " miller_indices=(1,1,1),\n",
+ " thickness=3, # in atomic layers\n",
+ " vacuum=3, # in atomic layers\n",
+ " xy_supercell_matrix=[[1, 0], [0, 1]],\n",
+ " use_orthogonal_z=True\n",
+ ")"
],
"metadata": {
"collapsed": false
- },
- "execution_count": null
+ }
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 3. Load input Materials\n"
- ]
+ "### 2.2. Get possible terminations for the slabs"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
+ "outputs": [],
+ "source": [
+ "film_slab_terminations = get_terminations(film_slab_configuration)\n",
+ "substrate_slab_terminations = get_terminations(substrate_slab_configuration)"
+ ],
"metadata": {
- "tags": [],
- "trusted": true
- },
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### 2.3. Visualize slabs for all possible terminations"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
"outputs": [],
"source": [
- "from mat3ra.made.material import Material\n",
- "from utils.jupyterlite import get_data\n",
- "\n",
- "from utils.visualize import visualize_materials as visualize\n",
+ "film_slabs = [create_slab(film_slab_configuration, termination) for termination in film_slab_terminations]\n",
+ "substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in substrate_slab_terminations]\n",
"\n",
- "# Get the list of input materials and load them into `materials_in` variable\n",
- "get_data(\"materials_in\", globals())\n",
- "materials = list(map(Material, globals()[\"materials_in\"]))\n",
- "visualize(materials, repetitions=[1, 1, 1], rotation=\"0x\")"
- ]
+ "visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in film_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\")\n",
+ "visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") "
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 4. Create interfaces\n",
- "\n",
- "### 4.1. Initialize the interface builder\n",
- "\n",
- "Initialize the interface builder with the materials and interface settings."
- ]
+ "### 2.4. Print terminations for the interface"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build import init_interface_builder\n",
+ "from itertools import product\n",
"\n",
- "interface_builder = init_interface_builder(\n",
- " substrate=materials[0],\n",
- " layer=materials[1],\n",
- " settings=interface_builder_settings,\n",
- ")"
- ]
+ "termination_pairs = list(product(film_slab_terminations, substrate_slab_terminations)) \n",
+ "print(\"Termination Pairs (Film, Substrate)\")\n",
+ "for idx, termination_pair in enumerate(termination_pairs):\n",
+ " print(f\" {idx}: {termination_pair}\")"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "### 4.2. Select the termination\n",
- "Possible terminations for the interface are found by the interface builder. The user can select the termination interactively or use the default one."
- ]
+ "### 2.5. Select termination pair for the interface"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
"from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n",
- "terminations = interface_builder.terminations\n",
"\n",
- "if IS_TERMINATION_SELECTION_INTERACTIVE:\n",
+ "# Set the termination pair indices\n",
+ "TERMINATION_PAIR_INDEX = 0\n",
+ "\n",
+ "termination_pair = termination_pairs[TERMINATION_PAIR_INDEX]\n",
+ "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n",
" if sys.platform == \"emscripten\":\n",
- " selected_termination = await ui_prompt_select_array_element_by_index_pyodide(terminations, element_name=\"termination\")\n",
+ " termination_pair = await ui_prompt_select_array_element_by_index_pyodide(termination_pairs, element_name=\"film/substrate termination pair\")\n",
" else:\n",
- " selected_termination = ui_prompt_select_array_element_by_index(terminations, element_name=\"termination\")\n",
- "else: \n",
- " selected_termination = terminations[TERMINATION_INDEX]"
- ]
+ " termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"film/substrate termination pair\")"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "### 4.3. Create interfaces for the selected termination"
- ]
+ "## 3. Create interfaces\n",
+ "\n",
+ "### 3.1. Initialize the Interface Configuration"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.build import create_interfaces\n",
+ "from mat3ra.made.tools.build.interface import InterfaceConfiguration\n",
"\n",
- "interface_data_holder = create_interfaces(\n",
- " interface_builder=interface_builder,\n",
- " termination=selected_termination,\n",
+ "film_termination, substrate_termination = termination_pair\n",
+ "interface_configuration = InterfaceConfiguration(\n",
+ " film_configuration=film_slab_configuration,\n",
+ " substrate_configuration=substrate_slab_configuration,\n",
+ " film_termination=film_termination,\n",
+ " substrate_termination=substrate_termination,\n",
+ " distance=3.0 # in Angstrom\n",
")"
- ]
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "### 4.3. Print out interface with the lowest strain for selected termination\n"
- ]
+ "### 3.2. Set Strain Matching Algorithm Parameters (Optional)\n",
+ "The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "print(f\"Interface with lowest strain for termination {selected_termination} (index 0):\")\n",
- "interfaces = interface_data_holder.get_interfaces_for_termination(selected_termination)\n",
- "first_interface = interfaces[0]\n",
- "print(f\" strain: {first_interface.get_mean_abs_strain() * 100:.3f}%\")\n",
- "print(\" number of atoms:\", first_interface.num_sites)"
- ]
+ "from mat3ra.made.tools.build.interface import ZSLStrainMatchingParameters\n",
+ "zsl_strain_matching_parameters = ZSLStrainMatchingParameters(\n",
+ " max_area=MAX_AREA\n",
+ ")"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "markdown",
"source": [
- "## 5. Plot the results\n",
+ "### 3.3. Generate interfaces with strain matcher\n",
+ "Interfaces are sorted by size and strain."
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n",
"\n",
- "Plot the number of atoms vs strain. Adjust the parameters as needed."
+ "matched_interfaces_builder = ZSLStrainMatchingInterfaceBuilder(build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(strain_matching_parameters=zsl_strain_matching_parameters))\n",
+ "\n",
+ "interfaces_sorted_by_size_and_strain= matched_interfaces_builder.get_materials(configuration=interface_configuration)"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### 3.4. Plot interfaces by size and strain\n"
],
"metadata": {
"collapsed": false
@@ -289,44 +367,41 @@
" \"Y_SCALE\": \"log\", # or linear\n",
"}\n",
"\n",
- "plot_strain_vs_atoms(interface_data_holder, PLOT_SETTINGS)\n",
- "\n",
- "print(\"Terminations: \\n\", interface_data_holder.terminations)"
+ "plot_strain_vs_atoms(interfaces_sorted_by_size_and_strain, PLOT_SETTINGS)"
],
"metadata": {
"collapsed": false
},
- "execution_count": null
+ "execution_count": 0
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 6. Select the interface to relax\n",
- "\n",
- "### 6.1. Select the interface with the desired termination and strain\n",
+ "### 3.5. Select the interface to relax\n",
"\n",
- "\n",
- "Select the index for termination first, and for it - the index in the list of corresponding interfaces sorted by strain (index 0 has minimum strain)."
- ]
+ "Select the index for the interface with the lowest strain and the smallest number of atoms."
+ ],
+ "metadata": {
+ "collapsed": false
+ }
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "# Could be either the termination as tuple, e.g. `('Ni_P6/mmm_1', 'C_C2/m_2')` or its index: `0`\n",
- "termination_or_its_index = selected_termination\n",
"# select the first interface with the lowest strain and the smallest number of atoms\n",
- "interfaces_slice_range_or_index = 0\n",
- "interface = interface_data_holder.get_interfaces_as_materials(termination_or_its_index, interfaces_slice_range_or_index)[0]"
- ]
+ "interface_index = 0\n",
+ "selected_interfaces = interfaces_sorted_by_size_and_strain[interface_index]"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": 0
},
{
"cell_type": "markdown",
"source": [
- "### 6.2. Visualize the selected interface(s)"
+ "## 4. Preview the selected material"
],
"metadata": {
"collapsed": false
@@ -336,26 +411,49 @@
"cell_type": "code",
"outputs": [],
"source": [
- "visualize(interface, repetitions=[1, 1, 1], rotation=\"0x\")"
+ "visualize(selected_interfaces, repetitions=[3, 3, 1])\n",
+ "visualize(selected_interfaces, repetitions=[3, 3, 1], rotation=\"-90x\")"
],
"metadata": {
"collapsed": false
},
- "execution_count": null
+ "execution_count": 0
},
{
"cell_type": "markdown",
- "source": [],
+ "source": [
+ "## 5. Perform Relaxation\n",
+ "### 5.1. Set Relaxation Parameters"
+ ],
"metadata": {
"collapsed": false
}
},
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "RELAXATION_PARAMETERS = {\n",
+ " \"FMAX\": 0.018,\n",
+ "}\n",
+ "\n",
+ "from mat3ra.made.tools.modify import RelaxationSettings, CalculatorEnum, OptimizerEnum\n",
+ "relaxation_settings = RelaxationSettings()\n",
+ "\n",
+ "relaxation_settings.optimizer = OptimizerEnum.BFGS\n",
+ "relaxation_settings.calculator = CalculatorEnum.EMT\n",
+ "relaxation_settings.fmax = 0.05"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## 7. Apply relaxation\n",
- "### 7.1. Apply relaxation to the selected interface"
+ "### 5.2. Apply relaxation to the selected interface"
]
},
{
From b490746b9b7abd36c5882c9b1f584a01e35f5dce Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 3 Jun 2024 17:04:21 -0700
Subject: [PATCH 10/33] update: revert using ase directly
---
...te_interface_with_relaxation_ase_emt.ipynb | 1463 +++++++++++++++--
1 file changed, 1336 insertions(+), 127 deletions(-)
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 065422be..795dae62 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -25,6 +25,8 @@
"1. Create substrate and film slabs and select the terminations\n",
"1. Generate interfaces with strain matcher and plot strain vs number of atoms \n",
"1. Select the interface with the desired strain and visualize it\n",
+ "1. Perform relaxation of the interface with set parameters\n",
+ "1. View the structure before and after relaxation\n",
"\n",
"## Notes\n",
"1. We perform strain matching on the slabs to extract the supercell dimensions. The algorithm has a set of parameters, such as the maximum area considered.\n",
@@ -56,8 +58,13 @@
"MAX_AREA = 50"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.603761Z",
+ "start_time": "2024-06-03T23:54:45.601058Z"
+ }
+ },
+ "execution_count": 18
},
{
"cell_type": "markdown",
@@ -83,9 +90,12 @@
],
"metadata": {
"collapsed": false,
- "is_executing": true
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.725746Z",
+ "start_time": "2024-06-03T23:54:45.722075Z"
+ }
},
- "execution_count": null
+ "execution_count": 19
},
{
"cell_type": "markdown",
@@ -99,9 +109,35 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 20,
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.751100Z",
+ "start_time": "2024-06-03T23:54:45.743383Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Data from 0-Ni has been read successfully.\n",
+ "Data from 1-Graphene has been read successfully.\n",
+ "Data from 2-WS2 has been read successfully.\n",
+ "Data from 3-BN has been read successfully.\n",
+ "Data from 4-Te2Mo has been read successfully.\n",
+ "Data from 5-HfO2 has been read successfully.\n",
+ "Data from C2(001)-Ni4(111) Interface, Strain (mean_abs_strain=0.001%) has been read successfully.\n",
+ "Data from C2(001)-Ni4(111) Interface has been read successfully.\n",
+ "Data from C2(001)-Ni4(111), Interface, Strain 0.001% has been read successfully.\n",
+ "Data from C2(001)-Ni4(111), Interface, Strain 0.105% has been read successfully.\n",
+ "Data from C2(001)-Ni4(111), Interface has been read successfully.\n",
+ "Data from Ni3 C2 has been read successfully.\n",
+ "Data from Si4 has been read successfully.\n",
+ "Data from Si8 has been read successfully.\n"
+ ]
+ }
+ ],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
@@ -124,9 +160,27 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 21,
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.898612Z",
+ "start_time": "2024-06-03T23:54:45.803205Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni - Material - rotation: 0x', layout=Layout(align_self='center'…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "e1606a47b9d54a148529ba164fe45493"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
@@ -170,8 +224,13 @@
")"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.922305Z",
+ "start_time": "2024-06-03T23:54:45.901983Z"
+ }
+ },
+ "execution_count": 22
},
{
"cell_type": "markdown",
@@ -190,8 +249,13 @@
"substrate_slab_terminations = get_terminations(substrate_slab_configuration)"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:45.956577Z",
+ "start_time": "2024-06-03T23:54:45.923865Z"
+ }
+ },
+ "execution_count": 23
},
{
"cell_type": "markdown",
@@ -204,7 +268,32 @@
},
{
"cell_type": "code",
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='C2 - C_P6/mmm_2 - rotation: -90x', layout=Layout(align_self='cen…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "b1bc9c80e9ef4bf59c04099ea5ceeac0"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3 - Ni_P6/mmm_1 - rotation: -90x', layout=Layout(align_self='c…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "2c1ddacb7b10421bb94e961a115954b2"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"film_slabs = [create_slab(film_slab_configuration, termination) for termination in film_slab_terminations]\n",
"substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in substrate_slab_terminations]\n",
@@ -213,8 +302,13 @@
"visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") "
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:46.133922Z",
+ "start_time": "2024-06-03T23:54:45.960447Z"
+ }
+ },
+ "execution_count": 24
},
{
"cell_type": "markdown",
@@ -227,7 +321,16 @@
},
{
"cell_type": "code",
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Termination Pairs (Film, Substrate)\n",
+ " 0: (C_P6/mmm_2, Ni_P6/mmm_1)\n"
+ ]
+ }
+ ],
"source": [
"from itertools import product\n",
"\n",
@@ -237,8 +340,13 @@
" print(f\" {idx}: {termination_pair}\")"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:46.140499Z",
+ "start_time": "2024-06-03T23:54:46.135598Z"
+ }
+ },
+ "execution_count": 25
},
{
"cell_type": "markdown",
@@ -266,8 +374,13 @@
" termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"film/substrate termination pair\")"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:46.150389Z",
+ "start_time": "2024-06-03T23:54:46.142777Z"
+ }
+ },
+ "execution_count": 26
},
{
"cell_type": "markdown",
@@ -296,8 +409,13 @@
")"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:46.155410Z",
+ "start_time": "2024-06-03T23:54:46.152107Z"
+ }
+ },
+ "execution_count": 27
},
{
"cell_type": "markdown",
@@ -319,8 +437,13 @@
")"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:46.160966Z",
+ "start_time": "2024-06-03T23:54:46.157479Z"
+ }
+ },
+ "execution_count": 28
},
{
"cell_type": "markdown",
@@ -334,7 +457,15 @@
},
{
"cell_type": "code",
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Interface will be built with terminations: (C_P6/mmm_2, Ni_R-3m_1)\n"
+ ]
+ }
+ ],
"source": [
"from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n",
"\n",
@@ -343,8 +474,13 @@
"interfaces_sorted_by_size_and_strain= matched_interfaces_builder.get_materials(configuration=interface_configuration)"
],
"metadata": {
- "collapsed": false
- }
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:47.809670Z",
+ "start_time": "2024-06-03T23:54:46.162910Z"
+ }
+ },
+ "execution_count": 29
},
{
"cell_type": "markdown",
@@ -357,7 +493,1003 @@
},
{
"cell_type": "code",
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "data": [
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 0",
+ "text": [
+ "Index: 0
Strain: 0.11%
Atoms: 5"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 5
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 1",
+ "text": [
+ "Index: 1
Strain: 0.11%
Atoms: 10"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 10
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 2",
+ "text": [
+ "Index: 2
Strain: 0.11%
Atoms: 15"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 15
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 3",
+ "text": [
+ "Index: 3
Strain: 0.11%
Atoms: 20"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 20
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 4",
+ "text": [
+ "Index: 4
Strain: 0.11%
Atoms: 25"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 25
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 5",
+ "text": [
+ "Index: 5
Strain: 0.11%
Atoms: 30"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 30
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 6",
+ "text": [
+ "Index: 6
Strain: 0.11%
Atoms: 35"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 35
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 7",
+ "text": [
+ "Index: 7
Strain: 0.11%
Atoms: 40"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 40
+ ],
+ "type": "scatter"
+ },
+ {
+ "hoverinfo": "text",
+ "mode": "markers",
+ "name": "Index: 8",
+ "text": [
+ "Index: 8
Strain: 0.11%
Atoms: 45"
+ ],
+ "x": [
+ 0.10500000000000001
+ ],
+ "y": [
+ 45
+ ],
+ "type": "scatter"
+ }
+ ],
+ "layout": {
+ "height": 600,
+ "hovermode": "closest",
+ "legend": {
+ "title": {
+ "text": "Interfaces Indices"
+ }
+ },
+ "xaxis": {
+ "title": {
+ "text": "Strain (%)"
+ },
+ "type": "log"
+ },
+ "yaxis": {
+ "title": {
+ "text": "Number of atoms"
+ },
+ "type": "log"
+ },
+ "template": {
+ "data": {
+ "histogram2dcontour": [
+ {
+ "type": "histogram2dcontour",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "choropleth": [
+ {
+ "type": "choropleth",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ ],
+ "histogram2d": [
+ {
+ "type": "histogram2d",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "heatmap": [
+ {
+ "type": "heatmap",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "heatmapgl": [
+ {
+ "type": "heatmapgl",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "contourcarpet": [
+ {
+ "type": "contourcarpet",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ ],
+ "contour": [
+ {
+ "type": "contour",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "surface": [
+ {
+ "type": "surface",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ },
+ "colorscale": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ]
+ }
+ ],
+ "mesh3d": [
+ {
+ "type": "mesh3d",
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ ],
+ "scatter": [
+ {
+ "marker": {
+ "line": {
+ "color": "#283442"
+ }
+ },
+ "type": "scatter"
+ }
+ ],
+ "parcoords": [
+ {
+ "type": "parcoords",
+ "line": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "scatterpolargl": [
+ {
+ "type": "scatterpolargl",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "bar": [
+ {
+ "error_x": {
+ "color": "#f2f5fa"
+ },
+ "error_y": {
+ "color": "#f2f5fa"
+ },
+ "marker": {
+ "line": {
+ "color": "rgb(17,17,17)",
+ "width": 0.5
+ },
+ "pattern": {
+ "fillmode": "overlay",
+ "size": 10,
+ "solidity": 0.2
+ }
+ },
+ "type": "bar"
+ }
+ ],
+ "scattergeo": [
+ {
+ "type": "scattergeo",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "scatterpolar": [
+ {
+ "type": "scatterpolar",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "histogram": [
+ {
+ "marker": {
+ "pattern": {
+ "fillmode": "overlay",
+ "size": 10,
+ "solidity": 0.2
+ }
+ },
+ "type": "histogram"
+ }
+ ],
+ "scattergl": [
+ {
+ "marker": {
+ "line": {
+ "color": "#283442"
+ }
+ },
+ "type": "scattergl"
+ }
+ ],
+ "scatter3d": [
+ {
+ "type": "scatter3d",
+ "line": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ },
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "scattermapbox": [
+ {
+ "type": "scattermapbox",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "scatterternary": [
+ {
+ "type": "scatterternary",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "scattercarpet": [
+ {
+ "type": "scattercarpet",
+ "marker": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ }
+ }
+ ],
+ "carpet": [
+ {
+ "aaxis": {
+ "endlinecolor": "#A2B1C6",
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "minorgridcolor": "#506784",
+ "startlinecolor": "#A2B1C6"
+ },
+ "baxis": {
+ "endlinecolor": "#A2B1C6",
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "minorgridcolor": "#506784",
+ "startlinecolor": "#A2B1C6"
+ },
+ "type": "carpet"
+ }
+ ],
+ "table": [
+ {
+ "cells": {
+ "fill": {
+ "color": "#506784"
+ },
+ "line": {
+ "color": "rgb(17,17,17)"
+ }
+ },
+ "header": {
+ "fill": {
+ "color": "#2a3f5f"
+ },
+ "line": {
+ "color": "rgb(17,17,17)"
+ }
+ },
+ "type": "table"
+ }
+ ],
+ "barpolar": [
+ {
+ "marker": {
+ "line": {
+ "color": "rgb(17,17,17)",
+ "width": 0.5
+ },
+ "pattern": {
+ "fillmode": "overlay",
+ "size": 10,
+ "solidity": 0.2
+ }
+ },
+ "type": "barpolar"
+ }
+ ],
+ "pie": [
+ {
+ "automargin": true,
+ "type": "pie"
+ }
+ ]
+ },
+ "layout": {
+ "autotypenumbers": "strict",
+ "colorway": [
+ "#636efa",
+ "#EF553B",
+ "#00cc96",
+ "#ab63fa",
+ "#FFA15A",
+ "#19d3f3",
+ "#FF6692",
+ "#B6E880",
+ "#FF97FF",
+ "#FECB52"
+ ],
+ "font": {
+ "color": "#f2f5fa"
+ },
+ "hovermode": "closest",
+ "hoverlabel": {
+ "align": "left"
+ },
+ "paper_bgcolor": "rgb(17,17,17)",
+ "plot_bgcolor": "rgb(17,17,17)",
+ "polar": {
+ "bgcolor": "rgb(17,17,17)",
+ "angularaxis": {
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "ticks": ""
+ },
+ "radialaxis": {
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "ticks": ""
+ }
+ },
+ "ternary": {
+ "bgcolor": "rgb(17,17,17)",
+ "aaxis": {
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "ticks": ""
+ },
+ "baxis": {
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "ticks": ""
+ },
+ "caxis": {
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "ticks": ""
+ }
+ },
+ "coloraxis": {
+ "colorbar": {
+ "outlinewidth": 0,
+ "ticks": ""
+ }
+ },
+ "colorscale": {
+ "sequential": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ],
+ "sequentialminus": [
+ [
+ 0.0,
+ "#0d0887"
+ ],
+ [
+ 0.1111111111111111,
+ "#46039f"
+ ],
+ [
+ 0.2222222222222222,
+ "#7201a8"
+ ],
+ [
+ 0.3333333333333333,
+ "#9c179e"
+ ],
+ [
+ 0.4444444444444444,
+ "#bd3786"
+ ],
+ [
+ 0.5555555555555556,
+ "#d8576b"
+ ],
+ [
+ 0.6666666666666666,
+ "#ed7953"
+ ],
+ [
+ 0.7777777777777778,
+ "#fb9f3a"
+ ],
+ [
+ 0.8888888888888888,
+ "#fdca26"
+ ],
+ [
+ 1.0,
+ "#f0f921"
+ ]
+ ],
+ "diverging": [
+ [
+ 0,
+ "#8e0152"
+ ],
+ [
+ 0.1,
+ "#c51b7d"
+ ],
+ [
+ 0.2,
+ "#de77ae"
+ ],
+ [
+ 0.3,
+ "#f1b6da"
+ ],
+ [
+ 0.4,
+ "#fde0ef"
+ ],
+ [
+ 0.5,
+ "#f7f7f7"
+ ],
+ [
+ 0.6,
+ "#e6f5d0"
+ ],
+ [
+ 0.7,
+ "#b8e186"
+ ],
+ [
+ 0.8,
+ "#7fbc41"
+ ],
+ [
+ 0.9,
+ "#4d9221"
+ ],
+ [
+ 1,
+ "#276419"
+ ]
+ ]
+ },
+ "xaxis": {
+ "gridcolor": "#283442",
+ "linecolor": "#506784",
+ "ticks": "",
+ "title": {
+ "standoff": 15
+ },
+ "zerolinecolor": "#283442",
+ "automargin": true,
+ "zerolinewidth": 2
+ },
+ "yaxis": {
+ "gridcolor": "#283442",
+ "linecolor": "#506784",
+ "ticks": "",
+ "title": {
+ "standoff": 15
+ },
+ "zerolinecolor": "#283442",
+ "automargin": true,
+ "zerolinewidth": 2
+ },
+ "scene": {
+ "xaxis": {
+ "backgroundcolor": "rgb(17,17,17)",
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "showbackground": true,
+ "ticks": "",
+ "zerolinecolor": "#C8D4E3",
+ "gridwidth": 2
+ },
+ "yaxis": {
+ "backgroundcolor": "rgb(17,17,17)",
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "showbackground": true,
+ "ticks": "",
+ "zerolinecolor": "#C8D4E3",
+ "gridwidth": 2
+ },
+ "zaxis": {
+ "backgroundcolor": "rgb(17,17,17)",
+ "gridcolor": "#506784",
+ "linecolor": "#506784",
+ "showbackground": true,
+ "ticks": "",
+ "zerolinecolor": "#C8D4E3",
+ "gridwidth": 2
+ }
+ },
+ "shapedefaults": {
+ "line": {
+ "color": "#f2f5fa"
+ }
+ },
+ "annotationdefaults": {
+ "arrowcolor": "#f2f5fa",
+ "arrowhead": 0,
+ "arrowwidth": 1
+ },
+ "geo": {
+ "bgcolor": "rgb(17,17,17)",
+ "landcolor": "rgb(17,17,17)",
+ "subunitcolor": "#506784",
+ "showland": true,
+ "showlakes": true,
+ "lakecolor": "rgb(17,17,17)"
+ },
+ "title": {
+ "x": 0.05
+ },
+ "updatemenudefaults": {
+ "bgcolor": "#506784",
+ "borderwidth": 0
+ },
+ "sliderdefaults": {
+ "bgcolor": "#C8D4E3",
+ "borderwidth": 1,
+ "bordercolor": "rgb(17,17,17)",
+ "tickwidth": 0
+ },
+ "mapbox": {
+ "style": "dark"
+ }
+ }
+ }
+ },
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ }
+ },
+ "text/html": ""
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"from utils.plot import plot_strain_vs_atoms\n",
"\n",
@@ -370,9 +1502,13 @@
"plot_strain_vs_atoms(interfaces_sorted_by_size_and_strain, PLOT_SETTINGS)"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:47.822854Z",
+ "start_time": "2024-06-03T23:54:47.812562Z"
+ }
},
- "execution_count": 0
+ "execution_count": 30
},
{
"cell_type": "markdown",
@@ -391,12 +1527,16 @@
"source": [
"# select the first interface with the lowest strain and the smallest number of atoms\n",
"interface_index = 0\n",
- "selected_interfaces = interfaces_sorted_by_size_and_strain[interface_index]"
+ "interface = interfaces_sorted_by_size_and_strain[interface_index]"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:47.827131Z",
+ "start_time": "2024-06-03T23:54:47.824223Z"
+ }
},
- "execution_count": 0
+ "execution_count": 31
},
{
"cell_type": "markdown",
@@ -409,15 +1549,44 @@
},
{
"cell_type": "code",
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - Material - rotation: 0x,0y,0z', layout=Layout(align_self…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "24a91ce9943e4bcea56759a70dc99ef6"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - Material - rotation: -90x', layout=Layout(align_self='ce…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "6fbd97b61c4543a19d297dfca436b958"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
- "visualize(selected_interfaces, repetitions=[3, 3, 1])\n",
- "visualize(selected_interfaces, repetitions=[3, 3, 1], rotation=\"-90x\")"
+ "visualize(interface, repetitions=[3, 3, 1])\n",
+ "visualize(interface, repetitions=[3, 3, 1], rotation=\"-90x\")"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-03T23:54:48.022208Z",
+ "start_time": "2024-06-03T23:54:47.828501Z"
+ }
},
- "execution_count": 0
+ "execution_count": 32
},
{
"cell_type": "markdown",
@@ -445,9 +1614,13 @@
"relaxation_settings.fmax = 0.05"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-04T00:02:59.824691Z",
+ "start_time": "2024-06-04T00:02:59.820789Z"
+ }
},
- "execution_count": null
+ "execution_count": 44
},
{
"cell_type": "markdown",
@@ -458,58 +1631,89 @@
},
{
"cell_type": "code",
- "outputs": [],
- "source": [
- "from utils.plot import create_realtime_plot, update_plot\n",
- "\n",
- "from mat3ra.made.tools.modify import relax_atoms\n",
- "from mat3ra.made.tools.convert import to_ase\n",
- "\n",
- "final_interface = relax_atoms(Material(interface), relaxation_settings)\n",
- "\n",
- "f = create_realtime_plot()\n",
- "steps = []\n",
- "energies = []\n",
- "update_plot(f, steps, energies)\n",
- "\n",
- "visualize(final_interface, repetitions=[1, 1, 1], rotation=\"0x\")"
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "a1760512e6db4817a6faf46685a3f3f6"
+ },
+ "text/plain": "FigureWidget({\n 'data': [{'mode': 'lines+markers',\n 'name': 'Energy',\n 'type': 'scatter',\n 'uid': 'c495c2f2-3f0b-4b7d-94a2-f63cc6b25c58',\n 'x': [],\n 'y': []}],\n 'layout': {'template': '...',\n 'title': {'text': 'Real-time Optimization Progress'},\n 'xaxis': {'anchor': 'y', 'domain': [0.0, 1.0], 'title': {'text': 'Step'}},\n 'yaxis': {'anchor': 'x', 'domain': [0.0, 1.0], 'title': {'text': 'Energy (eV)'}}}\n})"
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Step Time Energy fmax\n",
+ "BFGS: 0 17:03:00 1.445681 0.1415\n",
+ "Step: 0, Energy: 1.4457 eV\n",
+ "BFGS: 1 17:03:00 1.445033 0.1302\n",
+ "Step: 1, Energy: 1.4450 eV\n",
+ "BFGS: 2 17:03:00 1.432713 0.4527\n",
+ "Step: 2, Energy: 1.4327 eV\n",
+ "BFGS: 3 17:03:00 1.423774 0.6641\n",
+ "Step: 3, Energy: 1.4238 eV\n",
+ "BFGS: 4 17:03:00 1.359592 1.2474\n",
+ "Step: 4, Energy: 1.3596 eV\n",
+ "BFGS: 5 17:03:00 1.226410 1.4583\n",
+ "Step: 5, Energy: 1.2264 eV\n",
+ "BFGS: 6 17:03:00 1.502803 3.4047\n",
+ "Step: 6, Energy: 1.5028 eV\n",
+ "BFGS: 7 17:03:00 1.195866 1.3429\n",
+ "Step: 7, Energy: 1.1959 eV\n",
+ "BFGS: 8 17:03:00 1.173834 1.2495\n",
+ "Step: 8, Energy: 1.1738 eV\n",
+ "BFGS: 9 17:03:00 1.051097 1.4582\n",
+ "Step: 9, Energy: 1.0511 eV\n",
+ "BFGS: 10 17:03:00 0.997766 0.8415\n",
+ "Step: 10, Energy: 0.9978 eV\n",
+ "BFGS: 11 17:03:00 0.949498 0.7572\n",
+ "Step: 11, Energy: 0.9495 eV\n",
+ "BFGS: 12 17:03:00 0.932681 0.7517\n",
+ "Step: 12, Energy: 0.9327 eV\n",
+ "BFGS: 13 17:03:00 0.861661 0.7905\n",
+ "Step: 13, Energy: 0.8617 eV\n",
+ "BFGS: 14 17:03:00 0.818040 0.5732\n",
+ "Step: 14, Energy: 0.8180 eV\n",
+ "BFGS: 15 17:03:00 0.808065 0.2067\n",
+ "Step: 15, Energy: 0.8081 eV\n",
+ "BFGS: 16 17:03:00 0.806009 0.1834\n",
+ "Step: 16, Energy: 0.8060 eV\n",
+ "BFGS: 17 17:03:00 0.804989 0.1818\n",
+ "Step: 17, Energy: 0.8050 eV\n",
+ "BFGS: 18 17:03:00 0.799836 0.1027\n",
+ "Step: 18, Energy: 0.7998 eV\n",
+ "BFGS: 19 17:03:00 0.799267 0.0464\n",
+ "Step: 19, Energy: 0.7993 eV\n",
+ "BFGS: 20 17:03:00 0.799174 0.0035\n",
+ "Step: 20, Energy: 0.7992 eV\n",
+ "The final energy is 0.799 eV.\n"
+ ]
+ }
],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
"source": [
"import plotly.graph_objs as go\n",
"from IPython.display import display\n",
"from plotly.subplots import make_subplots\n",
- "from src.utils import ase_to_poscar, pymatgen_to_ase\n",
+ "from mat3ra.made.tools.convert import to_ase, from_ase\n",
"from ase.optimize import BFGS\n",
"from ase.calculators.emt import EMT\n",
"\n",
"\n",
"# Set up the calculator \n",
"calculator = EMT()\n",
- "print(calculator)\n",
"\n",
"# Set up the interface for relaxation\n",
"ase_interface = to_ase(interface)\n",
- "print(ase_interface)\n",
"ase_interface.set_calculator(calculator)\n",
- "print(ase_interface)\n",
+ "\n",
"dyn = BFGS(ase_interface)\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
+ "\n",
+ "\n",
"# Initialize empty lists to store steps and energies\n",
"steps = []\n",
"energies = []\n",
@@ -547,22 +1751,25 @@
"dyn.run(fmax=RELAXATION_PARAMETERS[\"FMAX\"])\n",
"\n",
"# Extract results\n",
- "ase_original_interface = pymatgen_to_ase(interface)\n",
+ "ase_original_interface = to_ase(interface)\n",
"ase_original_interface.set_calculator(calculator)\n",
"ase_final_interface = ase_interface\n",
+ "final_interface = from_ase(ase_final_interface)\n",
"\n",
"original_energy = ase_original_interface.get_total_energy()\n",
"relaxed_energy = ase_interface.get_total_energy()\n",
"\n",
"# Print out the final relaxed structure and energy\n",
- "print('Original structure:\\n', ase_to_poscar(ase_original_interface))\n",
- "print('\\nRelaxed structure:\\n', ase_to_poscar(ase_final_interface))\n",
"print(f\"The final energy is {float(relaxed_energy):.3f} eV.\")"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-04T00:03:00.854695Z",
+ "start_time": "2024-06-04T00:03:00.368311Z"
+ }
},
- "execution_count": null
+ "execution_count": 45
},
{
"cell_type": "markdown",
@@ -573,47 +1780,49 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 46,
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2024-06-04T00:03:00.945994Z",
+ "start_time": "2024-06-04T00:03:00.876446Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - original - rotation: -90x', layout=Layout(align_self='ce…",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "4030f64657c64b429d1b9921db0658ce"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Invalid material entry: {'name': 'Ni3 C2', 'basis': {'elements': [{'id': 0, 'value': 'Ni'}, {'id': 1, 'value': 'Ni'}, {'id': 2, 'value': 'Ni'}, {'id': 3, 'value': 'C'}, {'id': 4, 'value': 'C'}], 'coordinates': [{'id': 0, 'value': [0.666666666, 0.666666666, 0.370003259]}, {'id': 1, 'value': [1.0, 0.0, 0.444437319]}, {'id': 2, 'value': [0.333333335, 0.333333335, 0.518923746]}, {'id': 3, 'value': [0.333333332, 0.333333332, 0.590885865]}, {'id': 4, 'value': [0.666666667, 0.666666667, 0.575749812]}], 'units': 'crystal', 'cell': [[2.478974, 0.0, 0.0], [1.239487, 2.146854459, 0.0], [0.0, 0.0, 27.048147591]], 'constraints': []}, 'lattice': {'a': 2.478974, 'b': 2.478974, 'c': 27.048147591, 'alpha': 90.0, 'beta': 90.0, 'gamma': 60.0, 'units': {'length': 'angstrom', 'angle': 'degree'}, 'type': 'TRI', 'vectors': {'a': [2.478974, 0.0, 0.0], 'b': [1.239487, 2.146854459, 0.0], 'c': [0.0, 0.0, 27.048147591], 'alat': 1, 'units': 'angstrom'}}, 'isNonPeriodic': False, '_id': '', 'metadata': {'boundaryConditions': {'type': 'pbc', 'offset': 0}}, 'isUpdated': True}\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": "GridBox(layout=Layout(grid_gap='10px', grid_template_columns='repeat(3, minmax(100px, 33.333333333333336%))', …",
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "af4222d16eb94cf0809c66bdb12128f1"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
- "import base64\n",
- "from ase.io import write\n",
- "from ase.build import make_supercell\n",
- "from IPython.display import HTML\n",
- "import io\n",
- "\n",
- "\n",
- "def visualize_material_base64(material, title: str, rotation: str = '0x', number_of_repetitions: int = 3):\n",
- " \"\"\"\n",
- " Returns an HTML string with a Base64-encoded image for visualization,\n",
- " including the name of the file, positioned horizontally.\n",
- " \"\"\"\n",
- " # Set the number of unit cell repetition for the structure\n",
- " n = number_of_repetitions\n",
- " material_repeat = make_supercell(material, [[n, 0, 0], [0, n, 0], [0, 0, 1]])\n",
- " text = f\"{material.symbols} - {title}\"\n",
- "\n",
- " # Write image to a buffer to display in HTML\n",
- " buf = io.BytesIO()\n",
- " write(buf, material_repeat, format='png', rotation=rotation)\n",
- " buf.seek(0)\n",
- " img_str = base64.b64encode(buf.read()).decode('utf-8')\n",
- " html_str = f'''\n",
- " \n",
- "
{text}
\n",
- "
\n",
- "
\n",
- " '''\n",
- " return html_str\n",
- "\n",
- "\n",
- "html_original = visualize_material_base64(ase_original_interface, \"original\", \"-90x\")\n",
- "html_relaxed = visualize_material_base64(ase_final_interface, \"relaxed\", \"-90x\")\n",
- "\n",
- "# Display the interfaces before and after relaxation\n",
- "html_content = f'{html_original}{html_relaxed}
'\n",
- "display(HTML(html_content))\n",
+ "visualize(interface, title=\"original\", rotation=\"-90x\")\n",
+ "visualize(final_interface, title=\"relaxed\", rotation=\"-90x\")\n",
"\n"
]
},
@@ -647,10 +1856,10 @@
"\n",
"\n",
"# Filter atoms for original and relaxed interfaces\n",
- "substrate_original_interface = filter_atoms_by_tag(ase_original_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "layer_original_interface = filter_atoms_by_tag(ase_original_interface, LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "substrate_relaxed_interface = filter_atoms_by_tag(ase_final_interface, SUBSTRATE_PARAMETERS[\"MATERIAL_INDEX\"])\n",
- "layer_relaxed_interface = filter_atoms_by_tag(ase_final_interface, LAYER_PARAMETERS[\"MATERIAL_INDEX\"])\n",
+ "substrate_original_interface = filter_atoms_by_tag(ase_original_interface, 0)\n",
+ "layer_original_interface = filter_atoms_by_tag(ase_original_interface, 1)\n",
+ "substrate_relaxed_interface = filter_atoms_by_tag(ase_final_interface, 0)\n",
+ "layer_relaxed_interface = filter_atoms_by_tag(ase_final_interface, 1)\n",
"\n",
"# Calculate energies\n",
"original_substrate_energy = calculate_energy(substrate_original_interface, calculator)\n",
From 6219ce29a1ff96400bb91ad8c587d7f0a82c3084 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Tue, 4 Jun 2024 14:34:30 -0700
Subject: [PATCH 11/33] update: use energy calculation from made tools
---
...te_interface_with_relaxation_ase_emt.ipynb | 1484 +----------------
1 file changed, 80 insertions(+), 1404 deletions(-)
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 795dae62..f03bbf28 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -55,16 +55,13 @@
"# Enable interactive selection of terminations via UI prompt\n",
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
"# Maximum area for the superlattice search algorithm\n",
- "MAX_AREA = 50"
+ "MAX_AREA = 50\n",
+ "FMAX = 0.05"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.603761Z",
- "start_time": "2024-06-03T23:54:45.601058Z"
- }
+ "collapsed": false
},
- "execution_count": 18
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -89,13 +86,9 @@
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.725746Z",
- "start_time": "2024-06-03T23:54:45.722075Z"
- }
+ "collapsed": false
},
- "execution_count": 19
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -109,35 +102,9 @@
},
{
"cell_type": "code",
- "execution_count": 20,
- "metadata": {
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.751100Z",
- "start_time": "2024-06-03T23:54:45.743383Z"
- }
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Data from 0-Ni has been read successfully.\n",
- "Data from 1-Graphene has been read successfully.\n",
- "Data from 2-WS2 has been read successfully.\n",
- "Data from 3-BN has been read successfully.\n",
- "Data from 4-Te2Mo has been read successfully.\n",
- "Data from 5-HfO2 has been read successfully.\n",
- "Data from C2(001)-Ni4(111) Interface, Strain (mean_abs_strain=0.001%) has been read successfully.\n",
- "Data from C2(001)-Ni4(111) Interface has been read successfully.\n",
- "Data from C2(001)-Ni4(111), Interface, Strain 0.001% has been read successfully.\n",
- "Data from C2(001)-Ni4(111), Interface, Strain 0.105% has been read successfully.\n",
- "Data from C2(001)-Ni4(111), Interface has been read successfully.\n",
- "Data from Ni3 C2 has been read successfully.\n",
- "Data from Si4 has been read successfully.\n",
- "Data from Si8 has been read successfully.\n"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
@@ -160,27 +127,9 @@
},
{
"cell_type": "code",
- "execution_count": 21,
- "metadata": {
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.898612Z",
- "start_time": "2024-06-03T23:54:45.803205Z"
- }
- },
- "outputs": [
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni - Material - rotation: 0x', layout=Layout(align_self='center'…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "e1606a47b9d54a148529ba164fe45493"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
@@ -224,13 +173,9 @@
")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.922305Z",
- "start_time": "2024-06-03T23:54:45.901983Z"
- }
+ "collapsed": false
},
- "execution_count": 22
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -249,13 +194,9 @@
"substrate_slab_terminations = get_terminations(substrate_slab_configuration)"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:45.956577Z",
- "start_time": "2024-06-03T23:54:45.923865Z"
- }
+ "collapsed": false
},
- "execution_count": 23
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -268,32 +209,7 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='C2 - C_P6/mmm_2 - rotation: -90x', layout=Layout(align_self='cen…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "b1bc9c80e9ef4bf59c04099ea5ceeac0"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3 - Ni_P6/mmm_1 - rotation: -90x', layout=Layout(align_self='c…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "2c1ddacb7b10421bb94e961a115954b2"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"film_slabs = [create_slab(film_slab_configuration, termination) for termination in film_slab_terminations]\n",
"substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in substrate_slab_terminations]\n",
@@ -302,13 +218,9 @@
"visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") "
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:46.133922Z",
- "start_time": "2024-06-03T23:54:45.960447Z"
- }
+ "collapsed": false
},
- "execution_count": 24
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -321,16 +233,7 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Termination Pairs (Film, Substrate)\n",
- " 0: (C_P6/mmm_2, Ni_P6/mmm_1)\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"from itertools import product\n",
"\n",
@@ -340,13 +243,9 @@
" print(f\" {idx}: {termination_pair}\")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:46.140499Z",
- "start_time": "2024-06-03T23:54:46.135598Z"
- }
+ "collapsed": false
},
- "execution_count": 25
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -374,13 +273,9 @@
" termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"film/substrate termination pair\")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:46.150389Z",
- "start_time": "2024-06-03T23:54:46.142777Z"
- }
+ "collapsed": false
},
- "execution_count": 26
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -409,13 +304,9 @@
")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:46.155410Z",
- "start_time": "2024-06-03T23:54:46.152107Z"
- }
+ "collapsed": false
},
- "execution_count": 27
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -437,13 +328,9 @@
")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:46.160966Z",
- "start_time": "2024-06-03T23:54:46.157479Z"
- }
+ "collapsed": false
},
- "execution_count": 28
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -457,15 +344,7 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Interface will be built with terminations: (C_P6/mmm_2, Ni_R-3m_1)\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n",
"\n",
@@ -474,13 +353,9 @@
"interfaces_sorted_by_size_and_strain= matched_interfaces_builder.get_materials(configuration=interface_configuration)"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:47.809670Z",
- "start_time": "2024-06-03T23:54:46.162910Z"
- }
+ "collapsed": false
},
- "execution_count": 29
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -493,1003 +368,7 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 0",
- "text": [
- "Index: 0
Strain: 0.11%
Atoms: 5"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 5
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 1",
- "text": [
- "Index: 1
Strain: 0.11%
Atoms: 10"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 10
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 2",
- "text": [
- "Index: 2
Strain: 0.11%
Atoms: 15"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 15
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 3",
- "text": [
- "Index: 3
Strain: 0.11%
Atoms: 20"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 20
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 4",
- "text": [
- "Index: 4
Strain: 0.11%
Atoms: 25"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 25
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 5",
- "text": [
- "Index: 5
Strain: 0.11%
Atoms: 30"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 30
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 6",
- "text": [
- "Index: 6
Strain: 0.11%
Atoms: 35"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 35
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 7",
- "text": [
- "Index: 7
Strain: 0.11%
Atoms: 40"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 40
- ],
- "type": "scatter"
- },
- {
- "hoverinfo": "text",
- "mode": "markers",
- "name": "Index: 8",
- "text": [
- "Index: 8
Strain: 0.11%
Atoms: 45"
- ],
- "x": [
- 0.10500000000000001
- ],
- "y": [
- 45
- ],
- "type": "scatter"
- }
- ],
- "layout": {
- "height": 600,
- "hovermode": "closest",
- "legend": {
- "title": {
- "text": "Interfaces Indices"
- }
- },
- "xaxis": {
- "title": {
- "text": "Strain (%)"
- },
- "type": "log"
- },
- "yaxis": {
- "title": {
- "text": "Number of atoms"
- },
- "type": "log"
- },
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"from utils.plot import plot_strain_vs_atoms\n",
"\n",
@@ -1502,13 +381,9 @@
"plot_strain_vs_atoms(interfaces_sorted_by_size_and_strain, PLOT_SETTINGS)"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:47.822854Z",
- "start_time": "2024-06-03T23:54:47.812562Z"
- }
+ "collapsed": false
},
- "execution_count": 30
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -1530,13 +405,9 @@
"interface = interfaces_sorted_by_size_and_strain[interface_index]"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:47.827131Z",
- "start_time": "2024-06-03T23:54:47.824223Z"
- }
+ "collapsed": false
},
- "execution_count": 31
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -1549,44 +420,15 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - Material - rotation: 0x,0y,0z', layout=Layout(align_self…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "24a91ce9943e4bcea56759a70dc99ef6"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - Material - rotation: -90x', layout=Layout(align_self='ce…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "6fbd97b61c4543a19d297dfca436b958"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"visualize(interface, repetitions=[3, 3, 1])\n",
"visualize(interface, repetitions=[3, 3, 1], rotation=\"-90x\")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-03T23:54:48.022208Z",
- "start_time": "2024-06-03T23:54:47.828501Z"
- }
+ "collapsed": false
},
- "execution_count": 32
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -1602,25 +444,15 @@
"cell_type": "code",
"outputs": [],
"source": [
- "RELAXATION_PARAMETERS = {\n",
- " \"FMAX\": 0.018,\n",
- "}\n",
- "\n",
- "from mat3ra.made.tools.modify import RelaxationSettings, CalculatorEnum, OptimizerEnum\n",
- "relaxation_settings = RelaxationSettings()\n",
+ "from ase.calculators.emt import EMT\n",
"\n",
- "relaxation_settings.optimizer = OptimizerEnum.BFGS\n",
- "relaxation_settings.calculator = CalculatorEnum.EMT\n",
- "relaxation_settings.fmax = 0.05"
+ "# Set up the calculator \n",
+ "calculator = EMT()"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-04T00:02:59.824691Z",
- "start_time": "2024-06-04T00:02:59.820789Z"
- }
+ "collapsed": false
},
- "execution_count": 44
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -1631,104 +463,25 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "a1760512e6db4817a6faf46685a3f3f6"
- },
- "text/plain": "FigureWidget({\n 'data': [{'mode': 'lines+markers',\n 'name': 'Energy',\n 'type': 'scatter',\n 'uid': 'c495c2f2-3f0b-4b7d-94a2-f63cc6b25c58',\n 'x': [],\n 'y': []}],\n 'layout': {'template': '...',\n 'title': {'text': 'Real-time Optimization Progress'},\n 'xaxis': {'anchor': 'y', 'domain': [0.0, 1.0], 'title': {'text': 'Step'}},\n 'yaxis': {'anchor': 'x', 'domain': [0.0, 1.0], 'title': {'text': 'Energy (eV)'}}}\n})"
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- " Step Time Energy fmax\n",
- "BFGS: 0 17:03:00 1.445681 0.1415\n",
- "Step: 0, Energy: 1.4457 eV\n",
- "BFGS: 1 17:03:00 1.445033 0.1302\n",
- "Step: 1, Energy: 1.4450 eV\n",
- "BFGS: 2 17:03:00 1.432713 0.4527\n",
- "Step: 2, Energy: 1.4327 eV\n",
- "BFGS: 3 17:03:00 1.423774 0.6641\n",
- "Step: 3, Energy: 1.4238 eV\n",
- "BFGS: 4 17:03:00 1.359592 1.2474\n",
- "Step: 4, Energy: 1.3596 eV\n",
- "BFGS: 5 17:03:00 1.226410 1.4583\n",
- "Step: 5, Energy: 1.2264 eV\n",
- "BFGS: 6 17:03:00 1.502803 3.4047\n",
- "Step: 6, Energy: 1.5028 eV\n",
- "BFGS: 7 17:03:00 1.195866 1.3429\n",
- "Step: 7, Energy: 1.1959 eV\n",
- "BFGS: 8 17:03:00 1.173834 1.2495\n",
- "Step: 8, Energy: 1.1738 eV\n",
- "BFGS: 9 17:03:00 1.051097 1.4582\n",
- "Step: 9, Energy: 1.0511 eV\n",
- "BFGS: 10 17:03:00 0.997766 0.8415\n",
- "Step: 10, Energy: 0.9978 eV\n",
- "BFGS: 11 17:03:00 0.949498 0.7572\n",
- "Step: 11, Energy: 0.9495 eV\n",
- "BFGS: 12 17:03:00 0.932681 0.7517\n",
- "Step: 12, Energy: 0.9327 eV\n",
- "BFGS: 13 17:03:00 0.861661 0.7905\n",
- "Step: 13, Energy: 0.8617 eV\n",
- "BFGS: 14 17:03:00 0.818040 0.5732\n",
- "Step: 14, Energy: 0.8180 eV\n",
- "BFGS: 15 17:03:00 0.808065 0.2067\n",
- "Step: 15, Energy: 0.8081 eV\n",
- "BFGS: 16 17:03:00 0.806009 0.1834\n",
- "Step: 16, Energy: 0.8060 eV\n",
- "BFGS: 17 17:03:00 0.804989 0.1818\n",
- "Step: 17, Energy: 0.8050 eV\n",
- "BFGS: 18 17:03:00 0.799836 0.1027\n",
- "Step: 18, Energy: 0.7998 eV\n",
- "BFGS: 19 17:03:00 0.799267 0.0464\n",
- "Step: 19, Energy: 0.7993 eV\n",
- "BFGS: 20 17:03:00 0.799174 0.0035\n",
- "Step: 20, Energy: 0.7992 eV\n",
- "The final energy is 0.799 eV.\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
- "import plotly.graph_objs as go\n",
- "from IPython.display import display\n",
- "from plotly.subplots import make_subplots\n",
+ "from utils.plot import create_realtime_plot\n",
"from mat3ra.made.tools.convert import to_ase, from_ase\n",
"from ase.optimize import BFGS\n",
- "from ase.calculators.emt import EMT\n",
"\n",
"\n",
- "# Set up the calculator \n",
- "calculator = EMT()\n",
- "\n",
"# Set up the interface for relaxation\n",
"ase_interface = to_ase(interface)\n",
"ase_interface.set_calculator(calculator)\n",
"\n",
"dyn = BFGS(ase_interface)\n",
"\n",
- "\n",
"# Initialize empty lists to store steps and energies\n",
"steps = []\n",
"energies = []\n",
"\n",
- "# Create a plotly figure widget\n",
- "fig = make_subplots(rows=1, cols=1, specs=[[{\"type\": \"scatter\"}]])\n",
- "scatter = go.Scatter(x=[], y=[], mode='lines+markers', name='Energy')\n",
- "fig.add_trace(scatter)\n",
- "fig.update_layout(title_text='Real-time Optimization Progress', xaxis_title='Step', yaxis_title='Energy (eV)')\n",
- "\n",
- "# Display figure widget\n",
- "f = go.FigureWidget(fig)\n",
- "display(f)\n",
- "\n",
"\n",
+ "f = create_realtime_plot()\n",
"# Define a callback function to update the plot at each step\n",
"def plotly_callback():\n",
" step = dyn.nsteps\n",
@@ -1748,89 +501,37 @@
"\n",
"# Run the relaxation\n",
"dyn.attach(plotly_callback, interval=1)\n",
- "dyn.run(fmax=RELAXATION_PARAMETERS[\"FMAX\"])\n",
+ "dyn.run(fmax=FMAX)\n",
"\n",
- "# Extract results\n",
- "ase_original_interface = to_ase(interface)\n",
- "ase_original_interface.set_calculator(calculator)\n",
"ase_final_interface = ase_interface\n",
- "final_interface = from_ase(ase_final_interface)\n",
- "\n",
- "original_energy = ase_original_interface.get_total_energy()\n",
- "relaxed_energy = ase_interface.get_total_energy()\n",
- "\n",
- "# Print out the final relaxed structure and energy\n",
- "print(f\"The final energy is {float(relaxed_energy):.3f} eV.\")"
+ "final_interface = Material(from_ase(ase_final_interface))"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-04T00:03:00.854695Z",
- "start_time": "2024-06-04T00:03:00.368311Z"
- }
+ "collapsed": false
},
- "execution_count": 45
+ "execution_count": null
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 7.2. View structure before and after relaxation"
+ "### 5.3. View structure before and after relaxation"
]
},
{
"cell_type": "code",
- "execution_count": 46,
- "metadata": {
- "ExecuteTime": {
- "end_time": "2024-06-04T00:03:00.945994Z",
- "start_time": "2024-06-04T00:03:00.876446Z"
- }
- },
- "outputs": [
- {
- "data": {
- "text/plain": "GridBox(children=(VBox(children=(Label(value='Ni3C2 - original - rotation: -90x', layout=Layout(align_self='ce…",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "4030f64657c64b429d1b9921db0658ce"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Invalid material entry: {'name': 'Ni3 C2', 'basis': {'elements': [{'id': 0, 'value': 'Ni'}, {'id': 1, 'value': 'Ni'}, {'id': 2, 'value': 'Ni'}, {'id': 3, 'value': 'C'}, {'id': 4, 'value': 'C'}], 'coordinates': [{'id': 0, 'value': [0.666666666, 0.666666666, 0.370003259]}, {'id': 1, 'value': [1.0, 0.0, 0.444437319]}, {'id': 2, 'value': [0.333333335, 0.333333335, 0.518923746]}, {'id': 3, 'value': [0.333333332, 0.333333332, 0.590885865]}, {'id': 4, 'value': [0.666666667, 0.666666667, 0.575749812]}], 'units': 'crystal', 'cell': [[2.478974, 0.0, 0.0], [1.239487, 2.146854459, 0.0], [0.0, 0.0, 27.048147591]], 'constraints': []}, 'lattice': {'a': 2.478974, 'b': 2.478974, 'c': 27.048147591, 'alpha': 90.0, 'beta': 90.0, 'gamma': 60.0, 'units': {'length': 'angstrom', 'angle': 'degree'}, 'type': 'TRI', 'vectors': {'a': [2.478974, 0.0, 0.0], 'b': [1.239487, 2.146854459, 0.0], 'c': [0.0, 0.0, 27.048147591], 'alat': 1, 'units': 'angstrom'}}, 'isNonPeriodic': False, '_id': '', 'metadata': {'boundaryConditions': {'type': 'pbc', 'offset': 0}}, 'isUpdated': True}\n"
- ]
- },
- {
- "data": {
- "text/plain": "GridBox(layout=Layout(grid_gap='10px', grid_template_columns='repeat(3, minmax(100px, 33.333333333333336%))', …",
- "application/vnd.jupyter.widget-view+json": {
- "version_major": 2,
- "version_minor": 0,
- "model_id": "af4222d16eb94cf0809c66bdb12128f1"
- }
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
- "visualize(interface, title=\"original\", rotation=\"-90x\")\n",
- "visualize(final_interface, title=\"relaxed\", rotation=\"-90x\")\n",
- "\n"
+ "visualize([{\"material\": interface, \"title\": \"original\"}, {\"material\":final_interface, \"title\":\"relaxed\"}], rotation= \"-90x\", repetitions=[3, 3, 1])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 7.3. Calculate energy energy using ASE EMT"
+ "### 5.4. Calculate energy using ASE EMT"
]
},
{
@@ -1839,71 +540,46 @@
"metadata": {},
"outputs": [],
"source": [
- "def filter_atoms_by_tag(atoms, material_index):\n",
- " \"\"\"Filter atoms by their tag, corresponding to the material index.\"\"\"\n",
- " return atoms[atoms.get_tags() == material_index]\n",
- "\n",
- "\n",
- "def calculate_energy(atoms, calculator):\n",
- " \"\"\"Set calculator for atoms and return their total energy.\"\"\"\n",
- " atoms.set_calculator(calculator)\n",
- " return atoms.get_total_energy()\n",
- "\n",
- "\n",
- "def calculate_delta_energy(total_energy, *component_energies):\n",
- " \"\"\"Calculate the delta energy by subtracting component energies from the total energy.\"\"\"\n",
- " return total_energy - sum(component_energies)\n",
+ "from mat3ra.made.tools.modify import filter_by_label\n",
+ "from mat3ra.made.tools.calculate import calculate_total_energy, calculate_interfacial_energy\n",
"\n",
+ "original_energy = calculate_total_energy(interface, calculator)\n",
+ "relaxed_energy = calculate_total_energy(final_interface, calculator)\n",
"\n",
"# Filter atoms for original and relaxed interfaces\n",
- "substrate_original_interface = filter_atoms_by_tag(ase_original_interface, 0)\n",
- "layer_original_interface = filter_atoms_by_tag(ase_original_interface, 1)\n",
- "substrate_relaxed_interface = filter_atoms_by_tag(ase_final_interface, 0)\n",
- "layer_relaxed_interface = filter_atoms_by_tag(ase_final_interface, 1)\n",
+ "substrate_original_interface = filter_by_label(interface, 0)\n",
+ "substrate_relaxed_interface = filter_by_label(final_interface, 0)\n",
+ "film_original_interface = filter_by_label(interface, 1)\n",
+ "film_relaxed_interface = filter_by_label(final_interface, 1)\n",
"\n",
"# Calculate energies\n",
- "original_substrate_energy = calculate_energy(substrate_original_interface, calculator)\n",
- "original_layer_energy = calculate_energy(layer_original_interface, calculator)\n",
- "relaxed_substrate_energy = calculate_energy(substrate_relaxed_interface, calculator)\n",
- "relaxed_layer_energy = calculate_energy(layer_relaxed_interface, calculator)\n",
- "\n",
- "# Calculate delta energies\n",
- "delta_original = calculate_delta_energy(original_energy, original_substrate_energy, original_layer_energy)\n",
- "delta_relaxed = calculate_delta_energy(relaxed_energy, relaxed_substrate_energy, relaxed_layer_energy)\n",
+ "original_substrate_energy = calculate_total_energy(substrate_original_interface, calculator)\n",
+ "original_film_energy = calculate_total_energy(film_original_interface, calculator)\n",
+ "relaxed_substrate_energy = calculate_total_energy(substrate_relaxed_interface, calculator)\n",
+ "relaxed_film_energy = calculate_total_energy(film_relaxed_interface, calculator)\n",
"\n",
- "# Calculate area and effective delta per area\n",
- "area = ase_original_interface.get_volume() / ase_original_interface.cell[2, 2]\n",
- "number_of_interface_atoms = ase_final_interface.get_global_number_of_atoms()\n",
- "number_of_substrate_atoms = substrate_relaxed_interface.get_global_number_of_atoms()\n",
- "number_of_layer_atoms = layer_relaxed_interface.get_global_number_of_atoms()\n",
- "effective_delta_relaxed = (relaxed_energy/number_of_interface_atoms - (relaxed_substrate_energy/number_of_substrate_atoms + relaxed_layer_energy/number_of_layer_atoms)) / (2 * area)\n",
+ "interfacial_energy = calculate_interfacial_energy(interface=final_interface, substrate_slab=substrate_relaxed_interface, film_slab=film_relaxed_interface, substrate_bulk=substrate, film_bulk=film, calculator=calculator)\n",
"\n",
"# Print out the metrics\n",
"print(f\"Original Substrate energy: {original_substrate_energy:.4f} eV\")\n",
"print(f\"Relaxed Substrate energy: {relaxed_substrate_energy:.4f} eV\")\n",
- "print(f\"Original Layer energy: {original_layer_energy:.4f} eV\")\n",
- "print(f\"Relaxed Layer energy: {relaxed_layer_energy:.4f} eV\")\n",
- "print(\"\\nDelta between interface energy and sum of component energies\")\n",
- "print(f\"Original Delta: {delta_original:.4f} eV\")\n",
- "print(f\"Relaxed Delta: {delta_relaxed:.4f} eV\")\n",
- "print(f\"Original Delta per area: {delta_original / area:.4f} eV/Ang^2\")\n",
- "print(f\"Relaxed Delta per area: {delta_relaxed / area:.4f} eV/Ang^2\")\n",
- "print(f\"Relaxed interface energy: {relaxed_energy:.4f} eV\")\n",
- "print(f\"Effective relaxed Delta per area: {effective_delta_relaxed:.4f} eV/Ang^2 ({effective_delta_relaxed / 0.16:.4f} J/m^2)\\n\")\n",
- "\n",
- "# Print out the POSCARs\n",
- "print(\"Relaxed interface:\\n\", ase_to_poscar(ase_final_interface))\n",
- "print(\"Relaxed substrate:\\n\", ase_to_poscar(substrate_relaxed_interface))\n",
- "print(\"Relaxed layer:\\n\", ase_to_poscar(layer_relaxed_interface))"
+ "print(f\"Original Layer energy: {original_film_energy:.4f} eV\")\n",
+ "print(f\"Relaxed Layer energy: {relaxed_film_energy:.4f} eV\")\n",
+ "print(\"Interfacial energy: {interfacial_energy:.4f} eV\")"
]
},
{
"cell_type": "code",
"outputs": [],
- "source": [],
+ "source": [
+ "from utils.jupyterlite import set_data\n",
+ "\n",
+ "set_data(\"materials\", [final_interface.to_json()])"
+ ],
"metadata": {
"collapsed": false
- }
+ },
+ "execution_count": null
}
],
"metadata": {
From 9334e67ceb9616c498d3ab13a511d2cc2b0fbd46 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Tue, 4 Jun 2024 19:10:22 -0700
Subject: [PATCH 12/33] chore: cleanups
---
...te_interface_with_relaxation_ase_emt.ipynb | 51 +++++--------------
1 file changed, 14 insertions(+), 37 deletions(-)
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 f03bbf28..e58118cd 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -434,7 +434,8 @@
"cell_type": "markdown",
"source": [
"## 5. Perform Relaxation\n",
- "### 5.1. Set Relaxation Parameters"
+ "### 5.1. Apply relaxation to the selected interface\n",
+ "Relaxation is performed with ASE tools"
],
"metadata": {
"collapsed": false
@@ -444,46 +445,24 @@
"cell_type": "code",
"outputs": [],
"source": [
- "from ase.calculators.emt import EMT\n",
- "\n",
- "# Set up the calculator \n",
- "calculator = EMT()"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 5.2. Apply relaxation to the selected interface"
- ]
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from utils.plot import create_realtime_plot\n",
+ "from utils.plot import create_realtime_plot, update_plot\n",
"from mat3ra.made.tools.convert import to_ase, from_ase\n",
"from ase.optimize import BFGS\n",
+ "from ase.calculators.emt import EMT\n",
"\n",
+ "# Set up the calculator \n",
+ "calculator = EMT()\n",
"\n",
"# Set up the interface for relaxation\n",
"ase_interface = to_ase(interface)\n",
"ase_interface.set_calculator(calculator)\n",
"\n",
"dyn = BFGS(ase_interface)\n",
- "\n",
"# Initialize empty lists to store steps and energies\n",
"steps = []\n",
"energies = []\n",
"\n",
- "\n",
- "f = create_realtime_plot()\n",
- "# Define a callback function to update the plot at each step\n",
- "def plotly_callback():\n",
+ "def plot_update_callback():\n",
" step = dyn.nsteps\n",
" energy = ase_interface.get_total_energy()\n",
"\n",
@@ -492,15 +471,13 @@
" energies.append(energy)\n",
"\n",
" print(f\"Step: {step}, Energy: {energy:.4f} eV\")\n",
+ " update_plot(fig, steps, energies)\n",
"\n",
- " # Update the figure with the new data\n",
- " with f.batch_update():\n",
- " f.data[0].x = steps\n",
- " f.data[0].y = energies\n",
"\n",
+ "fig = create_realtime_plot()\n",
"\n",
"# Run the relaxation\n",
- "dyn.attach(plotly_callback, interval=1)\n",
+ "dyn.attach(plot_update_callback, interval=1)\n",
"dyn.run(fmax=FMAX)\n",
"\n",
"ase_final_interface = ase_interface\n",
@@ -554,8 +531,8 @@
"\n",
"# Calculate energies\n",
"original_substrate_energy = calculate_total_energy(substrate_original_interface, calculator)\n",
- "original_film_energy = calculate_total_energy(film_original_interface, calculator)\n",
"relaxed_substrate_energy = calculate_total_energy(substrate_relaxed_interface, calculator)\n",
+ "original_film_energy = calculate_total_energy(film_original_interface, calculator)\n",
"relaxed_film_energy = calculate_total_energy(film_relaxed_interface, calculator)\n",
"\n",
"interfacial_energy = calculate_interfacial_energy(interface=final_interface, substrate_slab=substrate_relaxed_interface, film_slab=film_relaxed_interface, substrate_bulk=substrate, film_bulk=film, calculator=calculator)\n",
@@ -563,9 +540,9 @@
"# Print out the metrics\n",
"print(f\"Original Substrate energy: {original_substrate_energy:.4f} eV\")\n",
"print(f\"Relaxed Substrate energy: {relaxed_substrate_energy:.4f} eV\")\n",
- "print(f\"Original Layer energy: {original_film_energy:.4f} eV\")\n",
- "print(f\"Relaxed Layer energy: {relaxed_film_energy:.4f} eV\")\n",
- "print(\"Interfacial energy: {interfacial_energy:.4f} eV\")"
+ "print(f\"Original Film energy: {original_film_energy:.4f} eV\")\n",
+ "print(f\"Relaxed Film energy: {relaxed_film_energy:.4f} eV\")\n",
+ "print(f\"Interfacial energy: {interfacial_energy:.4f} eV\")"
]
},
{
From 8c42124e927084df735453c393abc9456a8cba0d Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Tue, 4 Jun 2024 20:43:29 -0700
Subject: [PATCH 13/33] update: move live plot to utils
---
...te_interface_with_relaxation_ase_emt.ipynb | 63 ++++++++++++-------
utils/plot.py | 14 +++++
2 files changed, 54 insertions(+), 23 deletions(-)
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 e58118cd..f9936d1c 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -434,8 +434,7 @@
"cell_type": "markdown",
"source": [
"## 5. Perform Relaxation\n",
- "### 5.1. Apply relaxation to the selected interface\n",
- "Relaxation is performed with ASE tools"
+ "### 5.1. Set up the optimization parameters"
],
"metadata": {
"collapsed": false
@@ -445,40 +444,49 @@
"cell_type": "code",
"outputs": [],
"source": [
- "from utils.plot import create_realtime_plot, update_plot\n",
- "from mat3ra.made.tools.convert import to_ase, from_ase\n",
"from ase.optimize import BFGS\n",
"from ase.calculators.emt import EMT\n",
+ "from mat3ra.made.tools.convert import to_ase\n",
"\n",
- "# Set up the calculator \n",
"calculator = EMT()\n",
+ "optimizer = BFGS\n",
+ "OPTIMIZATION_PARAMETERS = {\n",
+ " \"FMAX\": FMAX\n",
+ "}"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### 5.2. Optimize atomic coordinates of the selected interface and view energy/step plot"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [
+ "from utils.plot import create_realtime_plot, plot_update_callback\n",
+ "from mat3ra.made.tools.convert import from_ase\n",
"\n",
- "# Set up the interface for relaxation\n",
+ "# Add calculator to the interface for relaxation\n",
"ase_interface = to_ase(interface)\n",
"ase_interface.set_calculator(calculator)\n",
"\n",
- "dyn = BFGS(ase_interface)\n",
- "# Initialize empty lists to store steps and energies\n",
+ "dyn = optimizer(ase_interface)\n",
"steps = []\n",
"energies = []\n",
- "\n",
- "def plot_update_callback():\n",
- " step = dyn.nsteps\n",
- " energy = ase_interface.get_total_energy()\n",
- "\n",
- " # Add the new step and energy to the lists\n",
- " steps.append(step)\n",
- " energies.append(energy)\n",
- "\n",
- " print(f\"Step: {step}, Energy: {energy:.4f} eV\")\n",
- " update_plot(fig, steps, energies)\n",
- "\n",
- "\n",
"fig = create_realtime_plot()\n",
"\n",
"# Run the relaxation\n",
- "dyn.attach(plot_update_callback, interval=1)\n",
- "dyn.run(fmax=FMAX)\n",
+ "dyn.attach(plot_update_callback(dyn, ase_interface, fig, steps, energies), interval=1)\n",
+ "dyn.run(fmax=OPTIMIZATION_PARAMETERS[\"FMAX\"])\n",
"\n",
"ase_final_interface = ase_interface\n",
"final_interface = Material(from_ase(ase_final_interface))"
@@ -545,6 +553,15 @@
"print(f\"Interfacial energy: {interfacial_energy:.4f} eV\")"
]
},
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## 6. Pass data to the outside runtime"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
{
"cell_type": "code",
"outputs": [],
diff --git a/utils/plot.py b/utils/plot.py
index 0588654b..95f5a1e7 100644
--- a/utils/plot.py
+++ b/utils/plot.py
@@ -59,3 +59,17 @@ def update_plot(f, steps, energies):
with f.batch_update():
f.data[0].x = steps
f.data[0].y = energies
+
+
+def plot_update_callback(dyn, ase_interface, fig, steps, energies):
+ def update():
+ step = dyn.nsteps
+ energy = ase_interface.get_total_energy()
+
+ steps.append(step)
+ energies.append(energy)
+
+ print(f"Step: {step}, Energy: {energy:.4f} eV")
+ update_plot(fig, steps, energies)
+
+ return update
From b3aea243c69eb14414054012220f43761c5d36f4 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Tue, 4 Jun 2024 20:55:28 -0700
Subject: [PATCH 14/33] update: simplify emergies output
---
...te_interface_with_relaxation_ase_emt.ipynb | 24 ++++---------------
1 file changed, 5 insertions(+), 19 deletions(-)
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 f9936d1c..1d2a1b46 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -516,7 +516,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 5.4. Calculate energy using ASE EMT"
+ "### 5.4. Calculate energy using ASE EMT\n",
+ "The interfacial energy is the sum of the surface energies of the substrate and film minus the adhesion energy. According to Dupré's formula"
]
},
{
@@ -525,31 +526,16 @@
"metadata": {},
"outputs": [],
"source": [
- "from mat3ra.made.tools.modify import filter_by_label\n",
"from mat3ra.made.tools.calculate import calculate_total_energy, calculate_interfacial_energy\n",
"\n",
"original_energy = calculate_total_energy(interface, calculator)\n",
"relaxed_energy = calculate_total_energy(final_interface, calculator)\n",
"\n",
- "# Filter atoms for original and relaxed interfaces\n",
- "substrate_original_interface = filter_by_label(interface, 0)\n",
- "substrate_relaxed_interface = filter_by_label(final_interface, 0)\n",
- "film_original_interface = filter_by_label(interface, 1)\n",
- "film_relaxed_interface = filter_by_label(final_interface, 1)\n",
- "\n",
- "# Calculate energies\n",
- "original_substrate_energy = calculate_total_energy(substrate_original_interface, calculator)\n",
- "relaxed_substrate_energy = calculate_total_energy(substrate_relaxed_interface, calculator)\n",
- "original_film_energy = calculate_total_energy(film_original_interface, calculator)\n",
- "relaxed_film_energy = calculate_total_energy(film_relaxed_interface, calculator)\n",
- "\n",
- "interfacial_energy = calculate_interfacial_energy(interface=final_interface, substrate_slab=substrate_relaxed_interface, film_slab=film_relaxed_interface, substrate_bulk=substrate, film_bulk=film, calculator=calculator)\n",
+ "interfacial_energy = calculate_interfacial_energy(interface=final_interface, substrate_bulk=substrate, film_bulk=film, calculator=calculator)\n",
"\n",
"# Print out the metrics\n",
- "print(f\"Original Substrate energy: {original_substrate_energy:.4f} eV\")\n",
- "print(f\"Relaxed Substrate energy: {relaxed_substrate_energy:.4f} eV\")\n",
- "print(f\"Original Film energy: {original_film_energy:.4f} eV\")\n",
- "print(f\"Relaxed Film energy: {relaxed_film_energy:.4f} eV\")\n",
+ "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\")"
]
},
From 2b97b7d110653de4ebf5fa939415bd8770fbcc54 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Tue, 4 Jun 2024 20:55:57 -0700
Subject: [PATCH 15/33] chore: ase atoms:
---
utils/visualize.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/visualize.py b/utils/visualize.py
index 1f51be43..cb1c8f33 100644
--- a/utils/visualize.py
+++ b/utils/visualize.py
@@ -25,11 +25,11 @@ def get_material_image(material: Material, title: str, rotation="0x,0y,0z", repe
tuple: Tuple containing the image and the title.
"""
- material = to_ase(material)
+ ase_atoms = to_ase(material)
# Create supercell for visualization
supercell_matrix = [[repetitions[0], 0, 0], [0, repetitions[1], 0], [0, 0, repetitions[2]]]
- material_repeat = make_supercell(material, supercell_matrix)
- text = f"{material.symbols} - {title} - rotation: {rotation}"
+ material_repeat = make_supercell(ase_atoms, supercell_matrix)
+ text = f"{ase_atoms.symbols} - {title} - rotation: {rotation}"
# Write image to a buffer to display in HTML
buf = io.BytesIO()
From 5d0df37b1f76e9f8151ec6d13ceaac00f20364af Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 5 Jun 2024 10:47:03 -0700
Subject: [PATCH 16/33] update: add types and docstrings
---
utils/plot.py | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/utils/plot.py b/utils/plot.py
index 95f5a1e7..84adfd0c 100644
--- a/utils/plot.py
+++ b/utils/plot.py
@@ -1,6 +1,8 @@
from typing import Dict, List, Union
import plotly.graph_objs as go
+from ase.atoms import Atoms as ASEAtoms
+from ase.optimize import BFGS, FIRE
from IPython.display import display
from mat3ra.made.material import Material
from mat3ra.made.tools.build.interface.enums import StrainModes
@@ -46,6 +48,11 @@ def plot_strain_vs_atoms(interfaces: List[Material], settings: Dict[str, Union[s
def create_realtime_plot():
+ """
+ Create a real-time plot for optimization progress.
+ Returns:
+ go.FigureWidget: The real-time plot.
+ """
fig = make_subplots(rows=1, cols=1, specs=[[{"type": "scatter"}]])
scatter = go.Scatter(x=[], y=[], mode="lines+markers", name="Energy")
fig.add_trace(scatter)
@@ -55,13 +62,22 @@ def create_realtime_plot():
return f
-def update_plot(f, steps, energies):
- with f.batch_update():
- f.data[0].x = steps
- f.data[0].y = energies
-
+def plot_update_callback(
+ dyn: Union[BFGS, FIRE], ase_interface: ASEAtoms, fig: go.FigureWidget, steps: List[int], energies: List[int]
+):
+ """
+ Callback function for updating energies for steps in real-time.
+ Args:
+ dyn: The ASE dynamics object.
+ ase_interface: The ASE interface object.
+ fig: The plotly figure widget.
+ steps: The list of steps.
+ energies: The list of energies.
+
+ Returns:
+ function: The update function that is attached to the dynamics object and called each step.
+ """
-def plot_update_callback(dyn, ase_interface, fig, steps, energies):
def update():
step = dyn.nsteps
energy = ase_interface.get_total_energy()
@@ -70,6 +86,8 @@ def update():
energies.append(energy)
print(f"Step: {step}, Energy: {energy:.4f} eV")
- update_plot(fig, steps, energies)
+ with fig.batch_update():
+ fig.data[0].x = steps
+ fig.data[0].y = energies
return update
From c146bad046b01e238fe17b09b3892b9439f45ac4 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 5 Jun 2024 10:49:11 -0700
Subject: [PATCH 17/33] chore: cleanup
---
.../create_interface_with_relaxation_ase_emt.ipynb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 1d2a1b46..3c6b3ccc 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -166,7 +166,7 @@
"substrate_slab_configuration = SlabConfiguration(\n",
" bulk=substrate,\n",
" miller_indices=(1,1,1),\n",
- " thickness=3, # in atomic layers\n",
+ " thickness=8, # in atomic layers\n",
" vacuum=3, # in atomic layers\n",
" xy_supercell_matrix=[[1, 0], [0, 1]],\n",
" use_orthogonal_z=True\n",
@@ -434,7 +434,7 @@
"cell_type": "markdown",
"source": [
"## 5. Perform Relaxation\n",
- "### 5.1. Set up the optimization parameters"
+ "### 5.1. Set the optimization parameters"
],
"metadata": {
"collapsed": false
@@ -480,6 +480,7 @@
"ase_interface.set_calculator(calculator)\n",
"\n",
"dyn = optimizer(ase_interface)\n",
+ "print(type(dyn))\n",
"steps = []\n",
"energies = []\n",
"fig = create_realtime_plot()\n",
From b5a28573d05e8d1d96078e4291606b719c7c4e7e Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Wed, 5 Jun 2024 11:39:54 -0700
Subject: [PATCH 18/33] chore: cleanup 2
---
.../create_interface_with_relaxation_ase_emt.ipynb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 3c6b3ccc..e3caa830 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -166,7 +166,7 @@
"substrate_slab_configuration = SlabConfiguration(\n",
" bulk=substrate,\n",
" miller_indices=(1,1,1),\n",
- " thickness=8, # in atomic layers\n",
+ " thickness=6, # in atomic layers\n",
" vacuum=3, # in atomic layers\n",
" xy_supercell_matrix=[[1, 0], [0, 1]],\n",
" use_orthogonal_z=True\n",
@@ -480,9 +480,9 @@
"ase_interface.set_calculator(calculator)\n",
"\n",
"dyn = optimizer(ase_interface)\n",
- "print(type(dyn))\n",
"steps = []\n",
"energies = []\n",
+ "\n",
"fig = create_realtime_plot()\n",
"\n",
"# Run the relaxation\n",
From aa3363a0d3bdbc93d96668d407a054d0956d2b0b Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Fri, 7 Jun 2024 21:48:01 -0700
Subject: [PATCH 19/33] update: write output material to uploads
---
utils/jupyterlite.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/jupyterlite.py b/utils/jupyterlite.py
index 79bfdc88..bb13603a 100644
--- a/utils/jupyterlite.py
+++ b/utils/jupyterlite.py
@@ -135,6 +135,7 @@ def set_data_pyodide(key, value):
"""
display(Javascript(js_code))
print(f"Status: {key} sent to host.")
+ set_data_python(key, value)
def set_data_python(key, value):
From 1764becdbb9ca433c61d016937de50f77e11c5f9 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Sun, 9 Jun 2024 18:32:54 -0700
Subject: [PATCH 20/33] update: remove zsl steps from emt nb
---
...te_interface_with_relaxation_ase_emt.ipynb | 369 +++---------------
1 file changed, 50 insertions(+), 319 deletions(-)
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 e3caa830..8ddf78bd 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -6,25 +6,21 @@
"source": [
"\n",
"\n",
- "# Create an interface with ZSL and relax it using EMT potentials\n",
+ "# Relax interface using EMT potentials\n",
"\n",
- "Use Zur and McGill superlattices matching [algorithm](https://doi.org/10.1063/1.3330840) to create interfaces between two materials with minimal strain and then relax the resulting interface using the EMT potentials.\n",
+ "Optimize atoms coordinates of the interface using the EMT potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
"\n",
"Usage
\n",
"\n",
"1. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
- "1. Set slab parameters for the substrate and film in cell 2.1. (or use default).\n",
- "1. Set interface parameters in cell 3.1. (or use default).\n",
+ "1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Wait for the run to complete (depending on the parameters can take a few min). \n",
"1. Scroll down to view results. \n",
"\n",
"## Summary\n",
"1. Prepare the Environment: Set up the notebook and install packages, preview the input materials\n",
- "1. Create substrate and film slabs and select the terminations\n",
- "1. Generate interfaces with strain matcher and plot strain vs number of atoms \n",
- "1. Select the interface with the desired strain and visualize it\n",
"1. Perform relaxation of the interface with set parameters\n",
"1. View the structure before and after relaxation\n",
"\n",
@@ -59,9 +55,13 @@
"FMAX = 0.05"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-10T01:29:52.818456Z",
+ "start_time": "2024-06-10T01:29:52.812186Z"
+ }
},
- "execution_count": null
+ "execution_count": 1
},
{
"cell_type": "markdown",
@@ -86,15 +86,19 @@
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
],
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-06-10T01:29:52.824204Z",
+ "start_time": "2024-06-10T01:29:52.820461Z"
+ }
},
- "execution_count": null
+ "execution_count": 2
},
{
"cell_type": "markdown",
"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."
+ "### 1.3. Get input interface material\n",
+ "Materials are loaded with `get_data()`."
],
"metadata": {
"collapsed": false
@@ -102,9 +106,27 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 3,
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2024-06-10T01:29:53.257610Z",
+ "start_time": "2024-06-10T01:29:52.825411Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "ModuleNotFoundError",
+ "evalue": "No module named 'mat3ra.esse.models'",
+ "output_type": "error",
+ "traceback": [
+ "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
+ "\u001B[0;31mModuleNotFoundError\u001B[0m Traceback (most recent call last)",
+ "Cell \u001B[0;32mIn[3], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmade\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmaterial\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Material\n\u001B[1;32m 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mjupyterlite\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m get_data\n\u001B[1;32m 4\u001B[0m \u001B[38;5;66;03m# Get the list of input materials and load them into `materials_in` variable\u001B[39;00m\n",
+ "File \u001B[0;32m~/code/RED/api-examples/.venv-3.11.2/lib/python3.11/site-packages/mat3ra/made/material.py:5\u001B[0m\n\u001B[1;32m 3\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcode\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mconstants\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AtomicCoordinateUnits, Units\n\u001B[1;32m 4\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcode\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mentity\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m HasDescriptionHasMetadataNamedDefaultableInMemoryEntity\n\u001B[0;32m----> 5\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01messe\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmodels\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmaterial\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m MaterialSchema\n\u001B[1;32m 7\u001B[0m defaultMaterialConfig \u001B[38;5;241m=\u001B[39m {\n\u001B[1;32m 8\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mname\u001B[39m\u001B[38;5;124m\"\u001B[39m: \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mSilicon FCC\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[1;32m 9\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mbasis\u001B[39m\u001B[38;5;124m\"\u001B[39m: {\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 44\u001B[0m },\n\u001B[1;32m 45\u001B[0m }\n\u001B[1;32m 47\u001B[0m MaterialSchemaJSON \u001B[38;5;241m=\u001B[39m Dict[\u001B[38;5;28mstr\u001B[39m, Union[MaterialSchema, Any]]\n",
+ "\u001B[0;31mModuleNotFoundError\u001B[0m: No module named 'mat3ra.esse.models'"
+ ]
+ }
+ ],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
@@ -112,14 +134,13 @@
"# Get the list of input materials and load them into `materials_in` variable\n",
"get_data(\"materials_in\", globals())\n",
"materials = list(map(Material, globals()[\"materials_in\"]))\n",
- "substrate = materials[0]\n",
- "film = materials[1]"
+ "interface = materials[2]"
]
},
{
"cell_type": "markdown",
"source": [
- "### 1.4. Preview Substrate and Film"
+ "### 1.4. Preview Interface"
],
"metadata": {
"collapsed": false
@@ -128,313 +149,23 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "from utils.visualize import visualize_materials as visualize\n",
- "visualize([substrate, film], repetitions=[3, 3, 1], rotation=\"0x\")"
- ]
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 2. Configure slabs and select termination pair\n",
- "\n",
- "### 2.1. 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",
- "Define the substrate slab cell that will be used as a base for the interface and the film slab cell that will be placed on top of the substrate slab."
- ],
"metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n",
- "\n",
- "film_slab_configuration = SlabConfiguration(\n",
- " bulk=film,\n",
- " miller_indices=(0, 0, 1),\n",
- " thickness=1, # in atomic layers\n",
- " vacuum=0, # in atomic layers\n",
- " xy_supercell_matrix=[[1, 0], [0, 1]],\n",
- " use_orthogonal_z=True\n",
- ")\n",
- "\n",
- "substrate_slab_configuration = SlabConfiguration(\n",
- " bulk=substrate,\n",
- " miller_indices=(1,1,1),\n",
- " thickness=6, # in atomic layers\n",
- " vacuum=3, # in atomic layers\n",
- " xy_supercell_matrix=[[1, 0], [0, 1]],\n",
- " use_orthogonal_z=True\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
+ "ExecuteTime": {
+ "end_time": "2024-06-10T01:29:53.260590Z",
+ "start_time": "2024-06-10T01:29:53.260439Z"
+ }
},
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 2.2. Get possible terminations for the slabs"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
"outputs": [],
"source": [
- "film_slab_terminations = get_terminations(film_slab_configuration)\n",
- "substrate_slab_terminations = get_terminations(substrate_slab_configuration)"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 2.3. Visualize slabs for all possible terminations"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "film_slabs = [create_slab(film_slab_configuration, termination) for termination in film_slab_terminations]\n",
- "substrate_slabs = [create_slab(substrate_slab_configuration, termination) for termination in substrate_slab_terminations]\n",
- "\n",
- "visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in film_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\")\n",
- "visualize([{\"material\":slab, \"title\": slab.metadata[\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") "
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 2.4. Print terminations for the interface"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from itertools import product\n",
- "\n",
- "termination_pairs = list(product(film_slab_terminations, substrate_slab_terminations)) \n",
- "print(\"Termination Pairs (Film, Substrate)\")\n",
- "for idx, termination_pair in enumerate(termination_pairs):\n",
- " print(f\" {idx}: {termination_pair}\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 2.5. Select termination pair for the interface"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from utils.io import ui_prompt_select_array_element_by_index, ui_prompt_select_array_element_by_index_pyodide\n",
- "\n",
- "# Set the termination pair indices\n",
- "TERMINATION_PAIR_INDEX = 0\n",
- "\n",
- "termination_pair = termination_pairs[TERMINATION_PAIR_INDEX]\n",
- "if IS_TERMINATIONS_SELECTION_INTERACTIVE:\n",
- " if sys.platform == \"emscripten\":\n",
- " termination_pair = await ui_prompt_select_array_element_by_index_pyodide(termination_pairs, element_name=\"film/substrate termination pair\")\n",
- " else:\n",
- " termination_pair = ui_prompt_select_array_element_by_index(termination_pairs, element_name=\"film/substrate termination pair\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 3. Create interfaces\n",
- "\n",
- "### 3.1. Initialize the Interface Configuration"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from mat3ra.made.tools.build.interface import InterfaceConfiguration\n",
- "\n",
- "film_termination, substrate_termination = termination_pair\n",
- "interface_configuration = InterfaceConfiguration(\n",
- " film_configuration=film_slab_configuration,\n",
- " substrate_configuration=substrate_slab_configuration,\n",
- " film_termination=film_termination,\n",
- " substrate_termination=substrate_termination,\n",
- " distance=3.0 # in Angstrom\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 3.2. Set Strain Matching Algorithm Parameters (Optional)\n",
- "The search algorithm for supercells matching can be tuned by setting its parameters directly, otherwise the default values are used."
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from mat3ra.made.tools.build.interface import ZSLStrainMatchingParameters\n",
- "zsl_strain_matching_parameters = ZSLStrainMatchingParameters(\n",
- " max_area=MAX_AREA\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 3.3. Generate interfaces with strain matcher\n",
- "Interfaces are sorted by size and strain."
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from mat3ra.made.tools.build.interface import ZSLStrainMatchingInterfaceBuilder, ZSLStrainMatchingInterfaceBuilderParameters\n",
- "\n",
- "matched_interfaces_builder = ZSLStrainMatchingInterfaceBuilder(build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(strain_matching_parameters=zsl_strain_matching_parameters))\n",
- "\n",
- "interfaces_sorted_by_size_and_strain= matched_interfaces_builder.get_materials(configuration=interface_configuration)"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 3.4. Plot interfaces by size and strain\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "from utils.plot import plot_strain_vs_atoms\n",
- "\n",
- "PLOT_SETTINGS = {\n",
- " \"HEIGHT\": 600,\n",
- " \"X_SCALE\": \"log\", # or linear\n",
- " \"Y_SCALE\": \"log\", # or linear\n",
- "}\n",
- "\n",
- "plot_strain_vs_atoms(interfaces_sorted_by_size_and_strain, PLOT_SETTINGS)"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "### 3.5. Select the interface to relax\n",
- "\n",
- "Select the index for the interface with the lowest strain and the smallest number of atoms."
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "# select the first interface with the lowest strain and the smallest number of atoms\n",
- "interface_index = 0\n",
- "interface = interfaces_sorted_by_size_and_strain[interface_index]"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 4. Preview the selected material"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "outputs": [],
- "source": [
- "visualize(interface, repetitions=[3, 3, 1])\n",
- "visualize(interface, repetitions=[3, 3, 1], rotation=\"-90x\")"
- ],
- "metadata": {
- "collapsed": false
- },
- "execution_count": null
+ "from utils.visualize import visualize_materials as visualize\n",
+ "visualize(interface, repetitions=[3, 3, 1], rotation=\"0x\")"
+ ]
},
{
"cell_type": "markdown",
"source": [
- "## 5. Perform Relaxation\n",
- "### 5.1. Set the optimization parameters"
+ "## 2. Perform Relaxation\n",
+ "### 2.1. Set the optimization parameters"
],
"metadata": {
"collapsed": false
@@ -462,7 +193,7 @@
{
"cell_type": "markdown",
"source": [
- "### 5.2. Optimize atomic coordinates of the selected interface and view energy/step plot"
+ "### 2.2. Optimize atomic coordinates of the interface and view energy/step plot"
],
"metadata": {
"collapsed": false
From 1e4eab4d666059291349181c28aa514a9e7d2a1e Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Sun, 9 Jun 2024 21:00:04 -0700
Subject: [PATCH 21/33] update: add a note of limitations
---
...te_interface_with_relaxation_ase_emt.ipynb | 56 +++++--------------
1 file changed, 13 insertions(+), 43 deletions(-)
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 8ddf78bd..50314c1d 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -8,7 +8,9 @@
"\n",
"# Relax interface using EMT potentials\n",
"\n",
- "Optimize atoms coordinates of the interface using the EMT potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
+ "Optimize atoms coordinates of the intgserface using the EMT (Effective Medium Theory) potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
+ "\n",
+ "NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\",\n",
"\n",
"Usage
\n",
"\n",
@@ -50,18 +52,13 @@
"source": [
"# Enable interactive selection of terminations via UI prompt\n",
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
- "# Maximum area for the superlattice search algorithm\n",
- "MAX_AREA = 50\n",
+ "# Maximum force applied to atoms during relaxation\n",
"FMAX = 0.05"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-10T01:29:52.818456Z",
- "start_time": "2024-06-10T01:29:52.812186Z"
- }
+ "collapsed": false
},
- "execution_count": 1
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -86,13 +83,9 @@
" await install_packages(\"create_interface_with_min_strain_zsl.ipynb\", \"../../config.yml\")"
],
"metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-06-10T01:29:52.824204Z",
- "start_time": "2024-06-10T01:29:52.820461Z"
- }
+ "collapsed": false
},
- "execution_count": 2
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -106,27 +99,9 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "ExecuteTime": {
- "end_time": "2024-06-10T01:29:53.257610Z",
- "start_time": "2024-06-10T01:29:52.825411Z"
- }
- },
- "outputs": [
- {
- "ename": "ModuleNotFoundError",
- "evalue": "No module named 'mat3ra.esse.models'",
- "output_type": "error",
- "traceback": [
- "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
- "\u001B[0;31mModuleNotFoundError\u001B[0m Traceback (most recent call last)",
- "Cell \u001B[0;32mIn[3], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmade\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmaterial\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Material\n\u001B[1;32m 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mjupyterlite\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m get_data\n\u001B[1;32m 4\u001B[0m \u001B[38;5;66;03m# Get the list of input materials and load them into `materials_in` variable\u001B[39;00m\n",
- "File \u001B[0;32m~/code/RED/api-examples/.venv-3.11.2/lib/python3.11/site-packages/mat3ra/made/material.py:5\u001B[0m\n\u001B[1;32m 3\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcode\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mconstants\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AtomicCoordinateUnits, Units\n\u001B[1;32m 4\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcode\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mentity\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m HasDescriptionHasMetadataNamedDefaultableInMemoryEntity\n\u001B[0;32m----> 5\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmat3ra\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01messe\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmodels\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmaterial\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m MaterialSchema\n\u001B[1;32m 7\u001B[0m defaultMaterialConfig \u001B[38;5;241m=\u001B[39m {\n\u001B[1;32m 8\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mname\u001B[39m\u001B[38;5;124m\"\u001B[39m: \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mSilicon FCC\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[1;32m 9\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mbasis\u001B[39m\u001B[38;5;124m\"\u001B[39m: {\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 44\u001B[0m },\n\u001B[1;32m 45\u001B[0m }\n\u001B[1;32m 47\u001B[0m MaterialSchemaJSON \u001B[38;5;241m=\u001B[39m Dict[\u001B[38;5;28mstr\u001B[39m, Union[MaterialSchema, Any]]\n",
- "\u001B[0;31mModuleNotFoundError\u001B[0m: No module named 'mat3ra.esse.models'"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
@@ -149,12 +124,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "ExecuteTime": {
- "end_time": "2024-06-10T01:29:53.260590Z",
- "start_time": "2024-06-10T01:29:53.260439Z"
- }
- },
+ "metadata": {},
"outputs": [],
"source": [
"from utils.visualize import visualize_materials as visualize\n",
@@ -263,7 +233,7 @@
"original_energy = calculate_total_energy(interface, calculator)\n",
"relaxed_energy = calculate_total_energy(final_interface, calculator)\n",
"\n",
- "interfacial_energy = calculate_interfacial_energy(interface=final_interface, substrate_bulk=substrate, film_bulk=film, calculator=calculator)\n",
+ "interfacial_energy = calculate_interfacial_energy(interface=interface, calculator=calculator)\n",
"\n",
"# Print out the metrics\n",
"print(f\"Starting interface energy: {original_energy:.4f} eV\")\n",
From e0d23f28d57470ab114a290817a3deb0df43e677 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 14:13:01 -0700
Subject: [PATCH 22/33] update: add name
---
.../create_interface_with_relaxation_ase_emt.ipynb | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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 50314c1d..37212efa 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -232,8 +232,7 @@
"\n",
"original_energy = calculate_total_energy(interface, calculator)\n",
"relaxed_energy = calculate_total_energy(final_interface, calculator)\n",
- "\n",
- "interfacial_energy = calculate_interfacial_energy(interface=interface, calculator=calculator)\n",
+ "interfacial_energy = calculate_interfacial_energy(interface=final_interface, calculator=calculator)\n",
"\n",
"# Print out the metrics\n",
"print(f\"Starting interface energy: {original_energy:.4f} eV\")\n",
@@ -255,7 +254,7 @@
"outputs": [],
"source": [
"from utils.jupyterlite import set_data\n",
- "\n",
+ "final_interface.name = f\"{interface.name}, Relaxed with EMT\"\n",
"set_data(\"materials\", [final_interface.to_json()])"
],
"metadata": {
From 355959ccacd9bf1a92123a33b24db575566bd671 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 14:16:34 -0700
Subject: [PATCH 23/33] chore: update intro nb
---
other/materials_designer/Introduction.ipynb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index 896d15f1..aa70261a 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -17,9 +17,9 @@
"\n",
"This notebook lets user create an interface between two materials by finding matching superlattices and selecting optimal variants by (1) minimal strain and (2) minimal number of atoms. [Click here to open the notebook](create_interface_with_min_strain_zsl.ipynb).\n",
"\n",
- "#### [1.2. Relaxed interface creation with ZSL algorithm and EMT potential](create_interface_with_relaxation_ase_emt.ipynb)\n",
+ "#### [1.2. Relaxed interface creation with EMT potential](create_interface_with_relaxation_ase_emt.ipynb)\n",
"\n",
- "This notebook lets user create an interface between two materials and then relax it using the EMT potential. Interface creation is done in the same way as in the previous example, employing ZSL algorithm. [Click here to open the notebook](create_interface_with_relaxation_ase_emt.ipynb).\n",
+ "This notebook lets user relax an interface between two materials using the EMT potential. Interface material can be created using 1.2. notebook with ZSL algorithm or loaded from the database or a file. [Click here to open the notebook](create_interface_with_relaxation_ase_emt.ipynb).\n",
"\n",
"#### [1.3. Interface creation with a supercell matrix](create_interface_with_no_strain_matching.ipynb)\n",
"\n",
From fc68408b9b4c3fc7282a6c764daa2785d4f2be35 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 14:17:22 -0700
Subject: [PATCH 24/33] chore: numbering
---
.../create_interface_with_relaxation_ase_emt.ipynb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 37212efa..93b83da7 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -202,7 +202,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 5.3. View structure before and after relaxation"
+ "### 2.3. View structure before and after relaxation"
]
},
{
@@ -218,7 +218,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 5.4. Calculate energy using ASE EMT\n",
+ "### 2.4. Calculate energy using ASE EMT\n",
"The interfacial energy is the sum of the surface energies of the substrate and film minus the adhesion energy. According to Dupré's formula"
]
},
@@ -243,7 +243,7 @@
{
"cell_type": "markdown",
"source": [
- "## 6. Pass data to the outside runtime"
+ "## 3. Pass data to the outside runtime"
],
"metadata": {
"collapsed": false
From 98be2dc6045866d44a2c34bbf4131dfea812a9b4 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 16:50:42 -0700
Subject: [PATCH 25/33] update: fix typos and errors
---
...te_interface_with_relaxation_ase_emt.ipynb | 20 ++++++-------------
1 file changed, 6 insertions(+), 14 deletions(-)
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 93b83da7..7b4aef5c 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -6,15 +6,16 @@
"source": [
"\n",
"\n",
- "# Relax interface using EMT potentials\n",
+ "# Relax interface using EMT potential\n",
"\n",
- "Optimize atoms coordinates of the intgserface using the EMT (Effective Medium Theory) potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
+ "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
"\n",
"NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\",\n",
"\n",
"Usage
\n",
"\n",
- "1. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there.\n",
+ "2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
@@ -24,14 +25,7 @@
"## Summary\n",
"1. Prepare the Environment: Set up the notebook and install packages, preview the input materials\n",
"1. Perform relaxation of the interface with set parameters\n",
- "1. View the structure before and after relaxation\n",
- "\n",
- "## Notes\n",
- "1. We perform strain matching on the slabs to extract the supercell dimensions. The algorithm has a set of parameters, such as the maximum area considered.\n",
- "1. When the strain matching is finished, the interface with the lowest strain (and the smallest number of atoms) is selected. \n",
- "1. ZSL strain matching is performed using Pymatgen [implementation](https://pymatgen.org/pymatgen.analysis.interfaces.html#pymatgen.analysis.interfaces.zsl).\n",
- "1. For more information, see [Introduction](Introduction.ipynb)\n",
- "\n"
+ "1. View the structure before and after relaxation\n"
]
},
{
@@ -50,8 +44,6 @@
"cell_type": "code",
"outputs": [],
"source": [
- "# Enable interactive selection of terminations via UI prompt\n",
- "IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n",
"# Maximum force applied to atoms during relaxation\n",
"FMAX = 0.05"
],
@@ -254,7 +246,7 @@
"outputs": [],
"source": [
"from utils.jupyterlite import set_data\n",
- "final_interface.name = f\"{interface.name}, Relaxed with EMT\"\n",
+ "final_interface.name = f\"{interface.name}, Relaxed with EMT\" if \"Relaxed\" not in interface.name else interface.name\n",
"set_data(\"materials\", [final_interface.to_json()])"
],
"metadata": {
From 419fd6bbca8436400f81e35ccabacf46983e06b0 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 17:05:02 -0700
Subject: [PATCH 26/33] chore: rename
---
utils/plot.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/utils/plot.py b/utils/plot.py
index 84adfd0c..22801d2d 100644
--- a/utils/plot.py
+++ b/utils/plot.py
@@ -63,14 +63,18 @@ def create_realtime_plot():
def plot_update_callback(
- dyn: Union[BFGS, FIRE], ase_interface: ASEAtoms, fig: go.FigureWidget, steps: List[int], energies: List[int]
+ dynamic_object: Union[BFGS, FIRE],
+ ase_interface: ASEAtoms,
+ plotly_figure: go.FigureWidget,
+ steps: List[int],
+ energies: List[int],
):
"""
Callback function for updating energies for steps in real-time.
Args:
- dyn: The ASE dynamics object.
+ dynamic_object: The ASE dynamics object.
ase_interface: The ASE interface object.
- fig: The plotly figure widget.
+ plotly_figure: The plotly figure widget.
steps: The list of steps.
energies: The list of energies.
@@ -79,15 +83,15 @@ def plot_update_callback(
"""
def update():
- step = dyn.nsteps
+ step = dynamic_object.nsteps
energy = ase_interface.get_total_energy()
steps.append(step)
energies.append(energy)
print(f"Step: {step}, Energy: {energy:.4f} eV")
- with fig.batch_update():
- fig.data[0].x = steps
- fig.data[0].y = energies
+ with plotly_figure.batch_update():
+ plotly_figure.data[0].x = steps
+ plotly_figure.data[0].y = energies
return update
From e5f885fa620e964aec5754eba2a0c52b97f20a90 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 17:50:14 -0700
Subject: [PATCH 27/33] chore: add explanation
---
other/materials_designer/Introduction.ipynb | 5 +++--
.../create_interface_with_relaxation_ase_emt.ipynb | 5 ++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index aa70261a..4d269dfa 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -39,7 +39,8 @@
"\n",
"### 3.1. Passing Data to and from the Outside Runtime\n",
"The data is passed in *from* and *back to* the outside runtime (e.g. web application) using the `get_data` and `set_data` [helpers](../../utils/jupyterlite.py). The `get_data` function is used to retrieve the data from the outside runtime, while the `set_data` function is used to send the data back to the outside runtime.\n",
- "\n",
+ "\"Uploads\" folder is used to exchange files uploaded by the user and created by the notebook with other notebooks. When running JupyterLab (Python) locally, the files only get stored in the \"uploads\" folder and are not sent to the outside runtime. In JupyterLite (Pyodide) environment, the files are sent to the outside runtime and stored in the \"uploads\" folder.\n",
+ " \n",
"### 3.2. Specific Considerations\n",
"\n",
"#### 3.2.1. Interface creation\n",
@@ -47,7 +48,7 @@
"The following conventions are used in the interface creation examples:\n",
"\n",
"3. We assume that two input materials are either in bulk form (e.g. Ni crystal) or layered (e.g. graphene). \n",
- "1. We construct the interface along the Z-axis. The material corresponding to the bottom of the interface is referred to as the \"**substrate**\", and the top - as the \"**film**\". "
+ "1. We construct the interface along the Z-axis. The material corresponding to the bottom of the interface is referred to as the \"**substrate**\", and the top - as the \"**film**\". \n"
]
}
],
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 7b4aef5c..17473c8d 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -7,10 +7,9 @@
"\n",
"\n",
"# Relax interface using EMT potential\n",
+ "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS optimizer.\n",
"\n",
- "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS optimizer. The relaxation is performed to minimize the energy of the interface.\n",
- "\n",
- "NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\",\n",
+ "NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\n",
"\n",
"Usage
\n",
"\n",
From fbbcd947d0c30abc6447e1f63c9453a692473316 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:01:41 -0700
Subject: [PATCH 28/33] chore: adjust
---
other/materials_designer/Introduction.ipynb | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index 4d269dfa..1f1cbd0b 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -39,7 +39,8 @@
"\n",
"### 3.1. Passing Data to and from the Outside Runtime\n",
"The data is passed in *from* and *back to* the outside runtime (e.g. web application) using the `get_data` and `set_data` [helpers](../../utils/jupyterlite.py). The `get_data` function is used to retrieve the data from the outside runtime, while the `set_data` function is used to send the data back to the outside runtime.\n",
- "\"Uploads\" folder is used to exchange files uploaded by the user and created by the notebook with other notebooks. When running JupyterLab (Python) locally, the files only get stored in the \"uploads\" folder and are not sent to the outside runtime. In JupyterLite (Pyodide) environment, the files are sent to the outside runtime and stored in the \"uploads\" folder.\n",
+ "The **\"uploads\"** folder is used to exchange files between different notebooks when a user uploads a file, or when the notebook generates a file as part of its output.\n",
+ "When running JupyterLab (Python) locally, the files only get stored in the \"uploads\" folder and are not sent to the outside runtime. In JupyterLite (Pyodide) environment, the files are sent to the outside runtime and stored in the \"uploads\" folder.\n",
" \n",
"### 3.2. Specific Considerations\n",
"\n",
@@ -50,6 +51,14 @@
"3. We assume that two input materials are either in bulk form (e.g. Ni crystal) or layered (e.g. graphene). \n",
"1. We construct the interface along the Z-axis. The material corresponding to the bottom of the interface is referred to as the \"**substrate**\", and the top - as the \"**film**\". \n"
]
+ },
+ {
+ "cell_type": "code",
+ "outputs": [],
+ "source": [],
+ "metadata": {
+ "collapsed": false
+ }
}
],
"metadata": {
From 93367203c3d2c97abefb9f7e928d94a6f3c36d54 Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:41:28 -0700
Subject: [PATCH 29/33] update: add a link to data exchange
---
other/materials_designer/Introduction.ipynb | 10 ++++++----
.../create_interface_with_relaxation_ase_emt.ipynb | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index 1f1cbd0b..783e4cf5 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -35,15 +35,17 @@
"\n",
"This notebook demonstrates a workflow for converting materials data from the [JARVIS](https://jarvis.nist.gov/) database into ESSE format for use with Mat3ra.com platform. [Click here to open the notebook](import_material_from_jarvis_db_entry.ipynb).\n",
"\n",
- "## 3. Under the hood\n",
"\n",
- "### 3.1. Passing Data to and from the Outside Runtime\n",
+ "## 3. Under the hood\n",
+ "### 3.1. Data Exchange\n",
+ "#### 3.1.1. Passing Data to and from the Outside Runtime\n",
"The data is passed in *from* and *back to* the outside runtime (e.g. web application) using the `get_data` and `set_data` [helpers](../../utils/jupyterlite.py). The `get_data` function is used to retrieve the data from the outside runtime, while the `set_data` function is used to send the data back to the outside runtime.\n",
+ "\n",
+ "#### 3.1.2. Uploads Folder\n",
"The **\"uploads\"** folder is used to exchange files between different notebooks when a user uploads a file, or when the notebook generates a file as part of its output.\n",
"When running JupyterLab (Python) locally, the files only get stored in the \"uploads\" folder and are not sent to the outside runtime. In JupyterLite (Pyodide) environment, the files are sent to the outside runtime and stored in the \"uploads\" folder.\n",
- " \n",
- "### 3.2. Specific Considerations\n",
"\n",
+ "### 3.2. Specific Considerations\n",
"#### 3.2.1. Interface creation\n",
"\n",
"The following conventions are used in the interface creation examples:\n",
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 17473c8d..d05d6a02 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -13,7 +13,7 @@
"\n",
"Usage
\n",
"\n",
- "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there. [Data exchange](Introduction.ipynb#data-exchange) can be used to pass the material between the notebooks.\n",
"2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
From e6c07750278624cbe091bde3236c222469f04f6c Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 18:44:48 -0700
Subject: [PATCH 30/33] update: bump made
---
.../create_interface_with_relaxation_ase_emt.ipynb | 2 +-
pyproject.toml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 d05d6a02..4a693e81 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -13,7 +13,7 @@
"\n",
"Usage
\n",
"\n",
- "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there. [Data exchange](Introduction.ipynb#data-exchange) can be used to pass the material between the notebooks.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there. Read [Data exchange](Introduction.ipynb#data-exchange) for more details.\n",
"2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
"1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
diff --git a/pyproject.toml b/pyproject.toml
index 63b3dcf3..fefe2abb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,7 +10,7 @@ dependencies = [
"matplotlib>=3.4.1",
"pandas>=1.5.3",
"pymatgen>=2024.4.13",
- "mat3ra-made>=2024.6.3.post0",
+ "mat3ra-made>=2024.6.11.post0",
"mat3ra-utils>=2024.5.15.post0"
]
From 3426e4fb891db512d6eda6e0f772c5cf8d56194e Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 19:10:36 -0700
Subject: [PATCH 31/33] chore: cleanup
---
...reate_interface_with_relaxation_ase_emt.ipynb | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
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 4a693e81..7bea7f61 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -7,16 +7,15 @@
"\n",
"\n",
"# Relax interface using EMT potential\n",
- "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS optimizer.\n",
+ "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS.\n",
"\n",
"NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\n",
"\n",
"Usage
\n",
"\n",
- "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there. Read [Data exchange](Introduction.ipynb#data-exchange) for more details.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first. Upon completion, The resulting interface from it will be accessible in the current notebook as explained in [Data exchange](Introduction.ipynb#data-exchange).\n",
"2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
"1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
- "1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Wait for the run to complete (depending on the parameters can take a few min). \n",
"1. Scroll down to view results. \n",
@@ -24,16 +23,17 @@
"## Summary\n",
"1. Prepare the Environment: Set up the notebook and install packages, preview the input materials\n",
"1. Perform relaxation of the interface with set parameters\n",
- "1. View the structure before and after relaxation\n"
+ "1. View the structure before and after relaxation\n",
+ "\n",
+ "## Notes\n",
+ "1. More detailed relaxation parameters can be set in cell 2.1. "
]
},
{
"cell_type": "markdown",
"source": [
"## 1. Prepare the Environment\n",
- "### 1.1. Set up the notebook \n",
- "\n",
- "Set the following flags to control the notebook behavior "
+ "### 1.1. Set up the relaxation parameter\n"
],
"metadata": {
"collapsed": false
@@ -43,7 +43,7 @@
"cell_type": "code",
"outputs": [],
"source": [
- "# Maximum force applied to atoms during relaxation\n",
+ "# Maximum force tolerance for the relaxation to stop, in eV/Å\n",
"FMAX = 0.05"
],
"metadata": {
From 356464942e12cf29253492a7bda51ac789465b8c Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 19:10:36 -0700
Subject: [PATCH 32/33] chore: cleanup
---
...ate_interface_with_relaxation_ase_emt.ipynb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
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 4a693e81..576e82ed 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -7,16 +7,15 @@
"\n",
"\n",
"# Relax interface using EMT potential\n",
- "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS optimizer.\n",
+ "Optimize atoms coordinates of the interface using the EMT (Effective Medium Theory) potential and BFGS.\n",
"\n",
"NOTE: The [EMT potential](https://wiki.fysik.dtu.dk/ase/ase/calculators/emt.html) is available for a limited number of elements (Al, Cu, Ag, Au, Ni, Pd and Pt, as well as H, C, N, O in a limited way). If the interface contains elements not supported by EMT, the relaxation will not be performed.\n",
"\n",
"Usage
\n",
"\n",
- "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first and use the output material from there. Read [Data exchange](Introduction.ipynb#data-exchange) for more details.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first. Upon completion, The resulting interface from it will be accessible in the current notebook as explained in [Data exchange](Introduction.ipynb#data-exchange).\n",
"2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
- "1. Set notebook parameters in cell 1.1. below (or use the default values).\n",
- "1. Set relaxation parameters in cell 2.1. below (or use the default values).\n",
+ "1. Set the relaxation parameter in cell 1.1. below (or use the default value).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Wait for the run to complete (depending on the parameters can take a few min). \n",
"1. Scroll down to view results. \n",
@@ -24,16 +23,17 @@
"## Summary\n",
"1. Prepare the Environment: Set up the notebook and install packages, preview the input materials\n",
"1. Perform relaxation of the interface with set parameters\n",
- "1. View the structure before and after relaxation\n"
+ "1. View the structure before and after relaxation\n",
+ "\n",
+ "## Notes\n",
+ "1. More detailed relaxation parameters can be set in cell 2.1. "
]
},
{
"cell_type": "markdown",
"source": [
"## 1. Prepare the Environment\n",
- "### 1.1. Set up the notebook \n",
- "\n",
- "Set the following flags to control the notebook behavior "
+ "### 1.1. Set up the relaxation parameter\n"
],
"metadata": {
"collapsed": false
@@ -43,7 +43,7 @@
"cell_type": "code",
"outputs": [],
"source": [
- "# Maximum force applied to atoms during relaxation\n",
+ "# Maximum force tolerance for the relaxation to stop, in eV/Å\n",
"FMAX = 0.05"
],
"metadata": {
From 36a78220d1489b5dd76356081d7bb3e023445e5e Mon Sep 17 00:00:00 2001
From: VsevolodX <79542055+VsevolodX@users.noreply.github.com>
Date: Mon, 10 Jun 2024 19:17:40 -0700
Subject: [PATCH 33/33] chore: cleanup 3
---
other/materials_designer/Introduction.ipynb | 2 ++
.../create_interface_with_relaxation_ase_emt.ipynb | 3 +--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/other/materials_designer/Introduction.ipynb b/other/materials_designer/Introduction.ipynb
index 783e4cf5..bbf2b8d8 100644
--- a/other/materials_designer/Introduction.ipynb
+++ b/other/materials_designer/Introduction.ipynb
@@ -43,6 +43,8 @@
"\n",
"#### 3.1.2. Uploads Folder\n",
"The **\"uploads\"** folder is used to exchange files between different notebooks when a user uploads a file, or when the notebook generates a file as part of its output.\n",
+ "\n",
+ "#### 3.1.3. Passing Data between notebooks\n",
"When running JupyterLab (Python) locally, the files only get stored in the \"uploads\" folder and are not sent to the outside runtime. In JupyterLite (Pyodide) environment, the files are sent to the outside runtime and stored in the \"uploads\" folder.\n",
"\n",
"### 3.2. Specific Considerations\n",
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 576e82ed..b5a58f12 100644
--- a/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
+++ b/other/materials_designer/create_interface_with_relaxation_ase_emt.ipynb
@@ -13,8 +13,7 @@
"\n",
"Usage
\n",
"\n",
- "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first. Upon completion, The resulting interface from it will be accessible in the current notebook as explained in [Data exchange](Introduction.ipynb#data-exchange).\n",
- "2. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
+ "1. To get interface material one can run [Create Interface with Min Strain ZSL](create_interface_with_min_strain_zsl.ipynb) notebook first. Upon completion, the resulting interface from it will be accessible in the current notebook as explained in [Data exchange](Introduction.ipynb#data-exchange).\n",
"1. Set the relaxation parameter in cell 1.1. below (or use the default value).\n",
"1. Click “Run” > “Run All” to run all cells. \n",
"1. Wait for the run to complete (depending on the parameters can take a few min). \n",