PseudoSet Module#

Functionality for gathering, parsing, and validating collections of pseudopotentials.

nexus.pseudoset.pp_elem_label(filename: PathLike, *, guard=False) → tuple[str, str] | tuple[str, str, bool][source]#

Get the label and atomic symbol of an element from a pseudopotential file name.

Parameters:
filenamePathLike

Either a Path object or the name of a file as a string.

guardbool, default=False

Optionally raise an error if the file name is invalid or if the filename does not begin with a valid element prefix.

Returns:
elem_labelstr

The label of the pseudopotential file.

symbolstr

The atomic symbol of the element that the pseudopotential file describes.

is_elembool

A bool to indicate whether or not the file has a valid element label. If guard=True this is not returned, and an error is raised if the file does not have a valid prefix.

Examples

>>> pp_elem_label("Si.ccECP.xml")
('Si', 'Si', True)
>>> pp_elem_label("Si-USPP.upf")
('Si', 'Si', True)
>>> pp_elem_label("Si_NCPP.upf")
('Si', 'Si', True)
>>> pp_elem_label("Si1.ccECP.xml")
('Si1', 'Si', True)
>>> pp_elem_label("Not_An_Element.ccECP.xml")
('Not', 'Not', False)

Passing a Path object only gets the file name.

>>> from pathlib import Path
>>> pp_elem_label(Path("/path/to/pseudo_dir/Si.ccECP.xml"))
('Si', 'Si', True)

Use guard=True if you want to raise an error and not deal with an invalid output.

>>> pp_elem_label("Not_An_Element.ccECP.xml", guard=True)
Traceback (most recent call last):
    ...
RuntimeError: cannot determine element for pseudopotential file: Not_An_Element.ccECP.xml
pseudopotential file names must be prefixed by an atomic symbol or label
(e.g. Si, Si1, etc)
nexus.pseudoset.read_upf_z_valence(file: PathLike) → int | float[source]#

Read Z-valence from a UPF-compliant pseudopotential file.

nexus.pseudoset.read_qmcpack_xml_z_valence(file: PathLike) → int | float[source]#

Read the Z-valence from a QMCPACK-compatible XML pseudopotential file.

nexus.pseudoset.read_potcar_z_valence(file: PathLike) → int | float[source]#

Read the Z-valence from a POTCAR file.

This function uses the format specifications from the VASP wiki, and assumes that the file is a valid POTCAR, so the second line should be the Z-valence [1].

References

nexus.pseudoset.ppset(label: str, **codes_pps: Collection[str])[source]#

Register pseudopotentials for codes with a label.

Deprecated since version 2.4.0: ppset has been replaced by generate_pseudoset because the labeling system that ppset requires checks for the existence of the label at runtime, whereas generate_pseudoset returns an object with a name as other generate functions do.

This is intended as a backwards-compatible interface to not break existing user code. Users are suggested to migrate to generate_pseudoset or calling PseudoSet and its methods for pseudopotential handling.

Parameters:
labelstr

Label of the pseudopotential set.

**codes_pps

Map of codes to collections of names of the pseudopotential files.

See also

PseudoSet.file_exts

Known file extensions

PseudoSet.from_dir

Automatically reading pseudos from a directory

PseudoSet.from_mixed_dir

Automatically reading pseudos from a directory

Notes

Using this function is generally discouraged for users as the use of a string label for identifying pseudopotentials prevents Python from raising a NameError when the label supplied to later functions does not match the label used when calling this function.

For this reason, it is strongly encouraged to use generate_pseudoset or PseudoSet and/or its member functions PseudoSet.from_dir and PseudoSet.from_mixed_dir.

Examples

After passing pseudo_dir to settings, call this with the file names for each pseudopotential.

>>> ppset(
...     label   = 'bfd',
...     pwscf   = ["C.BFD.upf", "H.BFD.upf", "O.BFD.upf"],
...     qmcpack = ["C.BFD.xml", "H.BFD.xml", "O.BFD.xml"],
...     )
class nexus.pseudoset.PseudoSet(pseudos: Collection[PathLike] | Mapping[Elements | str, PathLike], codes: str | Collection[str] = 'detect', Zeff_map: Mapping[PathLike, int] | None = None, *, skip_invalid: bool = False)[source]#

Bases: DevBaseNexus

Object representing a set of pseudopotentials.

