Skip to content

Commit

Permalink
✨ Add semicore support for PseudoDojo v0.5 PBE
Browse files Browse the repository at this point in the history
Generate the JSON files indicating the semicore orbitals for PseudoDojo v0.5
PBE, including the `standard` and `stringent` protocols.

To show the efficacy of the script used to generate the JSON files, the JSONs
containing the semicores for PseudoDojo v0.4 LDA/PBE standard have also been
regenerated.

Additionally, the "stringent" versions of the PseudoDojo v0.4 PBE/LDA versions
are also generated.

To test that all pseudo potentials are truly supported, a sanity test is added
which checks that the `get_pseudo_orbitals()` function can find all pseudos for
the supported families.
  • Loading branch information
mbercx committed Nov 18, 2023
1 parent 9d7a996 commit 1f239a9
Show file tree
Hide file tree
Showing 6 changed files with 3,715 additions and 2 deletions.
24 changes: 24 additions & 0 deletions dev/test_pseudos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Test that the data provided for the pseudopotentials is complete and correct."""

from aiida import load_profile, orm

from aiida_wannier90_workflows.utils.pseudo import get_pseudo_orbitals

load_profile()


for family in (
"PseudoDojo/0.4/LDA/SR/standard/upf",
"PseudoDojo/0.4/LDA/SR/stringent/upf",
"PseudoDojo/0.4/PBE/SR/standard/upf",
"PseudoDojo/0.4/PBE/SR/stringent/upf",
"PseudoDojo/0.5/PBE/SR/standard/upf",
"PseudoDojo/0.5/PBE/SR/stringent/upf",
"PseudoDojo/0.5/PBE/SR/stringent/upf",
):
print(f"Testing family {family}")
for el, pseudo in orm.load_group(family).pseudos.items():
try:
get_pseudo_orbitals({el: pseudo})
except ValueError as exc:
print(exc)
22 changes: 20 additions & 2 deletions src/aiida_wannier90_workflows/utils/pseudo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ def get_pseudo_and_cutoff(


def get_pseudo_orbitals(pseudos: ty.Mapping[str, PseudoPotentialData]) -> dict:
"""Get the pseudo wavefunctions contained in the pseudopotential.
"""Get the pseudo wave functions contained in the pseudo potential.
Currently only support the following pseudopotentials installed by `aiida-pseudo`:
1. SSSP/1.1/PBE/efficiency
2. SSSP/1.1/PBEsol/efficiency
3. PseudoDojo/0.4/LDA/SR/standard/upf
3. PseudoDojo/0.4/LDA/SR/stringent/upf
4. PseudoDojo/0.4/PBE/SR/standard/upf
5. PseudoDojo/0.4/PBE/SR/stringent/upf
6. PseudoDojo/0.5/PBE/SR/standard/upf
7. PseudoDojo/0.5/PBE/SR/stringent/upf
"""
from .data import load_pseudo_metadata

Expand All @@ -63,14 +69,26 @@ def get_pseudo_orbitals(pseudos: ty.Mapping[str, PseudoPotentialData]) -> dict:
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.4_PBE_SR_standard_upf.json")
)
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.4_PBE_SR_stringent_upf.json")
)
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.5_PBE_SR_standard_upf.json")
)
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.5_PBE_SR_stringent_upf.json")
)
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.4_LDA_SR_standard_upf.json")
)
pseudo_data.append(
load_pseudo_metadata("semicore/PseudoDojo_0.4_LDA_SR_stringent_upf.json")
)

pseudo_orbitals = {}
for element in pseudos:
for data in pseudo_data:
if data[element]["md5"] == pseudos[element].md5:
if data.get(element, {}).get("md5", "") == pseudos[element].md5:
pseudo_orbitals[element] = data[element]
break
else:
Expand Down
Loading

0 comments on commit 1f239a9

Please sign in to comment.