Skip to content

Commit ddaca33

Browse files
committed
Deprecate ADDITIONAL_RETRIEVE_LIST in settings
The `ADDITIONAL_RETRIEVE_LIST` key in the `settings` is deprected and will be removed in a fetaure release. A warning is introduced, indicating that one should use the `CalcJob.metadata.options.additional_retrieve_list` option of `aiida-core` instead (introduced in aiidateam/aiida-core@17b7718).
1 parent c1aa823 commit ddaca33

File tree

9 files changed

+46
-11
lines changed

9 files changed

+46
-11
lines changed

docs/source/howto/calculations/pw.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ All other coordinates are allowed to change.
280280
## How to retrieve additional files
281281

282282
The {{ PwCalculation }} plugin will retrieve the most important and common output files by default.
283-
To retrieve additional output files, specify the list of files in the `ADDITIONAL_RETRIEVE_LIST` key in the `settings` input:
283+
To retrieve additional output files, specify the list of files in the `CalcJob.metadata.options.additional_retrieve_list` key in the input (**NOTE**: The usage of `ADDITIONAL_RETRIEVE_LIST` in the `settings` input is deprecated and will be removed in a future release):
284284

285285
```python
286286
builder = load_code('pw').get_builder()
287-
builder.settings = Dict({'ADDITIONAL_RETRIEVE_LIST': ['custom-file.txt', 'some-other.xml']})
287+
builder.metadata.options.additional_retrieve_list = ['custom-file.txt', 'some-other.xml']
288288
```
289289

290290

src/aiida_quantumespresso/calculations/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ def validate_inputs(cls, value, port_namespace):
183183
if 'settings' in value:
184184
settings = _uppercase_dict(value['settings'].get_dict(), dict_name='settings')
185185

186+
if 'ADDITIONAL_RETRIEVE_LIST' in settings:
187+
warnings.warn(
188+
'The key `ADDITIONAL_RETRIEVE_LIST` in the settings input is deprecated and will be removed in '
189+
'the future. Use the `CalcJob.metadata.options.additional_retrieve_list` input instead.',
190+
FutureWarning
191+
)
192+
186193
# Validate the FIXED_COORDS setting
187194
fixed_coords = settings.get('FIXED_COORDS', None)
188195

src/aiida_quantumespresso/calculations/epw.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""Plugin to create a Quantum Espresso epw.x input file."""
33
import os
4+
import warnings
45

56
from aiida import orm
67
from aiida.common import datastructures, exceptions
@@ -84,6 +85,12 @@ def test_offset(offset):
8485

8586
if 'settings' in self.inputs:
8687
settings = _uppercase_dict(self.inputs.settings.get_dict(), dict_name='settings')
88+
if 'ADDITIONAL_RETRIEVE_LIST' in settings:
89+
warnings.warn(
90+
'The key `ADDITIONAL_RETRIEVE_LIST` in the settings input is deprecated and will be removed in '
91+
'the future. Use the `CalcJob.metadata.options.additional_retrieve_list` input instead.',
92+
FutureWarning
93+
)
8794
else:
8895
settings = {}
8996

src/aiida_quantumespresso/calculations/namelists.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
These codes typically only require a few namelists (plus possibly some text afterwards).
55
"""
66
import pathlib
7+
import warnings
78

89
from aiida.common import datastructures, exceptions
910
from aiida.orm import Dict, FolderData, RemoteData, SinglefileData
@@ -143,6 +144,12 @@ def prepare_for_submission(self, folder):
143144
# pylint: disable=too-many-branches,too-many-statements
144145
if 'settings' in self.inputs:
145146
settings = _uppercase_dict(self.inputs.settings.get_dict(), dict_name='settings')
147+
if 'ADDITIONAL_RETRIEVE_LIST' in settings:
148+
warnings.warn(
149+
'The key `ADDITIONAL_RETRIEVE_LIST` in the settings input is deprecated and will be removed in '
150+
'the future. Use the `CalcJob.metadata.options.additional_retrieve_list` input instead.',
151+
FutureWarning
152+
)
146153
else:
147154
settings = {}
148155

