Skip to content

Commit

Permalink
Add parent_folder_ph to PhCalculation
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
bastonero committed Jun 17, 2024
1 parent 210c40b commit 1597c3c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/aiida_quantumespresso/calculations/ph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1597c3c

Please sign in to comment.