Skip to content

Commit

Permalink
Merge branch 'feature/SOF-7352' into feature/SOF-7347
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed May 10, 2024
2 parents 9824dd3 + 39fc280 commit 330da1a
Showing 1 changed file with 42 additions and 58 deletions.
100 changes: 42 additions & 58 deletions other/materials_designer/create_interface_with_min_strain_zsl.ipynb
Expand Up @@ -34,9 +34,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Set Input Parameters\n",
"## 1. Set Interface Parameters\n",
"\n",
"### 1.1. Set Substrate and Layer Parameters "
"### 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."
]
},
{
Expand All @@ -45,73 +47,50 @@
"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",
"from mat3ra.made.tools.build.interface import InterfaceSettings\n",
"\n",
"LAYER_PARAMETERS = {\n",
" \"MILLER_INDICES\": (0, 0, 1), # the miller indices of the interfacial plane\n",
" \"THICKNESS\": 1, # in layers\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",
"\n",
"USE_CONVENTIONAL_CELL = True # if True, the surface plane is constructed using miller indices of the conventional cell\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",
"\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": [
"### 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": [
"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"
]
"### 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
}
},
{
"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",
"}"
]
"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
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -182,8 +161,8 @@
"from mat3ra.made.tools.build import init_interface_builder\n",
"\n",
"interface_builder = init_interface_builder(\n",
" materials[0],\n",
" materials[1],\n",
" substrate=materials[0],\n",
" layer=materials[1],\n",
" settings=interface_settings\n",
")"
],
Expand Down Expand Up @@ -358,7 +337,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 6.3. Pass data to the outside runtime\n"
"### 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."
]
},
{
Expand All @@ -369,7 +349,11 @@
"source": [
"from utils.jupyterlite import set_data\n",
"\n",
"set_data(\"materials\", selected_interfaces)"
"names = [f'{interface[\"name\"]}, Interface, Strain:{interface[\"metadata\"][\"interface_properties\"][\"mean_abs_strain\"]*100:.3f}%' for interface in selected_interfaces]\n",
"\n",
"named_selected_interfaces = [{\"name\": name, \"interface\": interface} for name, interface in zip(names, selected_interfaces)]\n",
"\n",
"set_data(\"materials\", named_selected_interfaces)"
]
}
],
Expand Down

0 comments on commit 330da1a

Please sign in to comment.