From 62c3ad6b0ad91b1aaf843067e16bf5f48b13a1cd Mon Sep 17 00:00:00 2001 From: Marnik Bercx Date: Wed, 6 Oct 2021 02:00:48 +0200 Subject: [PATCH] Apply reviewer suggestions --- aiida_quantumespresso/calculations/projwfc.py | 12 +++++------- aiida_quantumespresso/calculations/pw.py | 2 +- aiida_quantumespresso/parsers/projwfc.py | 5 ++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/aiida_quantumespresso/calculations/projwfc.py b/aiida_quantumespresso/calculations/projwfc.py index 8e4559167..ad5ef8a62 100644 --- a/aiida_quantumespresso/calculations/projwfc.py +++ b/aiida_quantumespresso/calculations/projwfc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """`CalcJob` implementation for the projwfc.x code of Quantum ESPRESSO.""" -import os +from pathlib import Path from aiida.orm import RemoteData, FolderData, Dict, XyData from aiida_quantumespresso.calculations.namelists import NamelistsCalculation @@ -28,15 +28,13 @@ class ProjwfcCalculation(NamelistsCalculation): ] _default_parser = 'quantumespresso.projwfc' - xml_filename = 'data-file-schema.xml' - + xml_path = Path(NamelistsCalculation._default_parent_output_folder + ).joinpath(f'{NamelistsCalculation._PREFIX}.save', 'data-file-schema.xml') _internal_retrieve_list = [ NamelistsCalculation._PREFIX + '.pdos*', ] _retrieve_temporary_list = [ - os.path.join( - NamelistsCalculation._default_parent_output_folder, f'{NamelistsCalculation._PREFIX}.save', xml_filename - ) + xml_path.as_posix(), ] @classmethod @@ -58,7 +56,7 @@ def define(cls, spec): spec.output('bands', valid_type=BandsData, required=False) spec.default_output_node = 'output_parameters' spec.exit_code(303, 'ERROR_OUTPUT_XML_MISSING', - message='The retrieved folder did not contain the required required XML file.') + message='The retrieved folder did not contain the required XML file.') spec.exit_code(310, 'ERROR_OUTPUT_STDOUT_READ', message='The stdout output file could not be read.') spec.exit_code(312, 'ERROR_OUTPUT_STDOUT_INCOMPLETE', diff --git a/aiida_quantumespresso/calculations/pw.py b/aiida_quantumespresso/calculations/pw.py index 5813011da..4e307be1a 100644 --- a/aiida_quantumespresso/calculations/pw.py +++ b/aiida_quantumespresso/calculations/pw.py @@ -89,7 +89,7 @@ def define(cls, spec): spec.exit_code(302, 'ERROR_OUTPUT_STDOUT_MISSING', message='The retrieved folder did not contain the required stdout output file.') spec.exit_code(303, 'ERROR_OUTPUT_XML_MISSING', - message='The retrieved folder did not contain the required required XML file.') + message='The retrieved folder did not contain the required XML file.') spec.exit_code(304, 'ERROR_OUTPUT_XML_MULTIPLE', message='The retrieved folder contained multiple XML files.') spec.exit_code(305, 'ERROR_OUTPUT_FILES', diff --git a/aiida_quantumespresso/parsers/projwfc.py b/aiida_quantumespresso/parsers/projwfc.py index 933011ac3..acf5f805e 100644 --- a/aiida_quantumespresso/parsers/projwfc.py +++ b/aiida_quantumespresso/parsers/projwfc.py @@ -5,8 +5,7 @@ import numpy as np -from aiida.common import LinkType -from aiida.orm import Dict, ProjectionData, BandsData, XyData, CalcJobNode +from aiida.orm import Dict, ProjectionData, BandsData, XyData from aiida.plugins import OrbitalFactory from aiida_quantumespresso.parsers import QEOutputParsingError @@ -369,7 +368,7 @@ def _parse_xml(self, retrieved_temporary_folder): from .parse_xml.exceptions import XMLParseError, XMLUnsupportedFormatError from .parse_xml.pw.parse import parse_xml - xml_filepath = Path(retrieved_temporary_folder) / self.node.process_class.xml_filename + xml_filepath = Path(retrieved_temporary_folder) / self.node.process_class.xml_path.name if not xml_filepath.exists(): self.exit(self.exit_codes.ERROR_OUTPUT_XML_MISSING)