Skip to content

Commit df96679

Browse files
committed
update: interfaces nb
1 parent ab821b9 commit df96679

File tree

3 files changed

+56
-224
lines changed

3 files changed

+56
-224
lines changed

other/materials_designer/create_interface_with_min_strain_zsl.ipynb

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"source": [
5151
"from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
5252
"\n",
53-
"\n",
5453
"# Enable interactive selection of terminations via UI prompt\n",
5554
"IS_TERMINATIONS_SELECTION_INTERACTIVE = False\n",
5655
"\n",
@@ -70,19 +69,23 @@
7069
"SUBSTRATE_XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n",
7170
"SUBSTRATE_USE_ORTHOGONAL_C = True\n",
7271
"\n",
72+
"INTERFACE_DISTANCE = 3.0 # Gap between substrate and film, in Angstrom\n",
73+
"INTERFACE_VACUUM = 10.0 # Vacuum over film, in Angstrom\n",
74+
"\n",
7375
"# Whether to convert materials to conventional cells before creating slabs.\n",
7476
"# To create interfaces with smaller cells, set this flag to False. (and pass already conventional cells as input)\n",
7577
"USE_CONVENTIONAL_CELL = True\n",
7678
"\n",
77-
"# Maximum area for the superlattice search algorithm\n",
78-
"MAX_AREA = 50 # in Angstrom^2\n",
79+
"# Maximum area for the superlattice search algorithm (the final interface area will be smaller)\n",
80+
"MAX_AREA = 150 # in Angstrom^2\n",
7981
"# Additional fine-tuning parameters (increase values to get more strained matches):\n",
8082
"MAX_AREA_TOLERANCE = 0.09 # in Angstrom^2\n",
81-
"MAX_ANGLE_TOLERANCE = 0.03\n",
82-
"MAX_LENGTH_TOLERANCE = 0.03\n",
83+
"MAX_LENGTH_TOLERANCE = 0.05\n",
84+
"MAX_ANGLE_TOLERANCE = 0.02\n",
8385
"\n",
84-
"INTERFACE_DISTANCE = 3.0 # in Angstrom\n",
85-
"INTERFACE_VACUUM = 20.0 # in Angstrom"
86+
"# Whether to reduce the resulting interface cell to the primitive cell after the interface creation.\n",
87+
"# If the reduction causes unexpected results, try increasing the `MAX_AREA` for search.\n",
88+
"REDUCE_RESULT_CELL_TO_PRIMITIVE = True"
8689
],
8790
"outputs": [],
8891
"execution_count": null
@@ -203,16 +206,16 @@
203206
},
204207
"cell_type": "code",
205208
"source": [
206-
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
209+
"from mat3ra.made.tools.build.slab.helpers import create_slab\n",
207210
"from mat3ra.made.tools.build.interface.helpers import create_zsl_interface_between_slabs\n",
208211
"from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
209212
"\n",
210-
"film_analyzer = CrystalLatticePlanesMaterialAnalyzer(material=film, miller_indices=FILM_MILLER_INDICES)\n",
211-
"film_slabs = [film_analyzer.get_material_with_termination_without_vacuum(termination) for termination in\n",
213+
"film_slabs = [create_slab(film, miller_indices=FILM_MILLER_INDICES, termination=termination, vacuum=0) for termination\n",
214+
" in\n",
212215
" film_slab_terminations]\n",
213216
"\n",
214-
"substrate_analyzer = CrystalLatticePlanesMaterialAnalyzer(material=substrate, miller_indices=SUBSTRATE_MILLER_INDICES)\n",
215-
"substrate_slabs = [substrate_analyzer.get_material_with_termination_without_vacuum(termination) for termination in\n",
217+
"substrate_slabs = [create_slab(substrate, miller_indices=SUBSTRATE_MILLER_INDICES, termination=termination, vacuum=0)\n",
218+
" for termination in\n",
216219
" substrate_slab_terminations]\n",
217220
"\n",
218221
"film_slabs_with_titles = [{\"material\": slab, \"title\": str(termination)} for slab, termination in\n",
@@ -293,15 +296,15 @@
293296
"cell_type": "code",
294297
"source": [
295298
"from mat3ra.made.tools.analyze.interface import ZSLInterfaceAnalyzer\n",
296-
"from mat3ra.made.tools.build.slab.configurations import SlabConfiguration\n",
297299
"\n",
298300
"zsl_analyzer = ZSLInterfaceAnalyzer(\n",
299301
" substrate_slab_configuration=substrate_slab_config,\n",
300302
" film_slab_configuration=film_slab_config,\n",
301303
" max_area=MAX_AREA,\n",
302304
" max_area_ratio_tol=MAX_AREA_TOLERANCE,\n",
305+
" max_length_tol=MAX_LENGTH_TOLERANCE,\n",
303306
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
304-
" max_length_tol=MAX_LENGTH_TOLERANCE\n",
307+
" reduce_result_cell=False # Reduces supercell matrices in analyzer\n",
305308
")"
306309
],
307310
"outputs": [],
@@ -393,6 +396,10 @@
393396
" vacuum=INTERFACE_VACUUM,\n",
394397
" match_id=selected_index,\n",
395398
" max_area=MAX_AREA,\n",
399+
" max_area_ratio_tol=MAX_AREA_TOLERANCE,\n",
400+
" max_length_tol=MAX_LENGTH_TOLERANCE,\n",
401+
" max_angle_tol=MAX_ANGLE_TOLERANCE,\n",
402+
" reduce_result_cell_to_primitive=REDUCE_RESULT_CELL_TO_PRIMITIVE,\n",
396403
")"
397404
],
398405
"outputs": [],
@@ -410,8 +417,8 @@
410417
{
411418
"cell_type": "code",
412419
"source": [
413-
"visualize(interface, repetitions=[3, 3, 1])\n",
414-
"visualize(interface, repetitions=[3, 3, 1], rotation=\"-90x\")"
420+
"visualize(interface, repetitions=[1, 1, 1])\n",
421+
"visualize(interface, repetitions=[1, 1, 1], rotation=\"-90x\")"
415422
],
416423
"metadata": {
417424
"collapsed": false

0 commit comments

Comments
 (0)