Parameters:
pseudoscollection of str/Path or map of str/Elements to Path

A collection of pseudopotential files or a map of elements to file paths.

codesone or more of {“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”, “detect”}, default=”detect”

The name of the code that the pseudos are formatted for, or if "detect", will auto-detect the code name from the file extensions.

Zeff_mapMap of str/Elements to int, optional

A mapping of elements to their effective nuclear charges (Z-valences). If this is supplied, it will override any parts of the code that may try to parse the pseudopotential file to get the Z-valence.

skip_invalidbool, default=False (keyword-only)

If True, then this will emit a warning rather than raise an error if a file is not found or if the file does not have a valid name.

Attributes:
pseudosdict of str: Path

Dictionary mapping element labels to their pseudos.

codesset of one or more of {“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”}

Name of the program(s) that these pseudos are meant for. Due to overlap between some programs for file extension, this can occasionally contain more than one code.

Zeff_mapMap of str: int

A mapping of elements to their effective nuclear charges (Z-valences).

pseudo_dirsset of Path

The directories that the pseudopotentials are stored in.

pseudo_filesdict of str: str (class attribute)

Dictionary mapping pseudopotential file names to their full paths, set by passing pseudo_dir to settings.

labeled_pseudosetsdict of str: dict of str: PseudoSet (class attribute)

Pseudopotential sets registered by label, then compatible code.

Methods

copy()

from_dir(pseudo_dir[, code, extension, ...])

Read in pseudopotentials from a directory.

from_mixed_dir(pseudo_dir[, codes, ...])

Read in pseudos from a directory with pseudos for more than one code.

get_Zeff(elem_labels, *[, missing_as_ae])

Get the Z-valences for each element in the list of elements.

get_pseudos(pseudos, system, code)

Get the pseudopotential files for the elements in a physical system.

save([filepath])

clear

error

items

keys

load

nxs_print

update

values

warn

file_exts = mappingproxy({'espresso': frozenset({'.vdb', '.upf', '.van', '.rrkj3', '.ncpp'}), 'gamess': frozenset({'.gms', '.gamess'}), 'vasp': frozenset({'.potcar', '.vasp', 'potcar'}), 'qmcpack': frozenset({'.xml', '.data'}), 'rmg': frozenset({'.upf', '.xml'}), 'pyscf': frozenset({'.nwchem', '.gth'})})#
known_codes = frozenset({'espresso', 'gamess', 'pyscf', 'qmcpack', 'rmg', 'vasp'})#
code_aliases = mappingproxy({'quantum_espresso': 'espresso', 'quantum espresso': 'espresso', 'pwscf': 'espresso', 'qe': 'espresso', 'gms': 'gamess'})#
pseudo_files: ClassVar[dict[str, str]] = {}#
labeled_pseudosets: ClassVar[dict[str, dict[str, PseudoSet]]] = {}#
classmethod from_dir(pseudo_dir: PathLike, code: str = 'detect', extension: str | Collection[str] | None = None, include: str | None = None, exclude: str | None = None, Zeff_map: Mapping[PathLike, int] | None = None, *, skip_invalid: bool = False) → PseudoSet[source]#

Read in pseudopotentials from a directory.

Parameters:
pseudo_dirPathLike

The directory from which to read pseudopotentials. Does not support nested directories, except for those that contain a POTCAR file.

code{“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”, “detect”}, default=”detect”

The name of the code that the pseudos are formatted for, or if "detect", will auto-detect the code name from the file extensions.

extensionstr or list of str, optional

Optionally filter the files in the directory by their extension.

If this is None it will use the file suffixes in PseudoSet.file_exts, unless codes="detect", in which case it will do nothing.

If this is a string or list of strings, it is assumed the string(s) are the file suffixes to filter by. The strings should include a leading ., e.g. .xml, not xml.

includestr, optional

A Unix shell-style wildcard. All files matched by this are included in the final PseudoSet. By default this matches all files.

excludestr, optional

A Unix shell-style wildcard. All files matched by this are excluded in the final PseudoSet. By default this matches nothing.

Zeff_mapMap of str/Elements to int, optional

A mapping of elements to their effective nuclear charges (Z-valences). If this is supplied, it will override any parts of the code that may try to parse the pseudopotential to get the Z-valence.

skip_invalidbool, default=False (keyword-only)

