-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/SOF-7347 update: use interface settings as class + add metadata to interface #124
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9824dd3
chore: bump made
VsevolodX b4624ef
chore: use interface settings as class and restructure cells
VsevolodX 3244b8a
update: enrich names with strain
VsevolodX 47a9844
chore: import made from github
VsevolodX 39fc280
update: showcase two ways of setting the properties
VsevolodX 330da1a
Merge branch 'feature/SOF-7352' into feature/SOF-7347
VsevolodX 48ae117
chore: fix a mistake
VsevolodX 65278c8
chore: fix a mistake 2
VsevolodX 46e0687
chore: adjust description
VsevolodX c1f12f7
update: update settings usage
VsevolodX 3573c7c
update: adjust to new settings
VsevolodX d6ecf39
chore: import made from github
VsevolodX 4d989ad
chore: import made from github
VsevolodX 2079b2b
chore: import made from github
VsevolodX 80ae298
Merge branch 'dev' into feature/SOF-7347
VsevolodX dc2f833
chore: import made from github
VsevolodX 82e9c7a
chore: update imports
VsevolodX 9062c82
udpate: we need to move installation atop so mat3ra-made is avalialbe
VsevolodX dd40384
chore: minor adjustemtns
VsevolodX 0736110
chore: minor adjustemtns
VsevolodX 70a25e6
chore: minor adjustemtns 2
VsevolodX File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
"<h2 style=\"color:green\">Usage</h2>\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line #5. distance_z=3.0, # distance between two planes, in Angstroms distance between substrate and layer Reply via ReviewNB |
||
"\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. 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 +32,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 +74,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 two planes, 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 +167,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 +221,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 +235,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 +340,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 +352,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)" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify whether termination selection is done
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smth like: Choose the termination selection mode: interactive with prompt or by index in the code ?