From d560b95c062cc21a127166139bfcfcafe79c648e Mon Sep 17 00:00:00 2001 From: Carlo Pignedoli Date: Fri, 1 Dec 2023 13:47:54 +0100 Subject: [PATCH] Fix PDOS viewer to support old workchains (#202) --- surfaces_tools/widgets/pdos.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/surfaces_tools/widgets/pdos.py b/surfaces_tools/widgets/pdos.py index fafcee8..da2691c 100644 --- a/surfaces_tools/widgets/pdos.py +++ b/surfaces_tools/widgets/pdos.py @@ -40,13 +40,16 @@ def read_and_process_pdos_file(pdos_path): return out_data, kind -def process_pdos_files(scf_calc, newversion=True): +def process_pdos_files(pdos_workchain, newversion=True): if newversion: - retr_files = scf_calc.outputs.slab_retrieved.list_object_names() - retr_folder = scf_calc.outputs.slab_retrieved + retr_files = pdos_workchain.outputs.slab_retrieved.list_object_names() + retr_folder = pdos_workchain.outputs.slab_retrieved else: - retr_files = scf_calc.outputs.retrieved.list_object_names() - retr_folder = scf_calc.outputs.retrieved + for process in pdos_workchain.called_descendants: + if process.label == "slab_scf": + slab_scf = process + retr_files = slab_scf.outputs.retrieved.list_object_names() + retr_folder = slab_scf.outputs.retrieved nspin = 1 for file in retr_files: @@ -369,7 +372,7 @@ def _on_workchain_change(self, change): workchain = change["new"] try: data = process_pdos_files(workchain) - except (KeyError, aiida.common.exceptions.NotExistentAttribute): + except (KeyError, common.NotExistentAttributeError): data = process_pdos_files(workchain, newversion=False) self.options = {