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

Add support for PseudoDojo PAW pseudos (alternative) #42

Merged
merged 4 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions aiida_pseudo/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ def cmd_install_pseudo_dojo(version, functional, relativistic, protocol, pseudo_
'upf': UpfData,
}

# yapf: disable
paw_configurations = (
PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'standard', 'jthxml'),
PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'stringent', 'jthxml'),
PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'standard', 'jthxml'),
PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'stringent', 'jthxml')
)
# yapf: enable

try:
pseudo_type = pseudo_type_mapping[pseudo_format]
except KeyError:
Expand Down Expand Up @@ -231,6 +240,29 @@ def cmd_install_pseudo_dojo(version, functional, relativistic, protocol, pseudo_
msg = f'md5 of pseudo for element {element} does not match that of the metadata {md5}'
echo.echo_critical(msg)

# The PAW configurations have missing cutoffs for the Lanthanides, which have ben replaced with a placeholder
# value of `-1`. We replace these with the 1.5 * the maximum cutoff from the same stringency so that these
# potentials are still usable, but this should be taken as a _rough_ approximation.
# We check only the `cutoff_wfc` because `cutoff_rho` is not provided by PseudoDojo and is therefore
# locally calculated in `PseudoDojoFamily.parse_djrepos_from_archive` as `2.0 * cutoff_wfc` for PAW.
if configuration in paw_configurations:
adjusted_cutoffs = {}
for stringency, str_cutoffs in cutoffs.items():
adjusted_cutoffs[stringency] = []
max_cutoff_wfc = max([str_cutoffs[element]['cutoff_wfc'] for element in str_cutoffs])
filler_cutoff_wfc = max_cutoff_wfc * 1.5
for element, cutoff in str_cutoffs.items():
if cutoff['cutoff_wfc'] <= 0:
cutoffs[stringency][element]['cutoff_wfc'] = filler_cutoff_wfc
cutoffs[stringency][element]['cutoff_rho'] = 2.0 * filler_cutoff_wfc
adjusted_cutoffs[stringency].append(element)

for stringency, elements in adjusted_cutoffs.items():
msg = f'stringency `{stringency}` has missing recommended cutoffs for elements ' \
f'{", ".join(elements)}: as a substitute, 1.5 * the maximum cutoff of the stringency ' \
'was set for these elements. USE WITH CAUTION!'
echo.echo_warning(msg)

family.description = description
family.set_cutoffs(cutoffs, default_stringency=default_stringency)

Expand Down
10 changes: 5 additions & 5 deletions aiida_pseudo/groups/family/pseudo_dojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ class PseudoDojoFamily(RecommendedCutoffMixin, PseudoPotentialFamily):
PseudoDojoConfiguration('0.4', 'PBE', 'FR', 'stringent', 'psml'),
PseudoDojoConfiguration('0.4', 'PBEsol', 'FR', 'standard', 'psml'),
PseudoDojoConfiguration('0.4', 'PBEsol', 'FR', 'stringent', 'psml'),
# PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'standard', 'jthxml'), # paw families have placeholder cutoffs
# PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'stringent', 'jthxml'),
# PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'standard', 'jthxml'),
# PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'stringent', 'jthxml')
PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'standard', 'jthxml'),
PseudoDojoConfiguration('1.0', 'PBE', 'SR', 'stringent', 'jthxml'),
PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'standard', 'jthxml'),
PseudoDojoConfiguration('1.0', 'LDA', 'SR', 'stringent', 'jthxml')
)
# yapf: enable

Expand Down Expand Up @@ -206,7 +206,7 @@ def get_cutoffs_from_djrepo(cls, djrepo, pseudo_type):
:returns: cutoffs dictionary (in eV) where keys are stringency levels and values are
{'cutoff_wfc': ..., 'cutoff_rho': ...}
"""
dual_mapping = {UpfData: 8.0, Psp8Data: 8.0, PsmlData: 8.0, JthXmlData: 2.0}
dual_mapping = {UpfData: 4.0, Psp8Data: 4.0, PsmlData: 4.0, JthXmlData: 2.0}

try:
dual = dual_mapping[pseudo_type]
Expand Down