aiidateam / aiida-pseudo

MIT License
5 stars 8 forks source link

CLI: filter cutoffs from JSON file for family cutoffs set #132

Closed mbercx closed 1 year ago

mbercx commented 1 year ago

Fixes #93

Currently the family cutoffs set command requires that the JSON file that contains the cutoffs only has the cutoff keys specified for each element. This is because the cutoffs are validated by the RecommendedCutoffMixin.validate_cutoffs() method, which doesn't allow for extraneous keys.

However, the .json file could have been adapted by the user from e.g. the SSSP metadata.json or some other dictionary that also contains other keys. As long as the cutoff keys are defined, we shouldn't raise an error just because there are other keys present.

Here we first filter the data loaded from the JSON file for the cutoffs, before passing the dictionary to the set_cutoffs method.

mbercx commented 1 year ago

@sphuber while working myself back into https://github.com/aiidateam/aiida-pseudo/pull/94 I decided to separate the work into different PR's since not everything is related to the same topic and it'll be easier to rebase/adapt/review.

sphuber commented 1 year ago

Thanks @mbercx