If True, then this will emit a warning rather than raise an error if a file is not found or if the file does not have a valid name.

See also

file_exts

Dictionary mapping codes to file extensions.

known_codes

Codes known by Nexus.

Examples

Reading pseudos in a directory with only one style of pseudo.

>>> os.listdir(pseudo_dir)
['H.ccECP.xml', 'C.ccECP.xml', 'Fe.ccECP.xml']
>>> psps = PseudoSet.from_dir(pseudo_dir)
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
H: /path/to/pseudo_dir/H.ccECP.xml
C: /path/to/pseudo_dir/C.ccECP.xml
Fe: /path/to/pseudo_dir/Fe.ccECP.xml

Reading in only the UPF pseudos in a directory with UPF and XML pseudos.

>>> os.listdir(pseudo_dir)
['H.ccECP.xml', 'C.ccECP.xml', 'H.ccECP.upf', 'C.ccECP.upf']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="espresso")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C.ccECP.upf
H: /path/to/pseudo_dir/H.ccECP.upf

Filtering two different kinds of pseudos with the same extensions.

>>> os.listdir(pseudo_dir)
['H.ccECP.upf', 'C.ccECP.upf', 'H.USPP.upf', 'C.USPP.upf']
>>> psps = PseudoSet.from_dir(pseudo_dir, include="*USPP*")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C.USPP.upf
H: /path/to/pseudo_dir/H.USPP.upf

Filtering pseudos by both extension and pattern.

>>> os.listdir(pseudo_dir)
['H.ccECP.upf', 'C.ccECP.upf', 'H.USPP.upf', 'C.USPP.upf', 'H.ccECP.xml', 'C.ccECP.xml']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="espresso", include="*ccECP*")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C.ccECP.upf
H: /path/to/pseudo_dir/H.ccECP.upf

Filtering out VASP pseudos with similar names. Pattern matches anything without an underscore.

>>> os.listdir(pseudo_dir)
['H_sv_GW', 'C', 'C_GW', 'H_sv', 'H_GW', 'C_sv_GW', 'C_sv', 'H']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="vasp", exclude="*_*")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C/POTCAR
H: /path/to/pseudo_dir/H/POTCAR

Including VASP pseudos ending with _sv.

>>> os.listdir(pseudo_dir)
['H_sv_GW', 'C', 'C_GW', 'H_sv', 'H_GW', 'C_sv_GW', 'C_sv', 'H']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="vasp", include="*_sv")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C_sv/POTCAR
H: /path/to/pseudo_dir/H_sv/POTCAR

Including VASP pseudos ending with _GW, but do not contain _sv.

>>> os.listdir(pseudo_dir)
['H_sv_GW', 'C', 'C_GW', 'H_sv', 'H_GW', 'C_sv_GW', 'C_sv', 'H']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="vasp", include="*_GW", exclude="*_sv*")
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C_GW/POTCAR
H: /path/to/pseudo_dir/H_GW/POTCAR

Including only VASP pseudos ending with _sv_GW.

>>> os.listdir(pseudo_dir)
['H_sv_GW', 'C', 'C_GW', 'H_sv', 'H_GW', 'C_sv_GW', 'C_sv', 'H']
>>> psps = PseudoSet.from_dir(pseudo_dir, code="vasp", include="*_sv_GW",)
>>> for lbl, pth in psps.pseudos.items(): print(f"{lbl}: {pth}")
C: /path/to/pseudo_dir/C_sv_GW/POTCAR
H: /path/to/pseudo_dir/H_sv_GW/POTCAR
classmethod from_mixed_dir(pseudo_dir: PathLike, codes: str | Collection[str] | None = None, extensions: Mapping[str, set[str]] | str | None = None, include: Mapping[str, str] | str | None = None, exclude: Mapping[str, str] | str | None = None, code_Zeff_map: Mapping[str, Mapping[str, int]] | Mapping[str, int] | None = None, *, skip_invalid: bool = False) → dict[Literal['espresso', 'gamess', 'vasp', 'qmcpack', 'rmg', 'pyscf'], PseudoSet][source]#

Read in pseudos from a directory with pseudos for more than one code.

Parameters:
pseudo_dirPathLike

The directory from which to read pseudopotentials. Does not support nested directories, except for those that contain a POTCAR file.

codesone or more of {“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”}, optional

The code(s) to use to separate the files in the directory into their respective groups.