src/aiida_quantumespresso/calculations/neb.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Plugin to create a Quantum Espresso neb.x input file."""
33
import copy
44
import os
5+
import warnings
56

67
from aiida import orm
78
from aiida.common import CalcInfo, CodeInfo, InputValidationError
@@ -178,6 +179,12 @@ def prepare_for_submission(self, folder):
178179
# Convert settings dictionary to have uppercase keys, or create an empty one if none was given.
179180
if 'settings' in self.inputs:
180181
settings_dict = _uppercase_dict(self.inputs.settings.get_dict(), dict_name='settings')
182+
if 'ADDITIONAL_RETRIEVE_LIST' in settings_dict:
183+
warnings.warn(
184+
'The key `ADDITIONAL_RETRIEVE_LIST` in the settings input is deprecated and will be removed in '
185+
'the future. Use the `CalcJob.metadata.options.additional_retrieve_list` input instead.',
186+
FutureWarning
187+
)
181188
else:
182189
settings_dict = {}
183190

src/aiida_quantumespresso/calculations/ph.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""Plugin to create a Quantum Espresso ph.x input file."""
33
import os
4+
import warnings
45

56
from aiida import orm
67
from aiida.common import datastructures, exceptions
@@ -105,6 +106,12 @@ def prepare_for_submission(self, folder):
105106

106107
if 'settings' in self.inputs:
107108
settings = _uppercase_dict(self.inputs.settings.get_dict(), dict_name='settings')
109+
if 'ADDITIONAL_RETRIEVE_LIST' in settings:
110+
warnings.warn(
111+
'The key `ADDITIONAL_RETRIEVE_LIST` in the settings input is deprecated and will be removed in '
112+
'the future. Use the `CalcJob.metadata.options.additional_retrieve_list` input instead.',
113+
FutureWarning
114+
)
108115
else:
109116
settings = {}
110117

src/aiida_quantumespresso/calculations/pw2wannier90.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Pw2wannier90Calculation(NamelistsCalculation):
1616
_blocked_keywords = [('INPUTPP', 'outdir', NamelistsCalculation._OUTPUT_SUBFOLDER),
1717
('INPUTPP', 'prefix', NamelistsCalculation._PREFIX), ('INPUTPP', 'seedname', _SEEDNAME)]
1818
# By default we do not download anything else than aiida.out. One can add the files
19-
# _SEEDNAME.amn/.nnm/.eig to inputs.settings['ADDITIONAL_RETRIEVE_LIST'] to retrieve them.
19+
# _SEEDNAME.amn/.nnm/.eig to `CalcJob.metadata.options.additional_retrieve_list` to retrieve them.
2020
_internal_retrieve_list = []
2121
_default_parser = 'quantumespresso.pw2wannier90'
2222

src/aiida_quantumespresso/cli/calculations/pw2wannier90.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,17 @@ def launch_calculation(
7272
parameters['INPUTPP']['scdm_proj'] = True
7373
parameters['INPUTPP']['scdm_entanglement'] = scdm_mode
7474

75-
# In this command-line example, we always retrieve .amn, .mmn and .eig,
76-
# but we never retrieve the UNK files that are big
77-
settings = {'ADDITIONAL_RETRIEVE_LIST': ['*.amn', '*.mmn', '*.eig']}
78-
7975
inputs = {
8076
'code': code,
8177
'parent_folder': parent_folder,
8278
'nnkp_file': nnkp_file,
8379
'parameters': Dict(parameters),
84-
'settings': Dict(settings),
8580
'metadata': {
8681
'options': get_default_options(max_num_machines, max_wallclock_seconds, with_mpi),
8782
}
8883
}
84+
# In this command-line example, we always retrieve .amn, .mmn and .eig,
85+
# but we never retrieve the UNK files that are big
86+
inputs['metadata'].update({'additional_retrieve_list': ['*.amn', '*.mmn', '*.eig']})
8987

9088
launch.launch_process(CalculationFactory('quantumespresso.pw2wannier90'), daemon, **inputs)

tests/parsers/test_pw2wannier90.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ def generate_inputs():
2121
}
2222
}
2323

24-
settings = {'ADDITIONAL_RETRIEVE_LIST': ['*.amn', '*.mmn', '*.eig']}
25-
2624
# Since we don't actually run pw2wannier.x, we only pretend to have the output folder
2725
# of a parent pw.x calculation. The nnkp file, instead, is real.
2826
inputs = {
2927
'parent_folder': orm.FolderData().store(),
3028
'nnkp_file': orm.SinglefileData(file=nnkp_filepath).store(),
3129
'parameters': orm.Dict(parameters),
32-
'settings': orm.Dict(settings),
30+
'metadata': {
31+
'options': {
32+
'additional_retrieve_list': ['*.amn', '*.mmn', '*.eig']
33+
}
34+
}
3335
}
3436

3537
return AttributeDict(inputs)

0 commit comments

Comments
 (0)