PAOFLOW.basis_gen.driver#

High-level basis generator: pseudopotential -> radial shells, in memory or as BASIS_PS/<elem>/<shell>.dat files.

generate_basis_shells() is the in-memory core (one radial function per requested shell, or per j for spin-orbit pseudopotentials), used by the projections() generator route of PAOFLOW.projection.radial_shell_basis; generate_basis_for_pseudo() writes the same functions to disk for the table route (paoflow-genbasis-ps). Both accept a UPF file (QE) or a POTCAR dataset (VASP, PAOFLOW.inputs.read_potcar).

Classes#

GeneratedShell

One radial function of the generator.

Functions#

generate_basis_shells(pseudo, shells[, r_box, ...])

Radial functions of the requested shells of one pseudopotential, in memory.

generate_basis_for_pseudo(upf_path, out_dir[, shells, ...])

Pseudize the requested shells of a pseudopotential and write them to disk.

generate_basis_for_directory(pseudo_dir, out_dir[, ...])

Run generate_basis_for_pseudo() over every pseudopotential in pseudo_dir.

Module Contents#

class PAOFLOW.basis_gen.driver.GeneratedShell[source]#

One radial function of the generator.

Variables:
  • label (str) – Shell label ('3D').

  • l (int) – Angular momentum.

  • j (float or None) – Total angular momentum of a j-resolved function (fully relativistic pseudopotentials), None for a scalar one (also the degeneracy-weighted j-average written as the scalar file of a spin-orbit pseudopotential).

  • r (ndarray) – Uniform mesh (bohr).

  • wfc (ndarray) – u(r) = r R(r), normalised as PAOFLOW.basis_gen.radial.pseudize_shell().

  • energy (float) – Solver eigenvalue (Hartree), nan for a stored pseudo-orbital.

  • filename (str) – Name of the table file of this function ('3D.dat', '3D_j3.dat').

label: str[source]#
l: int[source]#
j: float | None[source]#
r: numpy.typing.NDArray[numpy.float64][source]#
wfc: numpy.typing.NDArray[numpy.float64][source]#
energy: float[source]#
filename: str[source]#
property from_pseudo_orbital: bool[source]#

Whether the function is a stored pseudo-orbital rather than a solver state.

PAOFLOW.basis_gen.driver.generate_basis_shells(pseudo, shells, r_box=None, n_points=2000, prefer_pswfc=True)[source]#

Radial functions of the requested shells of one pseudopotential, in memory.

Parameters:
  • pseudo (UPF, PotcarDataset or str) – The pseudopotential (a parsed object, or the path of a UPF file / POTCAR).

  • shells (list of str) – Shell labels (['3S', '3P', '3D']).

  • r_box (float, optional) – Confining box radius (bohr). Defaults to min(r[-1], 10) of the radial mesh.

  • n_points (int) – Solver mesh size (interior points = n_points - 1).

  • prefer_pswfc (bool) – Return the shells the pseudopotential carries as pseudo-orbitals as stored (pseudize_shell()); False solves every shell.

Returns:

  • generated (list of GeneratedShell) – In the order of shells; a shell of a fully relativistic pseudopotential with l > 0 gives three entries (j = l - 1/2, j = l + 1/2 and their degeneracy-weighted average with j = None).

  • skipped (list of tuple) – (label, reason) of the shells that could not be generated (below the lowest pseudo-atom level, no physical state, or a frozen-core shell), each also reported with a RuntimeWarning.

Notes

Every function of a pseudopotential is returned on the same uniform mesh, which the position-dipole tables require. The channel solutions are cached across the shells of one call (one generalized eigenproblem per (l, j) channel).

PAOFLOW.basis_gen.driver.generate_basis_for_pseudo(upf_path, out_dir, shells=None, preset='extended', r_box=None, n_points=2000, overwrite=True, verbose=False, prefer_pswfc=True)[source]#

Pseudize the requested shells of a pseudopotential and write them to disk.

Parameters:
  • upf_path (str, UPF or PotcarDataset) – Path to the UPF file or POTCAR (or a parsed dataset).

  • out_dir (str) – Output root (per-element subdirectory out_dir/<elem>/ is created automatically).

  • shells (list of str, optional) – Explicit shell labels (e.g. ['3S', '3P', '3D']). Defaults to the preset augmentation rules.

  • preset ({'minimal', 'standard', 'extended'}) – Used when shells is None.

  • r_box (float, optional) – Confining box radius (Bohr). Defaults to min(upf.r[-1], 10).

  • n_points (int) – Solver mesh size (interior points = n_points - 1).

  • overwrite (bool) – If False, existing files are skipped.

  • verbose (bool) – Print one line per generated shell.

  • prefer_pswfc (bool) – Stored pseudo-orbitals for the shells that have one (default); False solves every shell.

Returns:

written – Paths of the files written.

Return type:

list of str

PAOFLOW.basis_gen.driver.generate_basis_for_directory(pseudo_dir, out_dir, preset='extended', r_box=None, n_points=2000, overwrite=True, verbose=False, prefer_pswfc=True)[source]#

Run generate_basis_for_pseudo() over every pseudopotential in pseudo_dir.

UPF files and POTCARs (a POTCAR of the directory, possibly concatenated, and the <name>/POTCAR of a PAW library) are processed; every dataset of a concatenated POTCAR gives one element directory.

Returns a dict {element_symbol: [written_paths]}.