Skip to content

Commit

Permalink
Fix implementation for BigDFT
Browse files Browse the repository at this point in the history
  • Loading branch information
sphuber committed Feb 19, 2024
1 parent 99eeaa1 commit f1d16c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
28 changes: 13 additions & 15 deletions aiida_common_workflows/workflows/relax/bigdft/generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Implementation of `aiida_common_workflows.common.relax.generator.CommonRelaxInputGenerator` for BigDFT."""
from aiida import engine, orm, plugins
from aiida import engine, plugins

from aiida_common_workflows.common import ElectronicType, RelaxType, SpinType
from aiida_common_workflows.generators import ChoiceType, CodeType
Expand Down Expand Up @@ -176,14 +176,6 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:

builder = self.process_class.get_builder()

if relax_type == RelaxType.POSITIONS:
relaxation_schema = 'relax'
elif relax_type == RelaxType.NONE:
relaxation_schema = 'relax'
builder.relax.perform = orm.Bool(False)
else:
raise ValueError(f'relaxation type `{relax_type.value}` is not supported')

builder.structure = structure

# for now apply simple stupid heuristic : atoms < 200 -> cubic, else -> linear.
Expand Down Expand Up @@ -227,12 +219,18 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
if self.get_protocol(protocol).get('kpoints_distance'):
inputdict['kpt'] = {'method': 'auto', 'kptrlen': self.get_protocol(protocol).get('kpoints_distance')}

builder.parameters = BigDFTParameters(dict=inputdict)
builder.code = engines[relaxation_schema]['code']
run_opts = {'options': engines[relaxation_schema]['options']}
builder.run_opts = orm.Dict(dict=run_opts)
if relax_type == RelaxType.POSITIONS:
inputdict['geopt'] = {
'method': 'FIRE',
'forcemax': threshold_forces or 0,
}
elif relax_type == RelaxType.NONE:
pass
else:
raise ValueError(f'relaxation type `{relax_type.value}` is not supported')

if threshold_forces is not None:
builder.relax.threshold_forces = orm.Float(threshold_forces)
builder.parameters = BigDFTParameters(dict=inputdict)
builder.code = engines['relax']['code']
builder.metadata = {'options': engines['relax']['options']}

return builder
2 changes: 1 addition & 1 deletion aiida_common_workflows/workflows/relax/bigdft/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class BigDftCommonRelaxWorkChain(CommonRelaxWorkChain):
"""Implementation of `aiida_common_workflows.common.relax.workchain.CommonRelaxWorkChain` for BigDFT."""

_process_class = WorkflowFactory('bigdft.relax')
_process_class = WorkflowFactory('bigdft')
_generator_class = BigDftCommonRelaxInputGenerator

@classmethod
Expand Down

0 comments on commit f1d16c7

Please sign in to comment.