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.

Parameters:
  • 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
apply_quirks()

Update invalid and erroneous parameters running the stored quirks

hash_contents()

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_potential_contents()

Load POTCAR file contents.

Returns:the contents of the potcar file
Return type:str
load_reduced_contents()

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
potential_element()

Extract the element stored with the potential

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

Extract header section from potential contents

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

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

potential_version()

Extract creation date from the potential header

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

Check if the parsed contents do make sense.