Skip to content

Commit 4d8d95e

Browse files
committed
Fix implementation for BigDFT
1 parent af83379 commit 4d8d95e

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

aiida_common_workflows/workflows/relax/bigdft/generator.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
"""Implementation of `aiida_common_workflows.common.relax.generator.CommonRelaxInputGenerator` for BigDFT."""
3-
from aiida import engine, orm, plugins
3+
from aiida import engine, plugins
44

55
from aiida_common_workflows.common import ElectronicType, RelaxType, SpinType
66
from aiida_common_workflows.generators import ChoiceType, CodeType
@@ -176,18 +176,10 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
176176

177177
builder = self.process_class.get_builder()
178178

179-
if relax_type == RelaxType.POSITIONS:
180-
relaxation_schema = 'relax'
181-
elif relax_type == RelaxType.NONE:
182-
relaxation_schema = 'relax'
183-
builder.relax.perform = orm.Bool(False)
184-
else:
185-
raise ValueError(f'relaxation type `{relax_type.value}` is not supported')
186-
187-
builder.structure = structure
179+
builder.BigDFT.structure = structure
188180

189181
# for now apply simple stupid heuristic : atoms < 200 -> cubic, else -> linear.
190-
if len(builder.structure.sites) <= 200:
182+
if len(builder.BigDFT.structure.sites) <= 200:
191183
inputdict = copy.deepcopy(self.get_protocol(protocol)['inputdict_cubic'])
192184
else:
193185
inputdict = copy.deepcopy(self.get_protocol(protocol)['inputdict_linear'])
@@ -200,7 +192,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
200192
else:
201193
hgrids = logfile.get('dft').get('hgrids')
202194
first_hgrid = hgrids[0] if isinstance(hgrids, list) else hgrids
203-
inputdict['dft']['hgrids'] = first_hgrid * builder.structure.cell_lengths[0] / \
195+
inputdict['dft']['hgrids'] = first_hgrid * builder.BigDFT.structure.cell_lengths[0] / \
204196
reference_workchain.inputs.structure.cell_lengths[0]
205197

206198
if electronic_type is ElectronicType.METAL:
@@ -227,12 +219,18 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
227219
if self.get_protocol(protocol).get('kpoints_distance'):
228220
inputdict['kpt'] = {'method': 'auto', 'kptrlen': self.get_protocol(protocol).get('kpoints_distance')}
229221

230-
builder.parameters = BigDFTParameters(dict=inputdict)
231-
builder.code = engines[relaxation_schema]['code']
232-
run_opts = {'options': engines[relaxation_schema]['options']}
233-
builder.run_opts = orm.Dict(dict=run_opts)
222+
if relax_type == RelaxType.POSITIONS:
223+
inputdict['geopt'] = {
224+
'method': 'FIRE',
225+
'forcemax': threshold_forces or 0,
226+
}
227+
elif relax_type == RelaxType.NONE:
228+
pass
229+
else:
230+
raise ValueError(f'relaxation type `{relax_type.value}` is not supported')
234231

235-
if threshold_forces is not None:
236-
builder.relax.threshold_forces = orm.Float(threshold_forces)
232+
builder.BigDFT.parameters = BigDFTParameters(dict=inputdict)
233+
builder.BigDFT.code = engines['relax']['code']
234+
builder.BigDFT.metadata = {'options': engines['relax']['options']}
237235

238236
return builder

aiida_common_workflows/workflows/relax/bigdft/workchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class BigDftCommonRelaxWorkChain(CommonRelaxWorkChain):
1212
"""Implementation of `aiida_common_workflows.common.relax.workchain.CommonRelaxWorkChain` for BigDFT."""
1313

14-
_process_class = WorkflowFactory('bigdft.relax')
14+
_process_class = WorkflowFactory('bigdft')
1515
_generator_class = BigDftCommonRelaxInputGenerator
1616

1717
@classmethod

0 commit comments

Comments
 (0)