aiida_vasp.parsers.vasp#

Parser module for composing output of a VASP calculation.

The simplified parser outputs the following nodes:

  1. A misc node that stores simple summary information such as total energies,

    total run times, any warnings issues during the calculation and if the calculation was finished.

  2. A arrays node that for storing miscellaneous quantities that are arrays by nature and typically

    have a large size.

  3. A trajectory node for storing the trajectory of geometry optimisation and AIMD.

  4. A bands node for storing the band structure.

  5. A dos node for storing the density of states.

  6. Other nodes for storing other relevant quantities such as the born effective charges.

Main difference from the previous version

  1. pydantic is used to validate the parser settings at submission time.

  2. When parsing retrieved data, we take a ‘parse as much as possible’ approach - the quantities are always parsed if available, and only excluded during the stage of composing the output nodes. This is simpler from the previous ‘parse only when needed’ approach, where multiple checks have be done to work out which parser to call and which quantities to include.

  3. All parser logic is contained in a single class and can be extended by updating content parsers and modify the default settings and update/add the _compose_xx methods.

Module Contents#

Classes#

ParserSettingsConfig

Settings for the VASP parser.

VaspParser

Class for parsing VASP output files and storing the results in AiiDA.

NotificationComposer

Compose errors codes based on the notifications

Functions#

gather_quantities

Gather quantities and put them into the target dictionary

get_structure_node

Compose a structure node from the dictionary output by the parser

is_all_empty

Check if all elements of a dictionary or list are empty

get_kpoints_node

Get a KpointData node from parsed kpoints data and cell matrix

Data#

API#

exception aiida_vasp.parsers.vasp.ParserError[source]#

Bases: RuntimeError

exception aiida_vasp.parsers.vasp.QuantityMissingError[source]#

Bases: aiida_vasp.parsers.vasp.ParserError

exception aiida_vasp.parsers.vasp.RequiredQuantityMissingError[source]#

Bases: aiida_vasp.parsers.vasp.ParserError

exception aiida_vasp.parsers.vasp.MissingFileError[source]#

Bases: aiida_vasp.parsers.vasp.ParserError

