Skip to content

Commit

Permalink
DielectricWorkChain: fix validator (#88)
Browse files Browse the repository at this point in the history
The validator would complain if the `central_difference` input
is not present for some reason, e.g., because of modification
in the main aiida-core/plumpy functionality. We therefore add
a simple check to avoid having issues.
  • Loading branch information
bastonero authored Jan 17, 2025
1 parent 7b6ef34 commit 85ecb45
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/aiida_vibroscopy/workflows/dielectric/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ def validate_parent_scf(parent_scf, _):

def validate_inputs(inputs, _):
"""Validate the entire inputs namespace."""
if 'electric_field_step' in inputs['central_difference'] and 'accuracy' not in inputs['central_difference']:
return (
'cannot evaluate numerical accuracy when `electric_field_step` '
'is specified but `accuracy` is not in `central_difference`'
)
if 'central_difference' in inputs:
if 'electric_field_step' in inputs['central_difference'] and 'accuracy' not in inputs['central_difference']:
return (
'cannot evaluate numerical accuracy when `electric_field_step` '
'is specified but `accuracy` is not in `central_difference`'
)

if 'kpoints_parallel_distance' in inputs and 'kpoints_distance' not in inputs['scf']:
return '`kpoints_parallel_distance` works only when specifying `scf.kpoints_distance`'
Expand Down

0 comments on commit 85ecb45

Please sign in to comment.