Skip to content

Commit 27e6458

Browse files
committed
Merge branch 'master' of github.com:aiidateam/aiida-common-workflows into add_custom_protocols
2 parents 419a11a + dc3dbbe commit 27e6458

File tree

7 files changed

+395
-97
lines changed

7 files changed

+395
-97
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
strategy:
3636
matrix:
37-
python-version: ['3.9', '3.10', '3.11', '3.12']
37+
python-version: ['3.10', '3.11', '3.12']
3838

3939
services:
4040
rabbitmq:
@@ -70,7 +70,7 @@ jobs:
7070

7171
strategy:
7272
matrix:
73-
python-version: ['3.9']
73+
python-version: ['3.10']
7474

7575
steps:
7676
- uses: actions/checkout@v2

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: '3.9'
6+
python: '3.10'
77
apt_packages:
88
- gfortran # This is necessary for the `sisl` dependency of `aiida-siesta`
99

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ all_plugins = [
6767
'aiida-orca~=0.6.0',
6868
'aiida-quantumespresso~=4.4',
6969
'aiida-siesta~=2.0',
70-
'aiida-vasp~=3.1',
70+
'aiida-vasp~=5.0',
7171
'aiida-wien2k~=0.2.0',
7272
'masci-tools~=0.9'
7373
]
@@ -118,7 +118,7 @@ tests = [
118118
'pytest-regressions~=1.0'
119119
]
120120
vasp = [
121-
'aiida-vasp~=3.1'
121+
'aiida-vasp~=5.0'
122122
]
123123
wien2k = [
124124
'aiida-wien2k~=0.2.0'

src/aiida_common_workflows/workflows/relax/vasp/generator.py

Lines changed: 56 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Implementation of `aiida_common_workflows.common.relax.generator.CommonRelaxInputGenerator` for VASP."""
22
import copy
3+
import os
34
import pathlib
45
import typing as t
56

@@ -93,16 +94,16 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
9394
builder = self.process_class.get_builder()
9495

9596
# Set code
96-
builder.code = engines['relax']['code']
97+
builder.vasp.code = engines['relax']['code']
9798

9899
# Set structure
99100
builder.structure = structure
100101

101102
# Set options
102-
builder.options = plugins.DataFactory('core.dict')(dict=engines['relax']['options'])
103+
builder.vasp.calc.metadata.options = engines['relax']['options']
103104

104105
# Set workchain related inputs, in this case, give more explicit output to report
105-
builder.verbose = plugins.DataFactory('core.bool')(True)
106+
builder.verbose = True
106107

107108
# Fetch initial parameters from the protocol file.
108109
# Here we set the protocols fast, moderate and precise. These currently have no formal meaning.
@@ -127,50 +128,30 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
127128
settings.update(
128129
{
129130
'parser_settings': {
130-
'critical_notifications': {
131-
'add_brmix': True,
132-
'add_cnormn': False,
133-
'add_denmp': True,
134-
'add_dentet': True,
135-
'add_edddav_zhegv': True,
136-
'add_eddrmm_zhegv': True,
137-
'add_edwav': True,
138-
'add_fexcp': True,
139-
'add_fock_acc': True,
140-
'add_non_collinear': True,
141-
'add_not_hermitian': True,
142-
'add_pzstein': True,
143-
'add_real_optlay': True,
144-
'add_rhosyg': True,
145-
'add_rspher': True,
146-
'add_set_indpw_full': True,
147-
'add_sgrcon': True,
148-
'add_no_potimm': True,
149-
'add_magmom': True,
150-
'add_bandocc': True,
151-
},
152-
'add_energies': True,
153-
'add_forces': True,
154-
'add_stress': True,
155-
'add_misc': {
156-
'type': 'dict',
157-
'quantities': [
158-
'total_energies',
159-
'maximum_stress',
160-
'maximum_force',
161-
'magnetization',
162-
'notifications',
163-
'run_status',
164-
'run_stats',
165-
'version',
166-
],
167-
'link_name': 'misc',
168-
},
131+
'energy_types': ['energy_extrapolated', 'energy_free', 'energy_no_entropy'],
132+
'critical_notification_errors': [
133+
'brmix',
134+
'edddav',
135+
'eddwav',
136+
'fexcp',
137+
'fock_acc',
138+
'non_collinear',
139+
'not_hermitian',
140+
'pzstein',
141+
'real_optlay',
142+
'rhosyg',
143+
'rspher',
144+
'set_indpw_full',
145+
'sgrcon',
146+
'no_potimm',
147+
'magmom',
148+
'bandocc',
149+
],
169150
'energy_type': ['energy_free', 'energy_no_entropy'],
170151
}
171152
}
172153
)
173-
builder.settings = plugins.DataFactory('core.dict')(dict=settings)
154+
builder.vasp.settings = settings
174155

175156
# Configure the handlers
176157
handler_overrides = {
@@ -181,17 +162,17 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
181162
'handler_unfinished_calc_generic': {'enabled': False},
182163
'handler_electronic_conv': {'enabled': False},
183164
}
184-
builder.handler_overrides = plugins.DataFactory('core.dict')(dict=handler_overrides)
165+
builder.vasp.handler_overrides = handler_overrides
185166

186167
# Set the parameters on the builder, put it in the code namespace to pass through
187168
# to the code inputs
188-
builder.parameters = plugins.DataFactory('core.dict')(dict={'incar': parameters_dict})
169+
builder.vasp.parameters = {'incar': parameters_dict}
189170

190171
# Set potentials and their mapping
191-
builder.potential_family = plugins.DataFactory('str')(protocol['potential_family'])
192-
builder.potential_mapping = plugins.DataFactory('core.dict')(
193-
dict=self._potential_mapping[protocol['potential_mapping']]
194-
)
172+
if os.environ.get('PYTEST_CURRENT_TEST') is not None:
173+
builder.vasp._port_namespace['potential_family'].validator = None
174+
builder.vasp.potential_family = protocol['potential_family']
175+
builder.vasp.potential_mapping = self._potential_mapping[protocol['potential_mapping']]
195176

196177
# Set the kpoint grid from the density in the protocol
197178
kpoints = plugins.DataFactory('core.array.kpoints')()
@@ -203,52 +184,51 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
203184
)
204185
else:
205186
kpoints.set_kpoints_mesh_from_density(protocol['kpoint_distance'])
206-
builder.kpoints = kpoints
187+
builder.vasp.kpoints = kpoints
207188

208189
# Set the relax parameters
209-
relax = AttributeDict()
190+
relax_settings = AttributeDict()
210191
if relax_type != RelaxType.NONE:
211192
# Perform relaxation of cell or positions
212-
relax.perform = plugins.DataFactory('core.bool')(True)
213-
relax.algo = plugins.DataFactory('str')(protocol['relax']['algo'])
214-
relax.steps = plugins.DataFactory('int')(protocol['relax']['steps'])
193+
relax_settings.perform = True
194+
relax_settings.algo = protocol['relax']['algo']
195+
relax_settings.steps = protocol['relax']['steps']
215196
if relax_type == RelaxType.POSITIONS:
216-
relax.positions = plugins.DataFactory('core.bool')(True)
217-
relax.shape = plugins.DataFactory('core.bool')(False)
218-
relax.volume = plugins.DataFactory('core.bool')(False)
197+
relax_settings.positions = True
198+
relax_settings.shape = False
199+
relax_settings.volume = False
219200
elif relax_type == RelaxType.CELL:
220-
relax.positions = plugins.DataFactory('core.bool')(False)
221-
relax.shape = plugins.DataFactory('core.bool')(True)
222-
relax.volume = plugins.DataFactory('core.bool')(True)
201+
relax_settings.positions = False
202+
relax_settings.shape = True
203+
relax_settings.volume = True
223204
elif relax_type == RelaxType.VOLUME:
224-
relax.positions = plugins.DataFactory('core.bool')(False)
225-
relax.shape = plugins.DataFactory('core.bool')(False)
226-
relax.volume = plugins.DataFactory('core.bool')(True)
205+
relax_settings.positions = False
206+
relax_settings.shape = False
207+
relax_settings.volume = True
227208
elif relax_type == RelaxType.SHAPE:
228-
relax.positions = plugins.DataFactory('core.bool')(False)
229-
relax.shape = plugins.DataFactory('core.bool')(True)
230-
relax.volume = plugins.DataFactory('core.bool')(False)
209+
relax_settings.positions = False
210+
relax_settings.shape = True
211+
relax_settings.volume = False
231212
elif relax_type == RelaxType.POSITIONS_CELL:
232-
relax.positions = plugins.DataFactory('core.bool')(True)
233-
relax.shape = plugins.DataFactory('core.bool')(True)
234-
relax.volume = plugins.DataFactory('core.bool')(True)
213+
relax_settings.positions = True
214+
relax_settings.shape = True
215+
relax_settings.volume = True
235216
elif relax_type == RelaxType.POSITIONS_SHAPE:
236-
relax.positions = plugins.DataFactory('core.bool')(True)
237-
relax.shape = plugins.DataFactory('core.bool')(True)
238-
relax.volume = plugins.DataFactory('core.bool')(False)
217+
relax_settings.positions = True
218+
relax_settings.shape = True
219+
relax_settings.volume = False
239220
else:
240221
# Do not perform any relaxation
241-
relax.perform = plugins.DataFactory('core.bool')(False)
242-
222+
relax_settings.perform = False
243223
if threshold_forces is not None:
244224
threshold = threshold_forces
245225
else:
246226
threshold = protocol['relax']['threshold_forces']
247-
relax.force_cutoff = plugins.DataFactory('float')(threshold)
227+
relax_settings.force_cutoff = threshold
248228

249229
if threshold_stress is not None:
250230
raise ValueError('Using a stress threshold is not directly available in VASP during relaxation.')
251231

252-
builder.relax = relax
232+
builder.relax_settings = relax_settings
253233

254234
return builder

0 commit comments

Comments
 (0)