Source code for aiida_quantumespresso.calculations.pw2wannier90

# -*- coding: utf-8 -*-
"""`CalcJob` implementation for the pw2wannier.x code of Quantum ESPRESSO."""
from aiida.orm import Dict, FolderData, RemoteData, SinglefileData

from aiida_quantumespresso.calculations.namelists import NamelistsCalculation


[docs]class Pw2wannier90Calculation(NamelistsCalculation): """`CalcJob` implementation for the pw2wannier.x code of Quantum ESPRESSO. For more information, refer to http://www.quantum-espresso.org/ and http://www.wannier.org/ """
[docs] _default_namelists = ['INPUTPP']
[docs] _SEEDNAME = 'aiida'
[docs] _blocked_keywords = [('INPUTPP', 'outdir', NamelistsCalculation._OUTPUT_SUBFOLDER), ('INPUTPP', 'prefix', NamelistsCalculation._PREFIX), ('INPUTPP', 'seedname', _SEEDNAME)]
# By default we do not download anything else than aiida.out. One can add the files # _SEEDNAME.amn/.nnm/.eig to `CalcJob.metadata.options.additional_retrieve_list` to retrieve them.
[docs] _internal_retrieve_list = []
[docs] _default_parser = 'quantumespresso.pw2wannier90'
[docs] _EXTERNAL_PROJECTORS_SUBFOLDER = './external_projectors/'
@classmethod
[docs] def define(cls, spec): """Define the process specification.""" # yapf: disable super().define(spec) spec.input('nnkp_file', valid_type=SinglefileData, help='A SinglefileData containing the .nnkp file generated by wannier90.x -pp') spec.input('parent_folder', valid_type=(RemoteData, FolderData), help='The output folder of a pw.x calculation') spec.input( 'external_projectors_path', valid_type=RemoteData, required=False, help='Path to the external projectors.' ) spec.input( 'external_projectors_list', valid_type=Dict, required=False, help='Dict of projectors with kind name and element symbol.' ) spec.output('output_parameters', valid_type=Dict) spec.default_output_node = 'output_parameters' spec.exit_code(340, 'ERROR_GENERIC_QE_ERROR', message='Encountered a generic error message') spec.exit_code(350, 'ERROR_UNEXPECTED_PARSER_EXCEPTION', message='The parser raised an unexpected exception: {exception}')
# yapf: enable
[docs] def prepare_for_submission(self, folder): """Prepare the calculation job for submission by transforming input nodes into input files. In addition to the input files being written to the sandbox folder, a `CalcInfo` instance will be returned that contains lists of files that need to be copied to the remote machine before job submission, as well as file lists that are to be retrieved after job completion. :param folder: a sandbox folder to temporarily write files on disk. :return: :class:`~aiida.common.datastructures.CalcInfo` instance. """ import os calcinfo = super().prepare_for_submission(folder) # Put the nnkp in the folder, with the correct filename nnkp_file = self.inputs.nnkp_file calcinfo.local_copy_list.append((nnkp_file.uuid, nnkp_file.filename, f'{self._SEEDNAME}.nnkp')) if 'external_projectors_list' in self.inputs and 'external_projectors_path' in self.inputs: ext_proj_path = self.inputs.external_projectors_path folder.get_subfolder(self._EXTERNAL_PROJECTORS_SUBFOLDER, create=True) for key, val in self.inputs['external_projectors_list'].items(): calcinfo.remote_copy_list.append(( ext_proj_path.computer.uuid, os.path.join(ext_proj_path.get_remote_path(), val + '.dat'), os.path.join(self._EXTERNAL_PROJECTORS_SUBFOLDER, key + '.dat') )) return calcinfo