aiida_vasp.parsers.content_parsers.potcar#

POTCAR parser.

The file parser that handles the parsing of POTCAR files. Also contains methods to find, import, compose and write POTCAR files.

Module Contents#

Classes#

PotcarParser

A lightweight interface that provides access to POTCAR metadata parsing.

PotcarIo

Deals with VASP input output of POTCAR files.

MultiPotcarIo

Handle file i/o for POTCAR files with one or more potentials.

API#

class aiida_vasp.parsers.content_parsers.potcar.PotcarParser(*, handler: TextIO | BinaryIO | None = None, data: aiida.orm.Data | None = None, settings: dict[str, Any] | None = None, options: dict[str, Any] | None = None, raise_errors: bool = False)[source]#

Bases: aiida_vasp.parsers.content_parsers.base.BaseFileParser

A lightweight interface that provides access to POTCAR metadata parsing.

Similar to the other content parser for VASP in structure, but only used directly in the POTCAR handling logic.

Initialization

DEFAULT_SETTINGS = None#
PARSABLE_QUANTITIES = None#
_init_from_handler(handler: TextIO) None[source]#

Initialize using a file like handler.

Parameters:

handler (file-like object) – A file like object that provides the necessary content to be parsed.

property metadata: parsevasp.potcar.Potcar#

Return the metadata Potcar instance.

abstract _init_from_data(data: dict) None[source]#

No need to init from an AiiDA data structure.

abstract _content_data_to_content_parser() None[source]#

Since no need to accept AiiDA data structure, no need to convert it.

class aiida_vasp.parsers.content_parsers.potcar.PotcarIo(**kwargs: Any)[source]#

Deals with VASP input output of POTCAR files.

Instantiate with one of the following kwargs:

Parameters:
  • path – (string) absolute path to the POTCAR file

  • potcar_node – a PotcarData node

  • potcar_file_node – a PotcarFileNode

  • contents – a string with the POTCAR content

Initialization

Init from Potcar object or delegate to kwargs initializers.

init_with_kwargs(**kwargs: Any) None[source]#

Delegate initialization to _init_with - methods.

_init_with_path(file_path: str | pathlib.Path) None[source]#

Initialize with a path.

_init_with_potcar_file_node(node: aiida_vasp.data.potcar.PotcarFileData) None[source]#

Initialize with an existing potential file node.

_init_with_potcar_node(node: aiida_vasp.data.potcar.PotcarData) None[source]#

Initialize with an existing potential node.

_init_with_contents(contents: str) None[source]#

Initialize with a string.

property file_node: aiida_vasp.data.potcar.PotcarFileData#
property node: aiida_vasp.data.potcar.PotcarData#
property content: bytes#
classmethod from_(potcar: str | pathlib.Path | aiida_vasp.data.potcar.PotcarData | aiida_vasp.data.potcar.PotcarFileData | aiida_vasp.parsers.content_parsers.potcar.PotcarIo) aiida_vasp.parsers.content_parsers.potcar.PotcarIo[source]#

Determine the best guess at how the input represents a POTCAR file and construct a PotcarIo instance based on that.

__eq__(other: aiida_vasp.parsers.content_parsers.potcar.PotcarIo) bool[source]#
__hash__() int[source]#
class aiida_vasp.parsers.content_parsers.potcar.MultiPotcarIo(potcars: list[Any] | None = None)[source]#

Handle file i/o for POTCAR files with one or more potentials.

Initialization

append(potcar: Any) None[source]#
write(path: str | pathlib.Path) None[source]#
classmethod read(path: str | pathlib.Path) aiida_vasp.parsers.content_parsers.potcar.MultiPotcarIo[source]#

Read a POTCAR file that may contain one or more potentials into a list of PotcarIo objects.

property potcars: list[aiida_vasp.parsers.content_parsers.potcar.PotcarIo]#
classmethod from_structure(structure: aiida.orm.StructureData, potentials_dict: dict[str, Any]) aiida_vasp.parsers.content_parsers.potcar.MultiPotcarIo[source]#

Create a MultiPotcarIo from an AiiDA StructureData object and a dictionary with a potential for each kind in the structure.

get_potentials_dict(structure: aiida.orm.StructureData) dict[str, Any][source]#

Get a dictionary {kind_name: PotcarData} that would fit the structure.

If the PotcarData contained in MultiPotcarIo do not match the structure, an exception is raised.

property element_symbols: set[str]#
classmethod potentials_order(structure: aiida.orm.StructureData) list[str][source]#
classmethod count_kinds(structure: aiida.orm.StructureData) list[tuple[str, int]][source]#

Count consecutive kinds that compose the different sites.

Parameters:

structure (object) – Structure containing sites and kinds

Returns:

List of tuples with kind names and counts

Return type:

list