Skip to content

Get pseudos without requiring recommended cutoffs - #98

Open
elinscott wants to merge 2 commits into
aiidateam:mainfrom
elinscott:pseudo-family-without-cutoffs
Open

Get pseudos without requiring recommended cutoffs#98
elinscott wants to merge 2 commits into
aiidateam:mainfrom
elinscott:pseudo-family-without-cutoffs

Conversation

@elinscott

Copy link
Copy Markdown
Collaborator

Summary

This PR enables custom pseudo families to be used when building workflows from protocols.

Problem

Wannier90BaseWorkChain.get_builder_from_protocol refuses any pseudopotential family that recommends no cutoffs, even though the builder never uses cutoffs. THis means that one can't use...

  • a CutoffsPseudoPotentialFamily whose stringencies were never set, refused with failed to obtain recommended cutoffs for pseudo family ...: no default stringency has been defined;
  • a plain PseudoPotentialFamily (the shape aiida-pseudo install family produces) refused with required pseudo family ... is not installed because that class is not among those the lookup searches.

Cause

Both come from one line

pseudos, _, _ = get_pseudo_and_cutoff(pseudo_family, structure)

which asks for cutoffs and then discards them; the pseudos are wanted only to count bands and projections. That is the only call to get_pseudo_and_cutoff in the package.

The practical cost is that pseudopotentials outside aiida-pseudo's catalogue cannot be Wannierized through the protocols at all.

Changes

  • Add get_pseudos(pseudo_family, structure), which resolves a family by label and returns its pseudos per kind. It accepts any aiida-pseudo family class and asks for no cutoffs.
  • Take the Wannier90 protocol builder's pseudos from get_pseudos. Which families are accepted changes; what is built from them does not.
  • Leave get_pseudo_and_cutoff as it was for external callers: same signature and return, and it still searches only SSSP, PseudoDojo and cutoffs families, because those are the ones that can recommend cutoffs.

With this, a user's own pseudos reach the Wannier90 builder:

$ aiida-pseudo install family ./my_pseudos.tar.gz MyPseudos/local
builder = Wannier90BandsWorkChain.get_builder_from_protocol(
    codes=codes,
    structure=structure,
    pseudo_family="MyPseudos/local",
)

The pw.x sub-workchains still need ecutwfc and ecutrho supplied through overrides, since PwBaseWorkChain really does use the cutoffs. A cutoff-less family with no such overrides now fails there, naming the cutoffs, instead of failing earlier in the Wannier90 builder that had no use for them.

Testing

  • Two builder tests, over both refused shapes, assert that Wannier90BaseWorkChain.get_builder_from_protocol produces wannier90 parameters equal to those built from a family that does recommend cutoffs. Equality is the point: it discriminates a builder that merely stops raising from one that builds the same inputs. Both fail on main — one with the stringency error, one with "is not installed" — while the other nineteen tests in that file pass unchanged.
  • Unit tests cover get_pseudos over the two refused shapes, an SSSP family as control, and an unknown label.
  • Two tests pin get_pseudo_and_cutoff's unchanged contract: it still returns SSSP's cutoffs, and it still refuses a family that cannot supply them.
  • The full suite shows the same set of failures before and after the change, with nine more passing tests.

Fixtures for the two family shapes are added to tests/conftest.py, next to the existing pseudos fixture and built from the same synthetic UPF streams, so the pseudos differ from the SSSP family's only in which group they belong to.

Related

#95 will fix the failing test suite

#94 removes the other wall a custom pseudo family meets: get_pseudo_orbitals resolves pseudopotentials by md5 against the bundled semicore tables, so anything outside the curated families fails there too. The two are independent — this one is the cutoff lookup, that one the orbital lookup — and a hand-built family needs both to get through the protocols.

`Wannier90BaseWorkChain.get_builder_from_protocol` refused any
pseudopotential family that recommends no cutoffs: a cutoffs family
with no stringency set was rejected with "no default stringency has
been defined", and a plain family, which `aiida-pseudo install family`
produces, with "is not installed". The builder discarded the cutoffs it
had just demanded.

- Add `get_pseudos`, which resolves a family of any `aiida-pseudo`
  class by label and returns its pseudos for a structure.
- Take the Wannier90 protocol builder's pseudos from it, in place of
  `get_pseudo_and_cutoff`.
- Keep `get_pseudo_and_cutoff` searching only the families that can
  recommend cutoffs, so external callers see no change.
- Cover both refused family shapes at the builder, against a family
  with cutoffs as control.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@elinscott elinscott added this to the v2.9.0 milestone Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant