Skip to content

Commit 276ef56

Browse files
authored
Use gpaw mpi4py (#834)
* mpi4py * single atom cell
1 parent 533a4f2 commit 276ef56

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

notebooks/5-1-gpaw.ipynb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,20 @@
4242
"outputs": [],
4343
"source": [
4444
"def evaluate_with_gpaw(task_dict, kpts, encut):\n",
45+
" import os\n",
46+
" os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n",
47+
" os.environ[\"GPAW_MPI4PY\"] = \"1\"\n",
48+
"\n",
49+
" from mpi4py import MPI\n",
4550
" from gpaw import GPAW, PW\n",
51+
" from gpaw.mpi4pywrapper import MPI4PYWrapper\n",
4652
"\n",
4753
" structure = task_dict[\"calc_energy\"].copy()\n",
4854
" structure.calc = GPAW(\n",
4955
" xc=\"PBE\",\n",
5056
" mode=PW(encut),\n",
5157
" kpts=kpts,\n",
58+
" communicator=MPI4PYWrapper(MPI.COMM_WORLD),\n",
5259
" )\n",
5360
" return structure.get_potential_energy()"
5461
]
@@ -67,7 +74,7 @@
6774
"outputs": [],
6875
"source": [
6976
"task_dict = get_tasks_for_energy_volume_curve(\n",
70-
" structure=bulk(\"Al\", a=4.05, cubic=True),\n",
77+
" structure=bulk(\"Al\", a=4.05),\n",
7178
" num_points=7,\n",
7279
" vol_range=0.05,\n",
7380
" axes=(\"x\", \"y\", \"z\"),\n",
@@ -219,7 +226,7 @@
219226
" task_dict=v, \n",
220227
" kpts=(3, 3, 3), \n",
221228
" encut=300,\n",
222-
" resource_dict={\"cores\": 1},\n",
229+
" resource_dict={\"cores\": 2},\n",
223230
" )\n",
224231
" sleep(1)\n",
225232
" pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n",
@@ -416,7 +423,7 @@
416423
" task_dict=v, \n",
417424
" kpts=(3, 3, 3), \n",
418425
" encut=300,\n",
419-
" resource_dict={\"cores\": 1},\n",
426+
" resource_dict={\"cores\": 2},\n",
420427
" )\n",
421428
" sleep(1)\n",
422429
" pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n",

0 commit comments

Comments
 (0)