sparc.sparc_parsers.pseudopotential module

Provide a simple parser for pseudo potentials

The psp8 format is defined in abinit manual https://docs.abinit.org/developers/psp8_info/

The first

exception sparc.sparc_parsers.pseudopotential.MultiplePseudoPotentialFiles(message)[source]

Bases: Exception

exception sparc.sparc_parsers.pseudopotential.NoMatchingPseudopotential(message)[source]

Bases: FileNotFoundError

exception sparc.sparc_parsers.pseudopotential.NotPSP8Format(message)[source]

Bases: Exception

sparc.sparc_parsers.pseudopotential.copy_psp_file(source_pot, target_dir, use_symbol=False)[source]

Copy the pseudo potential file source_pot under target_dir

if use_symbol is True, rename the potential to ‘{symbol}.psp8’

the function returns the name of the pseudo potential file

sparc.sparc_parsers.pseudopotential.find_pseudo_path(symbol, search_path=None, pseudopotential_mapping={})[source]

Get the pseudo potential file at best effort

Searching priorities 1) if pseudopotential_mapping has symbol as key, use the file name

There are two possibilities i) filename does not contain directory information: i.e. Na-pbe.pot

use search_path / filename for the mapping

  1. filename contains directory information, directly use the file name

  1. No pseudopotential_mapping is given, get the psp from search_path

sparc.sparc_parsers.pseudopotential.infer_pseudo_path(symbol, search_path)[source]

Given an element symbol like ‘Na’, get the file name of the search_path (resolved) that search through the search path

TODO: shall we support multiple directories? TODO: add a setup option like VASP?

sparc.sparc_parsers.pseudopotential.parse_psp8_header(text)[source]

Parse the first 4 lines of psp8 text if parsing failed, raise exception