extensionsMap of codes to set of str or a single str, optional

A dictionary mapping codes to the file extensions corresponding to those labels, or a single string that will be applied to all codes. If this is not provided, then the filters are automatically populated by the codes in codes.

includeMap of codes to str or single str, optional

A dictionary mapping codes to a Unix shell-style wildcard. All files matched by this are included in the final PseudoSet. By default this matches all files.

excludeMap of codes to str or single str, optional

A dictionary mapping codes to a Unix shell-style wildcard. All files matched by this are excluded in the final PseudoSet. By default this matches all files.

code_Zeff_mapMap of codes to Map of str/Elements to int or Map of str/Elements to int, optional

A mapping for each code that maps elements to their effective nuclear charges (Z-valences), or a single mapping that will be applied to all codes. If this is supplied, it will override any parts of the code that may try to parse the pseudopotential to get the Z-valence.

skip_invalidbool, default=False (keyword-only)

If True, then this will emit a warning rather than raise an error if a file is not found or if the file does not have a valid name.

Returns:
pseudosdict of str: PseudoSet

A map from the labels provided to the function to the PseudoSet objects that were created from the pseudos in the directory.

See also

from_dir

Used to get pseudos after filters have been established.

file_exts

Dictionary mapping codes to file extensions.

known_codes

Codes known by Nexus.

Notes

This function is the most generous in terms of what it is able to parse and separate, however it can result in errors if you have multiple pseudos with the same file extension for the same element. If you have a lot of pseudos with the same extension, you should use PseudoSet.from_dir and provide a pattern to separate the pseudos.

Examples

Filter a large collection of pseudos for multiple codes.

>>> print(contents_of_pseudo_dir)
pseudo_dir
├── C
│   └── POTCAR
├── C.BFD.gms
├── C.BFD.gth
├── C.ccECP.upf
├── C.ccECP.xml
├── C.USPP.upf
├── H
│   └── POTCAR
├── H.BFD.gms
├── H.BFD.gth
├── H.ccECP.upf
├── H.ccECP.xml
└── H.USPP.upf
>>> psps = PseudoSet.from_mixed_dir(
...     pseudo_dir=pseudo_dir,
...     patterns={"espresso": "ccECP", "rmg": "USPP"}
... )
>>> for code, ps_set in psps.items():
...     print(f"{code} pseudos:")
...     for lbl, psp in ps_set.pseudos.items():
...         print(f"  {lbl}: {psp}")
espresso pseudos:
H: /path/to/pseudo_dir/H.ccECP.upf
C: /path/to/pseudo_dir/C.ccECP.upf
gamess pseudos:
C: /path/to/pseudo_dir/C.BFD.gms
H: /path/to/pseudo_dir/H.BFD.gms
vasp pseudos:
C: /path/to/pseudo_dir/C/POTCAR
H: /path/to/pseudo_dir/H/POTCAR
qmcpack pseudos:
C: /path/to/pseudo_dir/C.ccECP.xml
H: /path/to/pseudo_dir/H.ccECP.xml
rmg pseudos:
C: /path/to/pseudo_dir/C.USPP.upf
H: /path/to/pseudo_dir/H.USPP.upf
pyscf pseudos:
C: /path/to/pseudo_dir/C.BFD.gth
H: /path/to/pseudo_dir/H.BFD.gth
static get_pseudos(pseudos: PseudoSet | str | Collection[str] | dict[str, Path] | None, system: PhysicalSystem | Collection[str], code: Literal['espresso', 'gamess', 'vasp', 'qmcpack', 'rmg', 'pyscf']) → dict[str, str][source]#

Get the pseudopotential files for the elements in a physical system.

Parameters:
pseudosPseudoSet or str or Collection of str or dict[str: PathLike] or None

Either a PseudoSet object, a string label from ppset, a list of pseudopotential file names, a dictionary mapping file names to file paths, or None.

systemPhysicalSystem or collection of str or None

The system to get pseudopotentials for, or a collection of element labels, or None.

code{“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”}

The name of the code requesting the pseudopotentials. This provides a way to ensure the user does not provide the wrong pseudos to a generate call.

Returns:
pseudosdict[str: str]

A dictionary mapping pseudopotential file names to their full paths.

Examples

Call with an instance of PseudoSet.

