-
Notifications
You must be signed in to change notification settings - Fork 5
update/SOF 7461 #145
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
update/SOF 7461 #145
Changes from all commits
69b32c4
76eb126
4cb5be5
156484f
2f704bb
fb09f3e
6574a94
5db5512
573e28a
33054f5
bbfe34a
ab35b2c
212013c
eba39d6
00a41d6
9ee963c
9696cc8
eefdaa9
1746904
da5a796
5625fb8
affd484
8fa789e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,8 +50,27 @@ | |
| "source": [ | ||
|
Member
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 #8. print("Please select a film material. Film is set to substrate.")
Film material not found. Re-using substrate material as film. Reply via ReviewNB
Member
Author
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. ok |
||
| "# Enable interactive selection of terminations via UI prompt\n", | ||
| "IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n", | ||
| "\n", | ||
| "FILM_INDEX = 1 # Index in the list of materials, to access as materials[FILM_INDEX]\n", | ||
| "FILM_MILLER_INDICES = (0, 0, 1)\n", | ||
| "FILM_THICKNESS = 1 # in atomic layers\n", | ||
| "FILM_VACUUM = 0.0 # in angstroms\n", | ||
| "FILM_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", | ||
| "FILM_USE_ORTHOGONAL_Z = True\n", | ||
| "\n", | ||
| "SUBSTRATE_INDEX = 0\n", | ||
| "SUBSTRATE_MILLER_INDICES = (1, 1, 1)\n", | ||
| "SUBSTRATE_THICKNESS = 3 # in atomic layers\n", | ||
| "SUBSTRATE_VACUUM = 3.0 # in angstroms\n", | ||
| "SUBSTRATE_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", | ||
| "SUBSTRATE_USE_ORTHOGONAL_Z = True\n", | ||
| "\n", | ||
| "# Maximum area for the superlattice search algorithm\n", | ||
| "MAX_AREA = 50" | ||
| "MAX_AREA = 50 # in Angstrom^2\n", | ||
| "# Set the termination pair indices\n", | ||
| "TERMINATION_PAIR_INDEX = 0 # Will be overridden in interactive selection is used\n", | ||
| "INTERFACE_DISTANCE = 3.0 # in Angstrom\n", | ||
| "INTERFACE_VACUUM = 20.0 # in Angstrom" | ||
| ], | ||
| "metadata": { | ||
| "collapsed": false | ||
|
|
@@ -76,6 +95,7 @@ | |
| "\n", | ||
| "if sys.platform == \"emscripten\":\n", | ||
| " import micropip\n", | ||
| " \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\")" | ||
|
|
@@ -97,14 +117,15 @@ | |
| "cell_type": "code", | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.made.material import Material\n", | ||
| "from utils.jupyterlite import get_data\n", | ||
| "from utils.jupyterlite import get_materials\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", | ||
| "substrate = materials[0]\n", | ||
| "film = materials[1]" | ||
| "materials = get_materials(globals())\n", | ||
| "substrate = materials[SUBSTRATE_INDEX]\n", | ||
| "try: \n", | ||
| " film = materials[FILM_INDEX]\n", | ||
| "except IndexError:\n", | ||
| " print(\"Film material not found. Re-using substrate material as film.\")\n", | ||
| " film = substrate" | ||
| ], | ||
| "metadata": { | ||
| "collapsed": false | ||
|
|
@@ -151,20 +172,20 @@ | |
| "\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", | ||
| " miller_indices=FILM_MILLER_INDICES,\n", | ||
| " thickness=FILM_THICKNESS, # in atomic layers\n", | ||
| " vacuum=FILM_VACUUM, # in angstroms\n", | ||
| " xy_supercell_matrix=FILM_XY_SUPERCELL_MATRIX,\n", | ||
| " use_orthogonal_z=FILM_USE_ORTHOGONAL_Z\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", | ||
| " miller_indices=SUBSTRATE_MILLER_INDICES,\n", | ||
| " thickness=SUBSTRATE_THICKNESS, # in atomic layers\n", | ||
| " vacuum=SUBSTRATE_VACUUM, # in angstroms\n", | ||
| " xy_supercell_matrix=SUBSTRATE_XY_SUPERCELL_MATRIX,\n", | ||
| " use_orthogonal_z=SUBSTRATE_USE_ORTHOGONAL_Z\n", | ||
| ")" | ||
| ], | ||
| "metadata": {}, | ||
|
|
@@ -255,10 +276,9 @@ | |
| "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", | ||
| "termination_pair_index = TERMINATION_PAIR_INDEX\n", | ||
| "\n", | ||
| "termination_pair = termination_pairs[TERMINATION_PAIR_INDEX]\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", | ||
|
|
@@ -293,8 +313,8 @@ | |
| " substrate_configuration=substrate_slab_configuration,\n", | ||
| " film_termination=film_termination,\n", | ||
| " substrate_termination=substrate_termination,\n", | ||
| " distance=3.0, # in Angstrom\n", | ||
| " vacuum=20.0 # in Angstrom\n", | ||
| " distance=INTERFACE_DISTANCE,\n", | ||
| " vacuum= INTERFACE_VACUUM\n", | ||
| ")" | ||
| ], | ||
| "metadata": { | ||
|
|
@@ -437,10 +457,8 @@ | |
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from utils.jupyterlite import set_data\n", | ||
| "\n", | ||
| "materials_as_json = [selected_interface.to_json() for selected_interface in selected_interfaces]\n", | ||
| "set_data(\"materials\", materials_as_json)" | ||
| "from utils.jupyterlite import set_materials\n", | ||
| "set_materials(selected_interfaces)" | ||
| ] | ||
| } | ||
| ], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,26 @@ | |
| "# Enable interactive selection of terminations via UI prompt\n", | ||
|
Member
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 #21. TERMINATION_PAIR_INDEX = 0 TERMINATION_PAIR_INDEX # Will be overriden in interactive selection is used Reply via ReviewNB
Member
Author
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. ok |
||
| "IS_TERMINATIONS_SELECTION_INTERACTIVE = False \n", | ||
| "# Enable scaling of the film slab atomic coordinates to match the substrate lattice (preserve coordinates in crystal units).\n", | ||
| "ENABLE_FILM_SCALING = True" | ||
| "ENABLE_FILM_SCALING = True\n", | ||
| "\n", | ||
| "FILM_INDEX = 1\n", | ||
| "FILM_MILLER_INDICES = (0, 0, 1)\n", | ||
| "FILM_THICKNESS = 1 # in atomic layers\n", | ||
| "FILM_VACUUM = 0.0 # in angstroms\n", | ||
| "FILM_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", | ||
| "FILM_USE_ORTHOGONAL_Z = True\n", | ||
| "\n", | ||
| "SUBSTRATE_INDEX = 0\n", | ||
| "SUBSTRATE_MILLER_INDICES = (1, 1, 1)\n", | ||
| "SUBSTRATE_THICKNESS = 3 # in atomic layers\n", | ||
| "SUBSTRATE_VACUUM = 3.0 # in angstroms\n", | ||
| "SUBSTRATE_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", | ||
| "SUBSTRATE_USE_ORTHOGONAL_Z = True\n", | ||
| "\n", | ||
| "# Set the termination pair indices\n", | ||
| "TERMINATION_PAIR_INDEX = 0 # Will be overridden in interactive selection is used\n", | ||
| "INTERFACE_DISTANCE = 3.0 # in Angstrom\n", | ||
| "INTERFACE_VACUUM = 20.0 # in Angstrom" | ||
| ], | ||
| "metadata": { | ||
| "collapsed": false | ||
|
|
@@ -92,14 +111,15 @@ | |
| "cell_type": "code", | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.made.material import Material\n", | ||
| "from utils.jupyterlite import get_data\n", | ||
| "from utils.jupyterlite import get_materials\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", | ||
| "substrate = materials[0]\n", | ||
| "film = materials[1]" | ||
| "materials = get_materials(globals())\n", | ||
| "substrate = materials[SUBSTRATE_INDEX]\n", | ||
| "try: \n", | ||
| " film = materials[FILM_INDEX]\n", | ||
| "except IndexError:\n", | ||
| " print(\"Please select a film material. Film is set to substrate.\")\n", | ||
| " film = substrate" | ||
| ], | ||
| "metadata": { | ||
| "collapsed": false | ||
|
|
@@ -148,20 +168,20 @@ | |
| "\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", | ||
| " miller_indices=FILM_MILLER_INDICES,\n", | ||
| " thickness=FILM_THICKNESS, # in atomic layers\n", | ||
| " vacuum=FILM_VACUUM, # in angstroms\n", | ||
| " xy_supercell_matrix=FILM_XY_SUPERCELL_MATRIX,\n", | ||
| " use_orthogonal_z=FILM_USE_ORTHOGONAL_Z\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", | ||
| " miller_indices=SUBSTRATE_MILLER_INDICES,\n", | ||
| " thickness=SUBSTRATE_THICKNESS, # in atomic layers\n", | ||
| " vacuum=SUBSTRATE_VACUUM, # in angstroms\n", | ||
| " xy_supercell_matrix=SUBSTRATE_XY_SUPERCELL_MATRIX,\n", | ||
| " use_orthogonal_z=SUBSTRATE_USE_ORTHOGONAL_Z\n", | ||
| ")" | ||
| ], | ||
| "metadata": { | ||
|
|
@@ -206,8 +226,8 @@ | |
| "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\") " | ||
| "visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in film_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\")\n", | ||
| "visualize([{\"material\":slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in substrate_slabs ], repetitions=[3, 3, 1], rotation=\"-90x\") " | ||
| ], | ||
| "metadata": { | ||
| "collapsed": false | ||
|
|
@@ -255,10 +275,9 @@ | |
| "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", | ||
| "termination_pair_index = TERMINATION_PAIR_INDEX\n", | ||
| "\n", | ||
| "termination_pair = termination_pairs[TERMINATION_PAIR_INDEX]\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", | ||
|
|
@@ -293,6 +312,8 @@ | |
| " substrate_configuration=substrate_slab_configuration,\n", | ||
| " film_termination=film_termination,\n", | ||
| " substrate_termination=substrate_termination,\n", | ||
| " interface_distance=INTERFACE_DISTANCE, # in Angstrom\n", | ||
| " interface_vacuum=INTERFACE_VACUUM # in Angstrom\n", | ||
| ")\n", | ||
| "\n", | ||
| "interface = create_interface(interface_configuration)" | ||
|
|
@@ -355,9 +376,8 @@ | |
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from utils.jupyterlite import set_data\n", | ||
| "\n", | ||
| "set_data(\"materials\", [interface.to_json()])" | ||
| "from utils.jupyterlite import set_materials\n", | ||
| "set_materials(interface)" | ||
| ] | ||
| } | ||
| ], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
FILM_INDEX = 1 # Index in the list of materials, to access as materials[FILM_INDEX]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.
ok