Surface slabs

Generating surface slabs and related structures is a common task in computational materials science.

Example: Al (111) and Al (100) surfaces

Prepare the inputs and submit the workflow

[1]:
from workgraph_collections.ase.espresso.slabs import SlabsWorkgraph
from ase.build import bulk
from aiida import load_profile
from aiida_pythonjob.config import config
# allow pickle
config["allow_pickle"] = True
load_profile()

# create input structure
atoms = bulk("Al", cubic=True)
# atoms = bulk("Si")

metadata = {
    "options": {
        'prepend_text' : """eval "$(conda shell.posix hook)"
        conda activate aiida
        export OMP_NUM_THREADS=1
        """,
    }
}
pseudopotentials = {"Al": "Al.pbe-n-kjpaw_psl.1.0.0.UPF"}
# pseudopotentials = {"Si": "Si.pbe-nl-rrkjus_psl.1.0.0.UPF"}
pseudo_dir = "/home/xing/data/ase/espresso_pseudo"
# pseudo_dir = "/home/wang_x3/datas/pseudos/psl"
input_data = {
    "CONTROL": {"calculation": "scf"},
    "SYSTEM": {"ecutwfc": 30, "ecutrho": 240,
               "occupations": "smearing",
                "degauss": 0.01,
                "smearing": "cold",},
}
#------------------------- Set the inputs -------------------------
wg = SlabsWorkgraph.build_graph(atoms=atoms,
                   computer="localhost",
                   miller_indices=[[1, 1, 1], [1, 0, 0]],
                   command="mpirun -np 1 pw.x",
                   pseudopotentials=pseudopotentials,
                   pseudo_dir=pseudo_dir,
                   input_data=input_data,
                   layers=1,
                   kspacing=0.3,
                   metadata=metadata,
                   calc_surface_energy=True,
                   )
wg


[1]:

Relaxed slabs