>>> psps = PseudoSet(["C.ccECP.xml", "H.ccECP.xml", "O.ccECP.xml"])
>>> PseudoSet.get_pseudos(
...     pseudos=psps,
...     system=["C", "H"],
...     code="qmcpack",
...     )
{'C.ccECP.xml': '/path/to/pseudo_dir/C.ccECP.xml',
 'H.ccECP.xml': '/path/to/pseudo_dir/H.ccECP.xml'}

Or call with a label after using ppset. (Deprecated)

>>> ppset(
...     label   = 'my_pseudos',
...     pwscf   = ["C.ccECP.upf", "H.ccECP.upf", "O.ccECP.upf"],
...     qmcpack = ["C.ccECP.xml", "H.ccECP.xml", "O.ccECP.xml"],
...     )
>>> PseudoSet.get_pseudos(
...     pseudos="my_pseudos",
...     system=["C", "H"],
...     code="qmcpack",
...     )
{'C.ccECP.xml': '/path/to/pseudo_dir/C.ccECP.xml',
 'H.ccECP.xml': '/path/to/pseudo_dir/H.ccECP.xml'}

You can also call with a list of pseudopotential names.

>>> PseudoSet.get_pseudos(
...     pseudos=["C.ccECP.xml", "H.ccECP.xml"],
...     system=["C", "H"],
...     code="qmcpack",
...     )
{'C.ccECP.xml': '/path/to/pseudo_dir/C.ccECP.xml',
 'H.ccECP.xml': '/path/to/pseudo_dir/H.ccECP.xml'}

Most commonly this would be called with a PhysicalSystem object, created here with generate_physical_system.

>>> sys = generate_physical_system(
...     elem = ['C','H'],
...     pos  = np.empty((2,3)),
...     C    = 4,
...     H    = 1,
...     )
>>> PseudoSet.get_pseudos(
...     pseudos=["C.ccECP.xml", "H.ccECP.xml"],
...     system=sys,
...     code="qmcpack",
...     )
{'C.ccECP.xml': '/path/to/pseudo_dir/C.ccECP.xml',
 'H.ccECP.xml': '/path/to/pseudo_dir/H.ccECP.xml'}

Calling with a dict of PseudoSet.

>>> psps = PseudoSet.from_mixed_dir(
...     pseudo_dir="/path/to/pseudo_dir",
...     codes={"espresso", "qmcpack"},
... )
>>> for code, ps_set in psps.items():
...     print(f"{code} pseudos:")
...     for lbl, psp in ps_set.pseudos.items():
...         print(f"  {lbl}: {psp}")
espresso pseudos:
H: /path/to/pseudo_dir/H.ccECP.upf
C: /path/to/pseudo_dir/C.ccECP.upf
qmcpack pseudos:
C: /path/to/pseudo_dir/C.ccECP.xml
H: /path/to/pseudo_dir/H.ccECP.xml
>>> PseudoSet.get_pseudos(
...     pseudos=psps,
...     system=["C", "H"],
...     code="qmcpack",
...     )
{'C.ccECP.xml': '/path/to/pseudo_dir/C.ccECP.xml',
 'H.ccECP.xml': '/path/to/pseudo_dir/H.ccECP.xml'}
>>> PseudoSet.get_pseudos(
...     pseudos=psps,
...     system=["C", "H"],
...     code="espresso",
...     )
{'C.ccECP.upf': '/path/to/pseudo_dir/C.ccECP.upf',
 'H.ccECP.upf': '/path/to/pseudo_dir/H.ccECP.upf'}
get_Zeff(elem_labels: Collection[Elements | str] | PhysicalSystem, *, missing_as_ae: bool = False) → dict[str, int][source]#

Get the Z-valences for each element in the list of elements.

Parameters:
elem_labelslist of Elements or list of str or PhysicalSystem

The elements or system to get Z-valences for.

missing_as_aebool, default=False (keyword-only)

Assume any elements for which a pseudopotential can not be found are all-electron, and use their atomic number as the value for the Z-valence. If this is not supplied, and if the Z-valence for an element is not in self.Zeff, this will attempt to extract the Z-valence from the pseudopotential file.

Returns:
elem_Zeffdict of str: int

A dictionary mapping element labels to their effective nuclear charges.

See also

read_upf_z_valence

Used to extract Z-valences from UPF files.

read_qmcpack_xml_z_valence

Used to extract Z-valences from XML files.

