aiida_cusp.utils package

class aiida_cusp.utils.PotcarParser(path_to_potcar_file, name=None, functional=None)

Bases: object

Minimalistic parsing library for VASP POTCAR files.

Only tries to parse the basic potential identifiers from the file, i.e. the potential version and the associated element. Does not perform any checks on the validity of the parsed results but only raises if no match was retrieved at all.

  • path_to_potcar_file (pathlib.Path) – path to a VASP POTCAR file
  • name (str) – name of the potential (i.e. Li, Li_sv, …)
  • functional (str) – functional of the potential, i.e. one of lda_us, lda, lda_52, lda_54, pbe, pbe_52, pbe_54, pw91 or pw91_us

Update invalid and erroneous parameters running the stored quirks


Hash potential contents using secure hashing.

Calculates the hash based on the reduced instead of the full potential contents to avoid potentials being assumed as different if whitespaces differ.

Returns:return sha256 hash for potential contents
Return type:str

Load POTCAR file contents.

Returns:the contents of the potcar file
Return type:str

Load POTCAR file contents and return a reduced version without consecutive whitespaces and occasionally occuring ‘^’ chars

Returns:returns the reduced contents of the potcar file
Return type:str

Extract the element stored with the potential

Returns:string containing the element name
Return type:str
Raises:PotcarParserError – if regex returns with no match

Extract header section from potential contents

Returns:string containing the potential header
Return type:str
Raises:PotcarParserError – if regex returns with no match

Extract the potential title (i.e. the first line of the file)


Extract creation date from the potential header

Returns:integer representation of the potential creation date
Return type:int

Check if the parsed contents do make sense.