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 71fddb1e..4509c883 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,8 @@
"
Usage
\n",
"\n",
"1. Make sure to select Input Materials\n",
- "2. Set Input Parameters (e.g. `MILLER_INDICES`, `THICKNESS`, `MAX_AREA`) below or use the default values\n",
+ "2. Set Interface 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",
"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",
@@ -32,62 +33,40 @@
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
- "## 1. Set Input Parameters\n",
- "\n",
- "### 1.1. Set Substrate and Layer Parameters \n",
- "Additionally, specify if the termination selection is done using interactive prompt, or the via selecting the termination index in the code."
- ]
+ "## 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",
- "execution_count": null,
- "metadata": {},
"outputs": [],
"source": [
- "SUBSTRATE_PARAMETERS = {\n",
- " \"MILLER_INDICES\": (1, 1, 1), # the miller indices of the interfacial plane\n",
- " \"THICKNESS\": 3, # in layers\n",
- "}\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",
- "USE_CONVENTIONAL_CELL = True # if True, the surface plane is constructed using miller indices of the conventional cell\n",
+ "import sys\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"
- ]
+ "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
+ },
+ "execution_count": null
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 1.2. Set Interface Parameters\n",
+ "## 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": [
- "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"
+ "### 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."
]
},
{
@@ -96,46 +75,50 @@
"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",
+ "from mat3ra.made.tools.build.interface import InterfaceSettings\n",
+ "\n",
+ "# Parameters can be set during the class initialization:\n",
+ "interface_builder_settings = InterfaceSettings(\n",
+ " distance_z=3.0, # distance between substrate and layer, in Angstroms\n",
+ " use_conventional_cell=True, # if True, the surface plane is constructed using miller indices of the conventional cell\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",
- "}"
+ "# Parameters can be set after the initialization:\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 = 3 # 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"
]
},
{
"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."
- ]
+ "### 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",
- "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\")"
- ]
+ "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",
+ ")"
+ ],
+ "metadata": {
+ "collapsed": false
+ },
+ "execution_count": null
},
{
"cell_type": "markdown",
@@ -185,7 +168,7 @@
"interface_builder = init_interface_builder(\n",
" substrate=materials[0],\n",
" layer=materials[1],\n",
- " settings=interface_settings\n",
+ " settings=interface_builder_settings\n",
")"
],
"metadata": {
@@ -239,7 +222,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",
@@ -254,7 +236,7 @@
{
"cell_type": "markdown",
"source": [
- "### 4.3. Print out interface with the lowest strain for selected termination"
+ "### 4.4. Print out interface with the lowest strain for selected termination"
],
"metadata": {
"collapsed": false
@@ -359,7 +341,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### 6.3. Pass data to the outside runtime"
+ "### 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."
]
},
{
@@ -370,6 +353,10 @@
"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)"
]
}
diff --git a/pyproject.toml b/pyproject.toml
index f4be201d..07722cd9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,8 +10,8 @@ dependencies = [
"matplotlib>=3.4.1",
"pandas>=1.5.3",
"pymatgen>=2024.4.13",
- "mat3ra-made>=2024.5.9.post0",
- "mat3ra-utils"
+ "mat3ra-made>=2024.5.15.post1",
+ "mat3ra-utils>=2024.5.15.post0"
]
[project.optional-dependencies]