read_potcar_z_valence

Used to extract Z-valences from POTCAR files.

nexus.pseudoset.generate_pseudoset(pseudo_dir: PathLike | None = None, *, code: str | Collection[str] | None = None, extension: Mapping[str, str | Collection[str]] | None = None, include: Mapping[str, str] | str | None = None, exclude: Mapping[str, str] | str | None = None, Zeff_map: Mapping[str, Mapping[str, int]] | Mapping[str, int] | None = None, **codes_psps: Collection[PathLike] | PathLike) → dict[str, PseudoSet][source]#

Generate a dictionary of PseudoSet.

The ideal use of this function is to create a single collection of PseudoSet’s that represent a single kind or type of pseudopotential. See the Notes and Examples for more information.

Parameters:
pseudo_dirPathLike

The directory from which to read pseudopotentials. Does not support nested directories, except for those that contain a POTCAR file. If you do not provide this or codes_psps it will try to use the pseudo_dir supplied in settings.

codeone or more of {“espresso”, “gamess”, “vasp”, “qmcpack”, “rmg”, “pyscf”}, optional

The code(s) to use to separate the files in the directory into their respective groups. Incompatible with codes_psps.

extensionMap of codes to a str/set of str, optional

A dictionary mapping codes to the file extension(s) corresponding to those labels. If this is not provided, then the filters are automatically populated by the codes in code.

includeMap of codes to str or single str, optional

A dictionary mapping codes to a Unix shell-style wildcard. All files matched by this are included in the final PseudoSet. By default this matches all files.

excludeMap of codes to str or single str, optional

A dictionary mapping codes to a Unix shell-style wildcard. All files matched by this are excluded in the final PseudoSet. By default this matches all files.

Zeff_mapMap of codes to Map of str/Elements to int or Map of str/Elements to int, optional

A mapping for each code that maps elements to their effective nuclear charges (Z-valences), or a single mapping that will be applied to all codes. If this is supplied, it will override any parts of the code that may try to parse the pseudopotential to get the Z-valence.

**codes_psps

A mapping of code names to either a collection of pseudopotential file names/paths or a path to a directory with pseudopotential files in it.

Notes

This function is designed around the idea that the returned dict represents a single type of pseudos, e.g. ccECPs, USPPs, NCPPs, PAWs, with the same kind of pseudopotential for each code. That means that, for the same element, all of the Z-valences in the pseudos should match, all of the radial grids are the same, all pseudos are made with the same functional, and so on. Then, the object returned can be passed freely to any function that may accept it, e.g. as the pseudos keyword in generate_pwscf or generate_qmcpack.

If you are only working with one code, or prefer a class-based interface, you may want to use PseudoSet directly, along with its methods PseudoSet.from_dir and/or PseudoSet.from_mixed_dir.

Examples

Basic usage, all files in one directory.

>>> print(contents_of_pseudo_dir)
pseudo_dir
├── C.ccECP.gamess
├── C.ccECP.nwchem
├── C.ccECP.upf
├── C.ccECP.xml
├── H.ccECP.gamess
├── H.ccECP.nwchem
├── H.ccECP.upf
└── H.ccECP.xml
>>> psps = generate_pseudoset(
...     pseudo_dir=pseudo_dir,
...     code={"qmcpack", "espresso", "rmg", "pyscf", "gamess"},
...     extension={"rmg": ".xml"},
... )
>>> for code, ps_set in psps.items():
...     print(f"{code} pseudos:")
...     for lbl, psp in ps_set.pseudos.items():
...         print(f"  {lbl}: {psp}")
espresso pseudos:
    C: /path/to/pseudo_dir/C.ccECP.upf
    H: /path/to/pseudo_dir/H.ccECP.upf
pyscf pseudos:
    H: /path/to/pseudo_dir/H.ccECP.nwchem
    C: /path/to/pseudo_dir/C.ccECP.nwchem
rmg pseudos:
    H: /path/to/pseudo_dir/H.ccECP.xml
    C: /path/to/pseudo_dir/C.ccECP.xml
qmcpack pseudos:
    H: /path/to/pseudo_dir/H.ccECP.xml
    C: /path/to/pseudo_dir/C.ccECP.xml
gamess pseudos:
    C: /path/to/pseudo_dir/C.ccECP.gamess
    H: /path/to/pseudo_dir/H.ccECP.gamess