From 1597c3c2069092409cc52d7d08df0a2991786dac Mon Sep 17 00:00:00 2001 From: Lorenzo <79980269+bastonero@users.noreply.github.com> Date: Mon, 17 Jun 2024 08:52:37 +0200 Subject: [PATCH] Add `parent_folder_ph` to `PhCalculation` The lack of an extra input for other `PhCalculation`s makes it hard to devise workflows enabling the parallel options of `ph.x`. By adding a new input to the CalcJob different folders from different `ph.x` calculations be now merged into a unique final folder, the can serve for instance to collect perturbation files needed for post-processings or more advanced interpolation techniques (e.g. via the EPW code). --- src/aiida_quantumespresso/calculations/ph.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/aiida_quantumespresso/calculations/ph.py b/src/aiida_quantumespresso/calculations/ph.py index 114a191b..e9430e7e 100644 --- a/src/aiida_quantumespresso/calculations/ph.py +++ b/src/aiida_quantumespresso/calculations/ph.py @@ -56,6 +56,8 @@ def define(cls, spec): spec.input('settings', valid_type=orm.Dict, required=False, help='') spec.input('parent_folder', valid_type=orm.RemoteData, help='the folder of a completed `PwCalculation`') + spec.input_namespace('parent_folder_ph', valid_type=orm.RemoteData, + help='the folder of one or more completed `PhCalculation`') spec.output('output_parameters', valid_type=orm.Dict) spec.default_output_node = 'output_parameters' @@ -299,6 +301,14 @@ def prepare_for_submission(self, folder): os.path.join(parent_folder.get_remote_path(), self._FOLDER_DYNAMICAL_MATRIX), '.' )) + if 'parent_folder_ph' in self.inputs: + for ph_folder in self.inputs.parent_folder_ph.values(): + remote_copy_list.append(( + ph_folder.computer.uuid, + os.path.join(ph_folder.get_remote_path(), self._OUTPUT_SUBFOLDER, '_ph0', f'{self._PREFIX}.phsave'), + os.path.join(self._OUTPUT_SUBFOLDER, '_ph0', f'{self._PREFIX}.phsave'), + )) + # Create an `.EXIT` file if `only_initialization` flag in `settings` is set to `True` if settings.pop('ONLY_INITIALIZATION', False): with folder.open(f'{self._PREFIX}.EXIT', 'w') as handle: