Skip to content

Commit af69283

Browse files
committed
Adding support for explicit k-points in VASP generator
1 parent 27e6458 commit af69283

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/aiida_common_workflows/workflows/relax/vasp/generator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,14 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
183183
previous_kpoints.base.attributes.get('mesh'), previous_kpoints.base.attributes.get('offset')
184184
)
185185
else:
186-
kpoints.set_kpoints_mesh_from_density(protocol['kpoint_distance'])
186+
if 'kpoints' in protocol and 'kpoint_distance' in protocol:
187+
raise ValueError('Protocol cannot define both `kpoints` and `kpoint_distance` in protocol.')
188+
if 'kpoints' not in protocol and 'kpoint_distance' not in protocol:
189+
raise ValueError('Protocol must define either `kpoints` or `kpoint_distance` in protocol.')
190+
if 'kpoints' in protocol:
191+
kpoints.set_kpoints_mesh(protocol['kpoints'])
192+
else:
193+
kpoints.set_kpoints_mesh_from_density(protocol['kpoint_distance'])
187194
builder.vasp.kpoints = kpoints
188195

189196
# Set the relax parameters

0 commit comments

Comments
 (0)