aiida_vasp.parsers.content_parsers.poscar#

The POSCAR/CONTCAR parser interface.

Contains the parsing interfaces to parsevasp used to parse POSCAR/CONTCAR content.

Module Contents#

Classes#

PoscarParser

The parser interface that enables parsing of POSCAR/CONTCAR content.

Functions#

parsevasp_to_aiida

parsevasp to AiiDA conversion.

API#

class aiida_vasp.parsers.content_parsers.poscar.PoscarParser(*, precision=12, **kwargs)[source]#

Bases: aiida_vasp.parsers.content_parsers.base.BaseFileParser

The parser interface that enables parsing of POSCAR/CONTCAR content.

The parser is triggered by using the poscar-structure quantity key. The quantity key structure will on the other hand parse the structure using the XML parser.

Parameters:

precision (int, optional) – An integer specifying the number of digits for floating point numbers that will be written to POSCAR/CONTCAR. Defaults to 12.

Initialization

Initialize an instance of this class.

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 POSCAR/CONTCAR content to be parsed.

_init_from_data(data: aiida.orm.StructureData) None[source]#

Initialize using AiiDA StructureData instance.

Parameters:

data (object) – A valid AiiDA StructureData object.

property structure: dict[str, Any]#

Return structure from POSCAR.

Returns:

A dict that contain keys comment, unitcell and sites, which are compatible with consumption of the initialization of the AiiDA StructureData.

Return type:

dict

_content_data_to_content_parser() aiida_vasp.parsers.content_parsers.poscar.PoscarParser[source]#

Convert an AiiDA StructureData to a content parser instance of Poscar from parsevasp.

Returns:

An instance of Poscar from parsevasp.

Return type:

object

transform_to_bool(value: str | int) bool[source]#

Helper function to transform the dictionary from strings or integers to bools

aiida_vasp.parsers.content_parsers.poscar.parsevasp_to_aiida(poscar: parsevasp.poscar.Poscar) dict[str, Any][source]#

parsevasp to AiiDA conversion.

Generate an AiiDA structure that can be consumed by StructureData on initialization from the parsevasp instance of the Poscar class.

Parameters:

poscar (object) – An instance of the Poscar class in parsevasp.

Returns:

A dictionary representation which are ready to be used when creating an AiiDA StructureData instance.

Return type:

dict