aiida_vasp.parsers.content_parsers.chgcar#

The CHGCAR parser interface.

Contains the parsing interfaces to parsevasp used to parse CHGCAR content.

Module Contents#

Classes#

ChgcarParser

The parser interface that enables parsing of CHGCAR content.

API#

class aiida_vasp.parsers.content_parsers.chgcar.ChgcarParser(*, 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

The parser interface that enables parsing of CHGCAR content.

The parser is triggered by using the charge_density and/or magnetization_density quantity key.

Initialization

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

Initialize a parsevasp object of Chgcar using a file like handler.

Parameters:

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

property charge_density#

Return the charge density.

Returns:

A NumPy array containing the charge density in the unit cell in C order.

Return type:

ndarray

property magnetization_density#

Return the magnetization density.

Returns:

If collinear spin calculations have been performed, a NumPy array containing the magnetization density in the unit cell in C order is returned. If however a non-collinear spin calculation have been performed, a dictionary is returned with keys x, y and z, each containing the same NumPy array, but for each direction.

Return type:

dict or ndarray