{ "cells": [ { "cell_type": "markdown", "id": "22d177dc-6cfb-4de2-9509-f1eb45e10cf2", "metadata": {}, "source": [ "# Surface slabs\n", "\n", "Generating surface slabs and related structures is a common task in computational materials science.\n", "\n", "## Example: Al (111) and Al (100) surfaces\n", "\n", "### Prepare the inputs and submit the workflow\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "8ee799d2-0b5b-4609-957f-6b3f2cd451f0", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "88f76081bb9040fc8cb026f3d3a00fb7", "version_major": 2, "version_minor": 1 }, "text/plain": [ "NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'SlabsWo…" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from workgraph_collections.ase.espresso.slabs import SlabsWorkgraph\n", "from ase.build import bulk\n", "from aiida import load_profile\n", "from aiida_pythonjob.config import config\n", "# allow pickle\n", "config[\"allow_pickle\"] = True\n", "load_profile()\n", "\n", "# create input structure\n", "atoms = bulk(\"Al\", cubic=True)\n", "# atoms = bulk(\"Si\")\n", "\n", "metadata = {\n", " \"options\": {\n", " 'prepend_text' : \"\"\"eval \"$(conda shell.posix hook)\"\n", " conda activate aiida\n", " export OMP_NUM_THREADS=1\n", " \"\"\",\n", " }\n", "}\n", "pseudopotentials = {\"Al\": \"Al.pbe-n-kjpaw_psl.1.0.0.UPF\"}\n", "# pseudopotentials = {\"Si\": \"Si.pbe-nl-rrkjus_psl.1.0.0.UPF\"}\n", "pseudo_dir = \"/home/xing/data/ase/espresso_pseudo\"\n", "# pseudo_dir = \"/home/wang_x3/datas/pseudos/psl\"\n", "input_data = {\n", " \"CONTROL\": {\"calculation\": \"scf\"},\n", " \"SYSTEM\": {\"ecutwfc\": 30, \"ecutrho\": 240,\n", " \"occupations\": \"smearing\",\n", " \"degauss\": 0.01,\n", " \"smearing\": \"cold\",},\n", "}\n", "#------------------------- Set the inputs -------------------------\n", "wg = SlabsWorkgraph.build_graph(atoms=atoms,\n", " computer=\"localhost\",\n", " miller_indices=[[1, 1, 1], [1, 0, 0]],\n", " command=\"mpirun -np 1 pw.x\",\n", " pseudopotentials=pseudopotentials,\n", " pseudo_dir=pseudo_dir,\n", " input_data=input_data,\n", " layers=1,\n", " kspacing=0.3,\n", " metadata=metadata,\n", " calc_surface_energy=True,\n", " )\n", "wg\n", "\n" ] }, { "cell_type": "markdown", "id": "cadb07af", "metadata": {}, "source": [ "## Relaxed slabs" ] }, { "cell_type": "code", "execution_count": 2, "id": "8d6c90d6", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "09/04/2025 10:15:34 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "09/04/2025 10:15:38 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181435\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181435\n", "09/04/2025 10:15:41 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "09/04/2025 10:15:43 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181439\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181439\n", "09/04/2025 10:15:45 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "09/04/2025 10:15:47 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax\n", "INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000\n", "09/04/2025 10:15:48 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.\n", "09/04/2025 10:15:48 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "09/04/2025 10:15:51 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181464\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181464\n", "09/04/2025 10:15:55 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "09/04/2025 10:15:57 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181468\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181468\n", "09/04/2025 10:15:59 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "09/04/2025 10:16:01 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax\n", "INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000\n", "09/04/2025 10:16:02 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.\n", "09/04/2025 10:16:02 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph\n", "09/04/2025 10:16:05 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181492\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181492\n", "09/04/2025 10:16:08 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "09/04/2025 10:16:10 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181496\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181496\n", "09/04/2025 10:16:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.\n", "09/04/2025 10:16:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:16:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|finalize]: Finalize workgraph.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|finalize]: Finalize workgraph.\n", "09/04/2025 10:16:15 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "09/04/2025 10:16:16 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:16:16 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|finalize]: Finalize workgraph.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|finalize]: Finalize workgraph.\n", "09/04/2025 10:16:17 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "09/04/2025 10:16:19 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:16:19 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|finalize]: Finalize workgraph.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|finalize]: Finalize workgraph.\n", "09/04/2025 10:16:19 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.\n", "09/04/2025 10:16:21 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: get_slabs_from_miller_indices_ase\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: get_slabs_from_miller_indices_ase\n", "INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000\n", "09/04/2025 10:16:22 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|update_task_state]: Task: get_slabs_from_miller_indices_ase, type: PYFUNCTION, finished.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|update_task_state]: Task: get_slabs_from_miller_indices_ase, type: PYFUNCTION, finished.\n", "09/04/2025 10:16:22 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxSlabs\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxSlabs\n", "09/04/2025 10:16:23 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181514\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181514\n", "09/04/2025 10:16:26 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph,RelaxWorkgraph1\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph,RelaxWorkgraph1\n", "09/04/2025 10:16:32 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530, 181546\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530, 181546\n", "09/04/2025 10:16:35 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "09/04/2025 10:16:36 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181550\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181550\n", "09/04/2025 10:16:39 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator\n", "09/04/2025 10:16:40 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181554\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181554\n", "09/04/2025 10:31:08 AM <1075524> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<325>: Function execution failed.\n", "'PwExitCodes' object has no attribute 'get'\n", "Traceback (most recent call last):\n", " File \"\", line 41, in main\n", " File \"/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py\", line 196, in pw_calculator\n", " atoms.get_potential_energy()\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py\", line 770, in get_potential_energy\n", " energy = self._calc.get_potential_energy(self)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py\", line 24, in get_potential_energy\n", " return self.get_property(name, atoms)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 141, in get_property\n", " return super().get_property(name, atoms=atoms, **kwargs)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py\", line 538, in get_property\n", " self.calculate(atoms, [name], system_changes)\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py\", line 334, in calculate\n", " self.results = self.template.read_results(self.directory)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 63, in read_results\n", " exit_code = parser.parse()\n", " ^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 171, in parse\n", " exit_code = self.validate_premature_exit(logs_stdout)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 229, in validate_premature_exit\n", " return self.exit_codes.get(error_label)\n", " ^^^^^^^^^^^^^^^^^^^\n", "AttributeError: 'PwExitCodes' object has no attribute 'get'\n", "\n", "WARNING:aiida.orm.nodes.process.calculation.calcjob.CalcJobNode:output parser returned exit code<325>: Function execution failed.\n", "'PwExitCodes' object has no attribute 'get'\n", "Traceback (most recent call last):\n", " File \"\", line 41, in main\n", " File \"/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py\", line 196, in pw_calculator\n", " atoms.get_potential_energy()\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py\", line 770, in get_potential_energy\n", " energy = self._calc.get_potential_energy(self)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py\", line 24, in get_potential_energy\n", " return self.get_property(name, atoms)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 141, in get_property\n", " return super().get_property(name, atoms=atoms, **kwargs)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py\", line 538, in get_property\n", " self.calculate(atoms, [name], system_changes)\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py\", line 334, in calculate\n", " self.results = self.template.read_results(self.directory)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 63, in read_results\n", " exit_code = parser.parse()\n", " ^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 171, in parse\n", " exit_code = self.validate_premature_exit(logs_stdout)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 229, in validate_premature_exit\n", " return self.exit_codes.get(error_label)\n", " ^^^^^^^^^^^^^^^^^^^\n", "AttributeError: 'PwExitCodes' object has no attribute 'get'\n", "\n", "09/04/2025 10:31:09 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|on_task_failed]: Task, pw_calculator, type: PYTHONJOB, failed. Error message: Function execution failed.\n", "'PwExitCodes' object has no attribute 'get'\n", "Traceback (most recent call last):\n", " File \"\", line 41, in main\n", " File \"/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py\", line 196, in pw_calculator\n", " atoms.get_potential_energy()\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py\", line 770, in get_potential_energy\n", " energy = self._calc.get_potential_energy(self)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py\", line 24, in get_potential_energy\n", " return self.get_property(name, atoms)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 141, in get_property\n", " return super().get_property(name, atoms=atoms, **kwargs)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py\", line 538, in get_property\n", " self.calculate(atoms, [name], system_changes)\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py\", line 334, in calculate\n", " self.results = self.template.read_results(self.directory)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 63, in read_results\n", " exit_code = parser.parse()\n", " ^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 171, in parse\n", " exit_code = self.validate_premature_exit(logs_stdout)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 229, in validate_premature_exit\n", " return self.exit_codes.get(error_label)\n", " ^^^^^^^^^^^^^^^^^^^\n", "AttributeError: 'PwExitCodes' object has no attribute 'get'\n", "\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|on_task_failed]: Task, pw_calculator, type: PYTHONJOB, failed. Error message: Function execution failed.\n", "'PwExitCodes' object has no attribute 'get'\n", "Traceback (most recent call last):\n", " File \"\", line 41, in main\n", " File \"/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py\", line 196, in pw_calculator\n", " atoms.get_potential_energy()\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py\", line 770, in get_potential_energy\n", " energy = self._calc.get_potential_energy(self)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py\", line 24, in get_potential_energy\n", " return self.get_property(name, atoms)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 141, in get_property\n", " return super().get_property(name, atoms=atoms, **kwargs)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py\", line 538, in get_property\n", " self.calculate(atoms, [name], system_changes)\n", " File \"/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py\", line 334, in calculate\n", " self.results = self.template.read_results(self.directory)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py\", line 63, in read_results\n", " exit_code = parser.parse()\n", " ^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 171, in parse\n", " exit_code = self.validate_premature_exit(logs_stdout)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", " File \"/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py\", line 229, in validate_premature_exit\n", " return self.exit_codes.get(error_label)\n", " ^^^^^^^^^^^^^^^^^^^\n", "AttributeError: 'PwExitCodes' object has no attribute 'get'\n", "\n", "09/04/2025 10:31:09 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator\n", "09/04/2025 10:31:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:31:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:31:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|on_task_failed]: Task, RelaxWorkgraph1, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_task_failed]: Task, RelaxWorkgraph1, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:31:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph1\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph1\n", "09/04/2025 10:31:15 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:31:15 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530\n", "09/04/2025 10:46:09 AM <1075524> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<312>: The stdout output file was incomplete probably because the calculation got interrupted.\n", "WARNING:aiida.orm.nodes.process.calculation.calcjob.CalcJobNode:output parser returned exit code<312>: The stdout output file was incomplete probably because the calculation got interrupted.\n", "09/04/2025 10:46:09 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|on_task_failed]: Task, pw_calculator, type: PYTHONJOB, failed. Error message: The stdout output file was incomplete probably because the calculation got interrupted.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|on_task_failed]: Task, pw_calculator, type: PYTHONJOB, failed. Error message: The stdout output file was incomplete probably because the calculation got interrupted.\n", "09/04/2025 10:46:09 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator\n", "09/04/2025 10:46:10 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:46:10 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:46:11 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|on_task_failed]: Task, RelaxWorkgraph, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_task_failed]: Task, RelaxWorkgraph, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['pw_calculator'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:46:11 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph\n", "09/04/2025 10:46:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:46:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['RelaxWorkgraph', 'RelaxWorkgraph1'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['RelaxWorkgraph', 'RelaxWorkgraph1'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:46:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|on_task_failed]: Task, RelaxSlabs, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['RelaxWorkgraph', 'RelaxWorkgraph1'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|on_task_failed]: Task, RelaxSlabs, type: GRAPH, failed. Error message: WorkGraph finished, but tasks: ['RelaxWorkgraph', 'RelaxWorkgraph1'] failed. Thus all their child tasks are skipped.\n", "09/04/2025 10:46:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxSlabs\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxSlabs\n", "09/04/2025 10:46:13 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: \n", "09/04/2025 10:46:13 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['RelaxSlabs'] failed. Thus all their child tasks are skipped.\n", "REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|is_workgraph_finished]: WorkGraph finished, but tasks: ['RelaxSlabs'] failed. Thus all their child tasks are skipped.\n" ] } ], "source": [ "#------------------------- Submit the calculation -------------------\n", "wg.run()" ] }, { "cell_type": "markdown", "id": "5e6352f2", "metadata": {}, "source": [ "Print the results" ] }, { "cell_type": "code", "execution_count": 3, "id": "88c6379d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Surface Energy\n" ] }, { "ename": "AttributeError", "evalue": "'NoneType' object has no attribute 'items'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[3], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSurface Energy\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, E \u001b[38;5;129;01min\u001b[39;00m \u001b[43mwg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moutputs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msurface_energy\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mitems\u001b[49m():\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(key, E)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSurfae Atoms\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mAttributeError\u001b[0m: 'NoneType' object has no attribute 'items'" ] } ], "source": [ "print(\"Surface Energy\")\n", "for key, E in wg.outputs.surface_energy.value.items():\n", " print(key, E)\n", "\n", "print(\"Surfae Atoms\")\n", "for key, slab in wg.outputs.structures.value.items():\n", " print(key, slab.value)\n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": "aiida", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.0" } }, "nbformat": 4, "nbformat_minor": 5 }