Skip to content

Commit ef30bc3

Browse files
authored
Merge pull request #337 from mat3ra/feat/SOF-7938
Feat/sof 7938
2 parents c950fa1 + b249843 commit ef30bc3

5 files changed

Lines changed: 784 additions & 24 deletions

File tree

other/materials_designer/workflows/band_structure.ipynb

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,19 @@
118118
"\n",
119119
"# K-grids and k-path\n",
120120
"RELAXATION_KGRID = None # e.g. [4, 4, 4]\n",
121-
"SCF_KGRID = None # e.g. [8, 8, 8]\n",
122-
"NSCF_KGRID = None # e.g. [12, 12, 12] — used for band_structure_dos\n",
123-
"KPATH = [{\"point\": \"Г\", \"steps\": 10}, {\"point\": \"M\", \"steps\": 10}, {\"point\": \"K\", \"steps\": 10}, {\"point\": \"Г\", \"steps\": 10}] # e.g. [{\"point\": \"Г\", \"steps\": 10}, {\"point\": \"M\", \"steps\": 10}, {\"point\": \"K\", \"steps\": 10}, {\"point\": \"Г\", \"steps\": 10}]\n",
121+
"SCF_KGRID = None # e.g. [8, 8, 8]\n",
122+
"NSCF_KGRID = None # e.g. [12, 12, 12] — used for band_structure_dos\n",
123+
"KPATH = None # [{\"point\": \"Г\", \"steps\": 10}, {\"point\": \"M\", \"steps\": 10}, {\"point\": \"K\", \"steps\": 10}, {\"point\": \"Г\", \"steps\": 10}]\n",
124124
"\n",
125125
"# Energy cutoffs\n",
126126
"ECUTWFC = 40\n",
127-
"ECUTRHO = 200"
127+
"ECUTRHO = 200\n",
128+
"\n",
129+
"# Additional QE input parameters per unit\n",
130+
"# Format: {\"unit_name\": {\"namelist\": {\"parameter\": value}}}\n",
131+
"ADDITIONAL_PARAMETERS = {\n",
132+
" # \"pw_nscf\": {\"system\": {\"occupations\": \"tetrahedra_opt\"}},\n",
133+
"}"
128134
]
129135
},
130136
{
@@ -390,6 +396,8 @@
390396
"source": [
391397
"from mat3ra.wode.context.providers import PlanewaveCutoffsContextProvider, PointsGridDataProvider, \\\n",
392398
" PointsPathDataProvider\n",
399+
"from mat3ra.notebooks_utils.workflow import patch_workflow_qe_input\n",
400+
"\n",
393401
"\n",
394402
"bs_subworkflow = workflow.subworkflows[1 if ADD_RELAXATION else 0]\n",
395403
"\n",
@@ -423,7 +431,11 @@
423431
" unit = swf.get_unit_by_name(name=unit_name)\n",
424432
" if unit:\n",
425433
" unit.add_context(cutoffs_context)\n",
426-
" swf.set_unit(unit)"
434+
" swf.set_unit(unit)\n",
435+
"\n",
436+
"if ADDITIONAL_PARAMETERS:\n",
437+
" for unit_name, parameters in ADDITIONAL_PARAMETERS.items():\n",
438+
" patch_workflow_qe_input(workflow, parameters, unit_names=[unit_name])"
427439
]
428440
},
429441
{
@@ -513,8 +525,7 @@
513525
" queue=QUEUE_NAME,\n",
514526
" ppn=PPN\n",
515527
")\n",
516-
"print(f\"Using cluster: {compute.cluster.hostname}, queue: {QUEUE_NAME}, ppn: {PPN}\")\n",
517-
"compute.cluster"
528+
"print(f\"Using cluster: {compute.cluster.hostname}, queue: {QUEUE_NAME}, ppn: {PPN}\")"
518529
]
519530
},
520531
{

other/materials_designer/workflows/band_structure_hse.ipynb

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@
120120
"# K-grids and k-path\n",
121121
"RELAXATION_KGRID = None # e.g. [4, 4, 4]\n",
122122
"# Required: uniform Gamma-centered grid — sets both k-mesh and exchange q-grid (nqx1/2/3)\n",
123-
"SCF_KGRID = [1, 1, 1]\n",
124-
"KPATH = None # e.g. [{\"point\": \"Г\", \"steps\": 20}, {\"point\": \"X\", \"steps\": 20}]\n",
125-
"\n",
123+
"SCF_KGRID = None # [1, 1, 1]\n",
124+
"KPATH = None # e.g. [{\"point\": \"Г\", \"steps\": 10},{\"point\": \"M\", \"steps\": 10}, {\"point\": \"K\", \"steps\": 10}, {\"point\": \"Г\", \"steps\": 10}]\n",
125+
"QGRID = None # [1, 1, 1]\n",
126126
"# Energy cutoffs\n",
127127
"ECUTWFC = 40\n",
128128
"ECUTRHO = 200"
@@ -436,7 +436,25 @@
436436
" unit = swf.get_unit_by_name(name=unit_name)\n",
437437
" if unit:\n",
438438
" unit.add_context(cutoffs_context)\n",
439-
" swf.set_unit(unit)"
439+
" swf.set_unit(unit)\n",
440+
"\n",
441+
"if QGRID is not None:\n",
442+
" unit = main_hse_subworkflow.get_unit_by_name(name=\"pw_scf_bands_hse\")\n",
443+
" if unit:\n",
444+
" unit.add_context({\n",
445+
" \"qgrid\": {\n",
446+
" \"dimensions\": QGRID,\n",
447+
" \"shifts\": [0, 0, 0],\n",
448+
" \"preferGridMetric\": False,\n",
449+
" },\n",
450+
" \"isQgridEdited\": True,\n",
451+
" })\n",
452+
" main_hse_subworkflow.set_unit(unit)\n",
453+
"\n",
454+
"bands_unit = main_hse_subworkflow.get_unit_by_name(name=\"bands\")\n",
455+
"if bands_unit:\n",
456+
" bands_unit.results = [{\"name\": \"band_structure\"},{\"name\": \"band_gaps\"}]\n",
457+
" main_hse_subworkflow.set_unit(bands_unit)"
440458
]
441459
},
442460
{

0 commit comments

Comments
 (0)