1
1
# -*- coding: utf-8 -*-
2
2
"""Implementation of `aiida_common_workflows.common.relax.generator.CommonRelaxInputGenerator` for BigDFT."""
3
- from aiida import engine , orm , plugins
3
+ from aiida import engine , plugins
4
4
5
5
from aiida_common_workflows .common import ElectronicType , RelaxType , SpinType
6
6
from aiida_common_workflows .generators import ChoiceType , CodeType
@@ -176,18 +176,10 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
176
176
177
177
builder = self .process_class .get_builder ()
178
178
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
188
180
189
181
# 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 :
191
183
inputdict = copy .deepcopy (self .get_protocol (protocol )['inputdict_cubic' ])
192
184
else :
193
185
inputdict = copy .deepcopy (self .get_protocol (protocol )['inputdict_linear' ])
@@ -200,7 +192,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
200
192
else :
201
193
hgrids = logfile .get ('dft' ).get ('hgrids' )
202
194
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 ] / \
204
196
reference_workchain .inputs .structure .cell_lengths [0 ]
205
197
206
198
if electronic_type is ElectronicType .METAL :
@@ -227,12 +219,18 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
227
219
if self .get_protocol (protocol ).get ('kpoints_distance' ):
228
220
inputdict ['kpt' ] = {'method' : 'auto' , 'kptrlen' : self .get_protocol (protocol ).get ('kpoints_distance' )}
229
221
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' )
234
231
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' ]}
237
235
238
236
return builder
0 commit comments