aiida_vasp.parsers.vasp.DEFAULT_EXCLUDED_QUANTITIES = ('elastic_moduli', 'symmetries', 'parameters')#
aiida_vasp.parsers.vasp.DEFAULT_EXCLUDED_NODE = ('bands', 'dos', 'kpoints', 'trajectory', 'energies', 'wavecar', 'chgcar', 'projectors')#
aiida_vasp.parsers.vasp.DEFAULT_REQUIRED_QUANTITIES = ('run_status', 'run_stats')#
aiida_vasp.parsers.vasp.DEFAULT_FILE_MAPPING = None#
aiida_vasp.parsers.vasp.MISC_QUANTITIES = ('total_energies', 'notifications', 'run_status', 'run_stats', 'version', 'forces', 'stress', 'site_...#
aiida_vasp.parsers.vasp.ALLOW_EMPTY = ('notifications',)#
aiida_vasp.parsers.vasp.STANDALONE_ARRAY_QUANTITIES = None#
class aiida_vasp.parsers.vasp.ParserSettingsConfig(/, **data: typing.Any)[source]#

Bases: aiida_vasp.utils.opthold.OptionContainer

Settings for the VASP parser.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

include_quantity: List[str] = 'Field(...)'#
exclude_quantity: List[str] = 'Field(...)'#
required_quantity: List[str] = 'Field(...)'#
include_node: List[str] = 'Field(...)'#
exclude_node: List[str] = 'Field(...)'#
file_mapping: Dict[str, str] = 'Field(...)'#
kpoints_from_ibzkpt: bool = False#
check_completeness: bool = True#
electronic_step_energies: bool = False#
energy_type: List[str] = 'Field(...)'#
keep_stream_history: bool = 'Field(...)'#
ignore_notification_errors: bool = 'Field(...)'#
critical_notification_errors: List[str] = 'Field(...)'#
critical_objects: List[str] = 'Field(...)'#
check_errors: bool = 'Field(...)'#
check_ionic_convergence: bool = 'Field(...)'#
omit_structure: bool = 'Field(...)'#
class aiida_vasp.parsers.vasp.VaspParser(node: aiida.orm.CalcJobNode)[source]#

Bases: aiida.parsers.parser.Parser

Class for parsing VASP output files and storing the results in AiiDA.

Initialization

Initialize the Parser instance

_init_user_settings() aiida_vasp.parsers.vasp.ParserSettingsConfig[source]#

Initialize the settings from the inputs.

_get_quantities_to_parse() aiida.engine.ExitCode | None[source]#

Return the list of quantities to parse.

_post_process_quantities() aiida.engine.ExitCode | None[source]#

Post-process the parsed quantities.

parse(**kwargs: Any) aiida.engine.ExitCode | None[source]#

Parse outputs, store results in database.

_create_outputs() aiida.engine.ExitCode | None[source]#

Create the output nodes

_compose_misc(quantities_each: dict[str, Any]) aiida.orm.Dict[source]#

Compose the misc output node

_compose_structure(quantities_each: dict[str, Any]) aiida.orm.StructureData | None[source]#

Compose the structure output node

_compose_wavecar(quantities_each: dict[str, Any]) None[source]#

Compose the wavecar output node

_compose_chgcar(quantities_each: dict[str, Any]) None[source]#

Compose the chgcar output node

_compose_arrays(quantities_each: dict[str, Any]) dict[str, aiida.orm.ArrayData][source]#

Generate the generic arrays output node

_make_standalone_array(quantities_each: dict[str, Any], name: str, file_name: str = 'vasprun.xml') aiida.orm.ArrayData | None[source]#

Compose the dielectrics output node

_compose_kpoints(quantities_each: dict[str, Any]) aiida.orm.KpointsData[source]#

Compose the kpoints output node

_compose_trajectory(quantities_each: dict[str, Any]) aiida.orm.TrajectoryData | None[source]#

Compose the trajectory output

_compose_bands(quantities_each: dict[str, Any]) aiida.orm.BandsData[source]#

Compose the band node

_compose_dos(quantities_each: dict[str, Any]) aiida.orm.ArrayData | None[source]#

Compose the dos node

_check_vasp_errors(parser_notifications: dict[str, Any]) aiida.engine.ExitCode | None[source]#

Detect simple vasp execution problems and returns the exit_codes to be set

aiida_vasp.parsers.vasp.gather_quantities(quantities_each: dict[str, Any], namespace: str, dst: dict[str, Any], fields: list[str], flatten_dict: bool = False) None[source]#

Gather quantities and put them into the target dictionary

class aiida_vasp.parsers.vasp.NotificationComposer(notifications: list[dict[str, Any]], run_status: dict[str, Any], inputs: dict[str, Any], exit_codes: Any, critical_notifications: list[str])[source]#

Compose errors codes based on the notifications

Initialization

Composed error codes based on the notifications

Some of the errors need to have additional properties inspected before they can be emitted, as they might be trigged in a harmless way.

To add new checkers, one needs to implement a property with the name of the error for this class and contains the code for checking. This property should return the exit_code or return None. The property is inspected if its name is in the list critical notifications.

compose() aiida.engine.ExitCode | None[source]#

Compose the exit codes

Returns None if no exit code should be emitted, otherwise emit the error code.

property brmix: aiida.engine.ExitCode | None#

Check if BRMIX should be emitted

property edddav_zhegv: aiida.engine.ExitCode | None#

Check if EDDDAV call to ZHEGV should be emitted. Sometimes it has converged.

property eddrmm_zhegv: aiida.engine.ExitCode | None#

Check if EDDRMM call to ZHEGV should be emitted. Sometimes it has converged.

aiida_vasp.parsers.vasp.get_structure_node(structure_dict: dict[str, Any]) aiida.orm.StructureData[source]#

Compose a structure node from the dictionary output by the parser

aiida_vasp.parsers.vasp.is_all_empty(obj: dict | list) bool[source]#

Check if all elements of a dictionary or list are empty

aiida_vasp.parsers.vasp.get_kpoints_node(kpoints_data: dict[str, Any], cell: list[list] | numpy.ndarray)[source]#

Get a KpointData node from parsed kpoints data and cell matrix