Skip to content

Commit 597e627

Browse files
committed
Compatibility update with aiida-vasp
1 parent 8a70baf commit 597e627

File tree

4 files changed

+355
-86
lines changed

4 files changed

+355
-86
lines changed

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: 53 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Implementation of `aiida_common_workflows.common.relax.generator.CommonRelaxInputGenerator` for VASP."""
2+
23
import pathlib
34
import typing as t
45

@@ -81,13 +82,13 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
8182
builder = self.process_class.get_builder()
8283

8384
# Set code
84-
builder.code = engines['relax']['code']
85+
builder.vasp.code = engines['relax']['code']
8586

8687
# Set structure
8788
builder.structure = structure
8889

8990
# Set options
90-
builder.options = plugins.DataFactory('core.dict')(dict=engines['relax']['options'])
91+
builder.vasp.calc.options = plugins.DataFactory('core.dict')(dict=engines['relax']['options'])
9192

9293
# Set workchain related inputs, in this case, give more explicit output to report
9394
builder.verbose = plugins.DataFactory('core.bool')(True)
@@ -115,50 +116,30 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
115116
settings.update(
116117
{
117118
'parser_settings': {
118-
'critical_notifications': {
119-
'add_brmix': True,
120-
'add_cnormn': False,
121-
'add_denmp': True,
122-
'add_dentet': True,
123-
'add_edddav_zhegv': True,
124-
'add_eddrmm_zhegv': True,
125-
'add_edwav': True,
126-
'add_fexcp': True,
127-
'add_fock_acc': True,
128-
'add_non_collinear': True,
129-
'add_not_hermitian': True,
130-
'add_pzstein': True,
131-
'add_real_optlay': True,
132-
'add_rhosyg': True,
133-
'add_rspher': True,
134-
'add_set_indpw_full': True,
135-
'add_sgrcon': True,
136-
'add_no_potimm': True,
137-
'add_magmom': True,
138-
'add_bandocc': True,
139-
},
140-
'add_energies': True,
141-
'add_forces': True,
142-
'add_stress': True,
143-
'add_misc': {
144-
'type': 'dict',
145-
'quantities': [
146-
'total_energies',
147-
'maximum_stress',
148-
'maximum_force',
149-
'magnetization',
150-
'notifications',
151-
'run_status',
152-
'run_stats',
153-
'version',
154-
],
155-
'link_name': 'misc',
156-
},
119+
'energy_types': ['energy_extrapolated', 'energy_free', 'energy_no_entropy'],
120+
'critical_notification_errors': [
121+
'brmix',
122+
'edddav',
123+
'eddwav',
124+
'fexcp',
125+
'fock_acc',
126+
'non_collinear',
127+
'not_hermitian',
128+
'pzstein',
129+
'real_optlay',
130+
'rhosyg',
131+
'rspher',
132+
'set_indpw_full',
133+
'sgrcon',
134+
'no_potimm',
135+
'magmom',
136+
'bandocc',
137+
],
157138
'energy_type': ['energy_free', 'energy_no_entropy'],
158139
}
159140
}
160141
)
161-
builder.settings = plugins.DataFactory('core.dict')(dict=settings)
142+
builder.vasp.settings = plugins.DataFactory('core.dict')(dict=settings)
162143

163144
# Configure the handlers
164145
handler_overrides = {
@@ -169,15 +150,15 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
169150
'handler_unfinished_calc_generic': {'enabled': False},
170151
'handler_electronic_conv': {'enabled': False},
171152
}
172-
builder.handler_overrides = plugins.DataFactory('core.dict')(dict=handler_overrides)
153+
builder.vasp.handler_overrides = plugins.DataFactory('core.dict')(dict=handler_overrides)
173154

174155
# Set the parameters on the builder, put it in the code namespace to pass through
175156
# to the code inputs
176-
builder.parameters = plugins.DataFactory('core.dict')(dict={'incar': parameters_dict})
157+
builder.vasp.parameters = plugins.DataFactory('core.dict')(dict={'incar': parameters_dict})
177158

178159
# Set potentials and their mapping
179-
builder.potential_family = plugins.DataFactory('str')(protocol['potential_family'])
180-
builder.potential_mapping = plugins.DataFactory('core.dict')(
160+
builder.vasp.potential_family = plugins.DataFactory('str')(protocol['potential_family'])
161+
builder.vasp.potential_mapping = plugins.DataFactory('core.dict')(
181162
dict=self._potential_mapping[protocol['potential_mapping']]
182163
)
183164

@@ -191,52 +172,51 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
191172
)
192173
else:
193174
kpoints.set_kpoints_mesh_from_density(protocol['kpoint_distance'])
194-
builder.kpoints = kpoints
175+
builder.vasp.kpoints = kpoints
195176

196177
# Set the relax parameters
197-
relax = AttributeDict()
178+
relax_settings = AttributeDict()
198179
if relax_type != RelaxType.NONE:
199180
# Perform relaxation of cell or positions
200-
relax.perform = plugins.DataFactory('core.bool')(True)
201-
relax.algo = plugins.DataFactory('str')(protocol['relax']['algo'])
202-
relax.steps = plugins.DataFactory('int')(protocol['relax']['steps'])
181+
relax_settings.perform = True
182+
relax_settings.algo = protocol['relax']['algo']
183+
relax_settings.steps = protocol['relax']['steps']
203184
if relax_type == RelaxType.POSITIONS:
204-
relax.positions = plugins.DataFactory('core.bool')(True)
205-
relax.shape = plugins.DataFactory('core.bool')(False)
206-
relax.volume = plugins.DataFactory('core.bool')(False)
185+
relax_settings.positions = True
186+
relax_settings.shape = False
187+
relax_settings.volume = False
207188
elif relax_type == RelaxType.CELL:
208-
relax.positions = plugins.DataFactory('core.bool')(False)
209-
relax.shape = plugins.DataFactory('core.bool')(True)
210-
relax.volume = plugins.DataFactory('core.bool')(True)
189+
relax_settings.positions = False
190+
relax_settings.shape = True
191+
relax_settings.volume = True
211192
elif relax_type == RelaxType.VOLUME:
212-
relax.positions = plugins.DataFactory('core.bool')(False)
213-
relax.shape = plugins.DataFactory('core.bool')(False)
214-
relax.volume = plugins.DataFactory('core.bool')(True)
193+
relax_settings.positions = False
194+
relax_settings.shape = False
195+
relax_settings.volume = True
215196
elif relax_type == RelaxType.SHAPE:
216-
relax.positions = plugins.DataFactory('core.bool')(False)
217-
relax.shape = plugins.DataFactory('core.bool')(True)
218-
relax.volume = plugins.DataFactory('core.bool')(False)
197+
relax_settings.positions = False
198+
relax_settings.shape = True
199+
relax_settings.volume = False
219200
elif relax_type == RelaxType.POSITIONS_CELL:
220-
relax.positions = plugins.DataFactory('core.bool')(True)
221-
relax.shape = plugins.DataFactory('core.bool')(True)
222-
relax.volume = plugins.DataFactory('core.bool')(True)
201+
relax_settings.positions = True
202+
relax_settings.shape = True
203+
relax_settings.volume = True
223204
elif relax_type == RelaxType.POSITIONS_SHAPE:
224-
relax.positions = plugins.DataFactory('core.bool')(True)
225-
relax.shape = plugins.DataFactory('core.bool')(True)
226-
relax.volume = plugins.DataFactory('core.bool')(False)
205+
relax_settings.positions = True
206+
relax_settings.shape = True
207+
relax_settings.volume = False
227208
else:
228209
# Do not perform any relaxation
229-
relax.perform = plugins.DataFactory('core.bool')(False)
230-
210+
relax_settings.perform = False
231211
if threshold_forces is not None:
232212
threshold = threshold_forces
233213
else:
234214
threshold = protocol['relax']['threshold_forces']
235-
relax.force_cutoff = plugins.DataFactory('float')(threshold)
215+
relax_settings.force_cutoff = plugins.DataFactory('float')(threshold)
236216

237217
if threshold_stress is not None:
238218
raise ValueError('Using a stress threshold is not directly available in VASP during relaxation.')
239219

240-
builder.relax = relax
220+
builder.relax_settings = relax_settings
241221

242222
return builder

0 commit comments

Comments
 (0)