Skip to content

Commit

Permalink
Protocols: add relax_type to the get_builder_from_protocol
Browse files Browse the repository at this point in the history
This argument is directly passed to the input of the `PwRelaxWorkChain`
with the exact same name.
  • Loading branch information
sphuber committed Dec 10, 2020
1 parent 6b2373b commit f076bfa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aiida_quantumespresso/workflows/protocols/pw/relax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_inputs:
clean_workdir: True
max_meta_convergence_iterations: 5
meta_convergence: True
relaxation_scheme: vc-relax
relax_type: atoms_cell
volume_convergence: 0.02
base:
pw:
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/workflows/pw/relax.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_builder_from_protocol(cls, code, structure, protocol=None, overrides=Non
builder.clean_workdir = orm.Bool(inputs['clean_workdir'])
builder.max_meta_convergence_iterations = orm.Int(inputs['max_meta_convergence_iterations'])
builder.meta_convergence = orm.Bool(inputs['meta_convergence'])
builder.relaxation_scheme = orm.Str(inputs['relaxation_scheme'])
builder.relax_type = orm.Str(inputs['relax_type'])
builder.volume_convergence = orm.Float(inputs['volume_convergence'])

return builder
Expand Down
12 changes: 11 additions & 1 deletion tests/workflows/protocols/pw/test_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from aiida.engine import ProcessBuilder

from aiida_quantumespresso.common.types import ElectronicType, SpinType
from aiida_quantumespresso.common.types import ElectronicType, RelaxType, SpinType
from aiida_quantumespresso.workflows.pw.bands import PwBandsWorkChain


Expand Down Expand Up @@ -63,3 +63,13 @@ def test_spin_type(fixture_code, generate_structure):
parameters = namespace['pw']['parameters'].get_dict()
assert parameters['SYSTEM']['nspin'] == 2
assert parameters['SYSTEM']['starting_magnetization'] == {'Si': 0.1}


def test_relax_type(fixture_code, generate_structure):
"""Test ``PwBandsWorkChain.get_builder_from_protocol`` overriding the ``relax_type`` input."""
code = fixture_code('quantumespresso.pw')
structure = generate_structure()

overrides = {'relax': {'relax_type': RelaxType.NONE.value}}
builder = PwBandsWorkChain.get_builder_from_protocol(code, structure, overrides=overrides)
assert builder.relax['relax_type'].value == RelaxType.NONE.value
2 changes: 1 addition & 1 deletion tests/workflows/protocols/pw/test_bands/test_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ relax:
Si: Si<md5=b8624bea1910ebe720dc5977d5a73a7d>
max_meta_convergence_iterations: 5
meta_convergence: true
relaxation_scheme: vc-relax
relax_type: atoms_cell
volume_convergence: 0.02
scf:
kpoints_distance: 0.15
Expand Down
2 changes: 1 addition & 1 deletion tests/workflows/protocols/pw/test_relax/test_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ base_final_scf:
clean_workdir: true
max_meta_convergence_iterations: 5
meta_convergence: true
relaxation_scheme: vc-relax
relax_type: atoms_cell
structure: Si2
volume_convergence: 0.02

0 comments on commit f076bfa

Please sign in to comment.