Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions src/aiida_quantumespresso/workflows/pw/relax.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,20 @@ def get_builder_from_protocol(
namespace.pw.parameters['CELL']['cell_dofree'] = 'shape'

if relax_type in (RelaxType.CELL, RelaxType.POSITIONS_CELL):
pbc_cell_dofree_map = {
(True, True, True): 'all',
(True, False, False): 'x',
(False, True, False): 'y',
(False, False, True): 'z',
(True, True, False): '2Dxy',
}
if structure.pbc in pbc_cell_dofree_map:
namespace.pw.parameters['CELL']['cell_dofree'] = pbc_cell_dofree_map[structure.pbc]
else:
raise ValueError(
f'Structures with periodic boundary conditions `{structure.pbc}` are not supported.'
)
if 'cell_dofree' not in namespace.pw.parameters.get('CELL', {}):
pbc_cell_dofree_map = {
(True, True, True): 'all',
(True, False, False): 'x',
(False, True, False): 'y',
(False, False, True): 'z',
(True, True, False): '2Dxy',
}
if structure.pbc in pbc_cell_dofree_map:
namespace.pw.parameters['CELL']['cell_dofree'] = pbc_cell_dofree_map[structure.pbc]
else:
raise ValueError(
f'Structures with periodic boundary conditions `{structure.pbc}` are not supported.'
)

builder = cls.get_builder()
builder.base_relax = base_relax
Expand Down Expand Up @@ -405,7 +406,7 @@ def on_terminated(self):
def _fix_atomic_positions(structure, settings):
"""Fix the atomic positions, by setting the `FIXED_COORDS` key in the `settings` input node."""
settings = settings.get_dict() if settings is not None else {}

settings['FIXED_COORDS'] = [[True, True, True]] * len(structure.sites)
if 'FIXED_COORDS' not in settings:
settings['FIXED_COORDS'] = [[True, True, True]] * len(structure.sites)

return settings
Loading