[2]:
#------------------------- Submit the calculation -------------------
wg.run()
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181435
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181439
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax
INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181464
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181468
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: inspect_relax
INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: inspect_relax, type: PYFUNCTION, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181492
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181496
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.
09/04/2025 10:16:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|continue_workgraph]: tasks ready to run:
09/04/2025 10:16:14 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181492|WorkGraphEngine|finalize]: Finalize workgraph.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181492|WorkGraphEngine|finalize]: Finalize workgraph.
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.
09/04/2025 10:16:16 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|continue_workgraph]: tasks ready to run:
09/04/2025 10:16:16 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181464|WorkGraphEngine|finalize]: Finalize workgraph.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181464|WorkGraphEngine|finalize]: Finalize workgraph.
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.
09/04/2025 10:16:19 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|continue_workgraph]: tasks ready to run:
09/04/2025 10:16:19 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181435|WorkGraphEngine|finalize]: Finalize workgraph.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181435|WorkGraphEngine|finalize]: Finalize workgraph.
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|update_task_state]: Task: RelaxWorkgraph, type: GRAPH, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: get_slabs_from_miller_indices_ase
INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000
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.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|update_task_state]: Task: get_slabs_from_miller_indices_ase, type: PYFUNCTION, finished.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxSlabs
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181514
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run: RelaxWorkgraph,RelaxWorkgraph1
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530, 181546
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181550
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181554
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.
'PwExitCodes' object has no attribute 'get'
Traceback (most recent call last):
  File "<stdin>", line 41, in main
  File "/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py", line 196, in pw_calculator
    atoms.get_potential_energy()
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py", line 770, in get_potential_energy
    energy = self._calc.get_potential_energy(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py", line 24, in get_potential_energy
    return self.get_property(name, atoms)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 141, in get_property
    return super().get_property(name, atoms=atoms, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py", line 538, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py", line 334, in calculate
    self.results = self.template.read_results(self.directory)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 63, in read_results
    exit_code = parser.parse()
                ^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 171, in parse
    exit_code = self.validate_premature_exit(logs_stdout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 229, in validate_premature_exit
    return self.exit_codes.get(error_label)
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'PwExitCodes' object has no attribute 'get'

WARNING:aiida.orm.nodes.process.calculation.calcjob.CalcJobNode:output parser returned exit code<325>: Function execution failed.
'PwExitCodes' object has no attribute 'get'
Traceback (most recent call last):
  File "<stdin>", line 41, in main
  File "/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py", line 196, in pw_calculator
    atoms.get_potential_energy()
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py", line 770, in get_potential_energy
    energy = self._calc.get_potential_energy(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py", line 24, in get_potential_energy
    return self.get_property(name, atoms)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 141, in get_property
    return super().get_property(name, atoms=atoms, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py", line 538, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py", line 334, in calculate
    self.results = self.template.read_results(self.directory)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 63, in read_results
    exit_code = parser.parse()
                ^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 171, in parse
    exit_code = self.validate_premature_exit(logs_stdout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 229, in validate_premature_exit
    return self.exit_codes.get(error_label)
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'PwExitCodes' object has no attribute 'get'

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.
'PwExitCodes' object has no attribute 'get'
Traceback (most recent call last):
  File "<stdin>", line 41, in main
  File "/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py", line 196, in pw_calculator
    atoms.get_potential_energy()
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py", line 770, in get_potential_energy
    energy = self._calc.get_potential_energy(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py", line 24, in get_potential_energy
    return self.get_property(name, atoms)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 141, in get_property
    return super().get_property(name, atoms=atoms, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py", line 538, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py", line 334, in calculate
    self.results = self.template.read_results(self.directory)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 63, in read_results
    exit_code = parser.parse()
                ^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 171, in parse
    exit_code = self.validate_premature_exit(logs_stdout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 229, in validate_premature_exit
    return self.exit_codes.get(error_label)
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'PwExitCodes' object has no attribute 'get'

REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|on_task_failed]: Task, pw_calculator, type: PYTHONJOB, failed. Error message: Function execution failed.
'PwExitCodes' object has no attribute 'get'
Traceback (most recent call last):
  File "<stdin>", line 41, in main
  File "/home/xing/repos/superstar54/workgraph-collections/workgraph_collections/ase/espresso/pw.py", line 196, in pw_calculator
    atoms.get_potential_energy()
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/atoms.py", line 770, in get_potential_energy
    energy = self._calc.get_potential_energy(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/abc.py", line 24, in get_potential_energy
    return self.get_property(name, atoms)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 141, in get_property
    return super().get_property(name, atoms=atoms, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/calculator.py", line 538, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/ase/calculators/genericfileio.py", line 334, in calculate
    self.results = self.template.read_results(self.directory)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/espresso.py", line 63, in read_results
    exit_code = parser.parse()
                ^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 171, in parse
    exit_code = self.validate_premature_exit(logs_stdout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/repos/superstar54/ase-quantumespresso/src/ase_quantumespresso/parsers/pw.py", line 229, in validate_premature_exit
    return self.exit_codes.get(error_label)
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'PwExitCodes' object has no attribute 'get'

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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator
09/04/2025 10:31:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181546|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181546|WorkGraphEngine|continue_workgraph]: tasks ready to run:
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.
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.
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.
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.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph1
09/04/2025 10:31:15 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run:
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 181530
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.
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.
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.
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.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|run_error_handlers]: Run error handlers for pw_calculator
09/04/2025 10:46:10 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181530|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181530|WorkGraphEngine|continue_workgraph]: tasks ready to run:
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.
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.
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.
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.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxWorkgraph
09/04/2025 10:46:12 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181514|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181514|WorkGraphEngine|continue_workgraph]: tasks ready to run:
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.
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.
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.
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.
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
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|run_error_handlers]: Run error handlers for RelaxSlabs
09/04/2025 10:46:13 AM <1075524> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [181419|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[181419|WorkGraphEngine|continue_workgraph]: tasks ready to run:
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.
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.

Print the results

[3]:
print("Surface   Energy")
for key, E in wg.outputs.surface_energy.value.items():
    print(key, E)

print("Surfae   Atoms")
for key, slab in wg.outputs.structures.value.items():
    print(key, slab.value)


Surface   Energy
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 2
      1 print("Surface   Energy")
----> 2 for key, E in wg.outputs.surface_energy.value.items():
      3     print(key, E)
      5 print("Surfae   Atoms")

AttributeError: 'NoneType' object has no attribute 'items'