load#

UPF (Unified Pseudopotential Format) parser

Ref:

ltalirz/upf-schema https://pseudopotentials.quantum-espresso.org/home/unified-pseudopotential-format

jrystal.pseudopotential.load.extract_value(line: str) str[source]#

Safely extract data after a colon.

jrystal.pseudopotential.load.find_upf(dir_path: str, atom: str) str[source]#

Find the pseudopotential file of an atom in the directory path.

The pseudo potential file must start with the

“$atom_symbol$.$xc_functional$.*.upf”

Parameters:
  • dir_path (str) – The directory path for pseudopotential files in UPF format. The directory must contain only one file per element.

  • atom (str) – The symbol for the element.

Returns:

The upf file path.

Return type:

str

jrystal.pseudopotential.load.parse_pp_header(pp_header) dict[source]#

Parse the PP_HEADER attributes into a dictionary.

jrystal.pseudopotential.load.parse_pp_info(pp_info_string: str) dict[source]#

Parse the PP_INFO section into a dictionary.

jrystal.pseudopotential.load.parse_pp_local(pp_local) list[source]#

Parse the PP_LOCAL section into a list of floats.

jrystal.pseudopotential.load.parse_pp_mesh(pp_mesh) dict[source]#

Parse the PP_MESH section into a dictionary.

jrystal.pseudopotential.load.parse_pp_nonlocal(pp_nonlocal) dict[source]#

Parse the PP_NONLOCAL section into a dictionary.

jrystal.pseudopotential.load.parse_upf(filepath: str) dict[source]#

Main function to parse a UPF file. The schema of upf can be find ltalirz/upf-schema.

Usage:

Mesh_grid: dict[“PP_MESH”][“PP_R”] Local part: dict[“PP_LOCAL”] Nonlocal part:

Beta: dict[“PP_NONLOCAL”][“BETA”][‘values’] D_ij: dict[“PP_NONLOCAL”][“D_IJ”][‘values’]

jrystal.pseudopotential.load.parse_valence_configuration(valence_lines: list) list[source]#

Parse the valence configuration section into a list of dictionaries.