Skip to content

Commit 2a91308

Browse files
authored
Merge pull request #283 from Exabyte-io/feature/SOF-7868
feature/SOF-7868
2 parents 7f938a7 + 73a5040 commit 2a91308

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

other/materials_designer/create_slab.ipynb

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Create a slab with specified termination\n",
99
"\n",
10-
"Create a slab with a specified termination from a bulk material. \n",
10+
"Create one or multiple slabs with a specified termination and thickness from a bulk material.\n",
1111
"\n",
1212
"<h2 style=\"color:green\">Usage</h2>\n",
1313
"\n",
@@ -46,6 +46,7 @@
4646
"\n",
4747
"MILLER_INDICES = (0, 0, 1)\n",
4848
"THICKNESS = 3 # in atomic layers\n",
49+
"THICKNESSES = [] # for multiple slabs with different thicknesses, e.g., [3, 5, 7]\n",
4950
"VACUUM = 10.0 # in angstroms\n",
5051
"XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n",
5152
"USE_ORTHOGONAL_C = True\n",
@@ -257,15 +258,20 @@
257258
"source": [
258259
"from mat3ra.made.tools.helpers import create_slab\n",
259260
"\n",
260-
"slab = create_slab(crystal=material,\n",
261-
" termination_top=termination,\n",
262-
" use_conventional_cell=USE_CONVENTIONAL_CELL,\n",
263-
" miller_indices=MILLER_INDICES,\n",
264-
" number_of_layers= THICKNESS,\n",
265-
" vacuum=VACUUM,\n",
266-
" xy_supercell_matrix=XY_SUPERCELL_MATRIX,\n",
267-
" use_orthogonal_c=USE_ORTHOGONAL_C,\n",
268-
" )\n"
261+
"slabs = []\n",
262+
"thicknesses = THICKNESSES if THICKNESSES else [THICKNESS]\n",
263+
"for thickness in thicknesses:\n",
264+
" slab = create_slab(crystal=material,\n",
265+
" termination_top=termination,\n",
266+
" use_conventional_cell=USE_CONVENTIONAL_CELL,\n",
267+
" miller_indices=MILLER_INDICES,\n",
268+
" number_of_layers=thickness,\n",
269+
" vacuum=VACUUM,\n",
270+
" xy_supercell_matrix=XY_SUPERCELL_MATRIX,\n",
271+
" use_orthogonal_c=USE_ORTHOGONAL_C,\n",
272+
" )\n",
273+
" slab.name += f\" {thickness}L\"\n",
274+
" slabs.append(slab)"
269275
]
270276
},
271277
{
@@ -283,7 +289,7 @@
283289
"metadata": {},
284290
"outputs": [],
285291
"source": [
286-
"visualize(slab, repetitions=[1, 1, 1], rotation=\"0x\")"
292+
"visualize(slabs, repetitions=[1, 1, 1], rotation=\"0x\")"
287293
]
288294
},
289295
{
@@ -302,7 +308,7 @@
302308
"outputs": [],
303309
"source": [
304310
"from utils.jupyterlite import set_materials\n",
305-
"set_materials(slab)"
311+
"set_materials(slabs)"
306312
]
307313
}
308314
],

0 commit comments

Comments
 (0)