Skip to content

Commit

Permalink
update: fix to work
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed May 7, 2024
1 parent 8e42582 commit 22d7e48
Showing 1 changed file with 37 additions and 113 deletions.
150 changes: 37 additions & 113 deletions other/materials_designer/create_interface_with_min_strain_zsl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"ExecuteTime": {
"end_time": "2024-05-07T04:17:12.083949Z",
"start_time": "2024-05-07T04:17:12.043150Z"
}
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"SUBSTRATE_PARAMETERS = {\n",
Expand Down Expand Up @@ -76,13 +71,8 @@
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"ExecuteTime": {
"end_time": "2024-05-07T04:17:12.094333Z",
"start_time": "2024-05-07T04:17:12.087322Z"
}
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"INTERFACE_PARAMETERS = {\n",
Expand All @@ -100,13 +90,8 @@
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"ExecuteTime": {
"end_time": "2024-05-07T04:17:12.105360Z",
"start_time": "2024-05-07T04:17:12.097261Z"
}
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ZSL_PARAMETERS = {\n",
Expand Down Expand Up @@ -137,13 +122,8 @@
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"ExecuteTime": {
"end_time": "2024-05-07T04:17:12.122771Z",
"start_time": "2024-05-07T04:17:12.102982Z"
}
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -166,32 +146,7 @@
},
{
"cell_type": "code",
"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 3-WS2 has been read successfully.\n",
"Data from 4-BN has been read successfully.\n",
"Data from 4-Te2Mo has been read successfully.\n",
"Data from Te14 Mo7 W9 S18 has been read successfully.\n"
]
},
{
"data": {
"text/plain": "GridBox(children=(VBox(children=(Label(value='Ni - Material 0', layout=Layout(height='30px', overflow='hidden'…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "bd08c3ed6c384881a93079e69a2969fb"
}
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"from mat3ra.made.material import Material\n",
"from utils.jupyterlite import get_data\n",
Expand All @@ -204,13 +159,9 @@
"visualize(materials, repetitions=[1, 1, 1], rotation=\"0x\")"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-05-07T04:17:12.374199Z",
"start_time": "2024-05-07T04:17:12.107671Z"
}
"collapsed": false
},
"execution_count": 26
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -237,13 +188,9 @@
" )"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-05-07T04:17:15.918278Z",
"start_time": "2024-05-07T04:17:12.403426Z"
}
"collapsed": false
},
"execution_count": 27
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -256,15 +203,7 @@
},
{
"cell_type": "code",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Selected termination: ('BN_P-6m2_2', 'S_P6/mmm_9')\n"
]
}
],
"outputs": [],
"source": [
"terminations = interface_builder.terminations\n",
"\n",
Expand All @@ -289,27 +228,28 @@
" print(\"Selected termination: \", selected_termination)\n",
" return selected_termination\n",
"\n",
"selected_termination_index = select_termination() if IS_TERMINATION_SELECTION_INTERACTIVE else DEFAULT_TERMINATION_INDEX"
"selected_termination = select_termination() if IS_TERMINATION_SELECTION_INTERACTIVE else DEFAULT_TERMINATION_INDEX"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-05-07T04:17:18.431581Z",
"start_time": "2024-05-07T04:17:15.836755Z"
}
"collapsed": false
},
"execution_count": 28
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### 4.3. Create interfaces for the selected termination"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [],
"trusted": true,
"is_executing": true,
"ExecuteTime": {
"start_time": "2024-05-07T04:17:18.381788Z"
}
"trusted": true
},
"outputs": [],
"source": [
Expand All @@ -318,38 +258,29 @@
"interface_data_holder = create_interfaces(\n",
" substrate=materials[5],\n",
" layer=materials[3],\n",
" 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",
" },\n",
" settings=interface_settings,\n",
" sort_by_strain_and_size=True,\n",
" remove_duplicates=True,\n",
" interface_builder=interface_builder,\n",
" selected_termination=selected_termination_index,\n",
" selected_termination=selected_termination,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4.3. Print out interfaces with the lowest strain for selected termination"
"### 4.3. Print out interface with the lowest strain for selected termination"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"is_executing": true
},
"metadata": {},
"outputs": [],
"source": [
"termination = interface_data_holder.terminations[selected_termination_index]\n",
"print(f\"Interface with lowest strain for termination {termination} (index 0):\")\n",
"interfaces = interface_data_holder.get_interfaces_for_termination(termination)\n",
"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)"
Expand All @@ -367,9 +298,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"is_executing": true
},
"metadata": {},
"outputs": [],
"source": [
"from utils.plot import plot_strain_vs_atoms\n",
Expand Down Expand Up @@ -399,9 +328,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"is_executing": true
},
"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",
Expand Down Expand Up @@ -430,8 +357,7 @@
"visualize(selected_interfaces, repetitions=[1, 1, 1], rotation=\"-90x\")"
],
"metadata": {
"collapsed": false,
"is_executing": true
"collapsed": false
},
"execution_count": null
},
Expand All @@ -445,9 +371,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"is_executing": true
},
"metadata": {},
"outputs": [],
"source": [
"from utils.jupyterlite import set_data\n",
Expand Down

0 comments on commit 22d7e48

Please sign in to comment.