Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecommendedCutoffMixin: Remove workaround for stringency units #147

Merged
merged 1 commit into from
Jan 24, 2023
Merged
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
13 changes: 2 additions & 11 deletions src/aiida_pseudo/groups/mixins/cutoffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def delete_cutoffs(self, stringency: str) -> None:
cutoffs_dict.pop(stringency)

cutoffs_unit_dict = self._get_cutoffs_unit_dict()
cutoffs_unit_dict.pop(stringency, None) # `None` is added to support pseudo families installed with v0.5.0
cutoffs_unit_dict.pop(stringency)

self.base.extras.set(self._key_cutoffs, cutoffs_dict)
self.base.extras.set(self._key_cutoffs_unit, cutoffs_unit_dict)
Expand Down Expand Up @@ -261,16 +261,7 @@ def get_cutoffs_unit(self, stringency: str = None) -> str:
"""
self.validate_stringency(stringency)
stringency = stringency or self.get_default_stringency()

try:
return self._get_cutoffs_unit_dict()[stringency]
except KeyError:
# Workaround to deal with pseudo families installed in v0.5.0 - Set default unit in case it is not in extras
cutoffs_unit_dict = self._get_cutoffs_unit_dict()
cutoffs_unit_dict[stringency] = 'eV'
self.base.extras.set(self._key_cutoffs_unit, cutoffs_unit_dict)
return 'eV'
# End of workaround
return self._get_cutoffs_unit_dict()[stringency]

def get_recommended_cutoffs(self, *, elements=None, structure=None, stringency=None, unit=None):
"""Return tuple of recommended wavefunction and density cutoffs for the given elements or ``StructureData``.
Expand Down