aiida_vasp.parsers.vasp#
Parser module for composing output of a VASP calculation.
The simplified parser outputs the following nodes:
- 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.
- A arrays node that for storing miscellaneous quantities that are arrays by nature and typically
have a large size.
A trajectory node for storing the trajectory of geometry optimisation and AIMD.
A bands node for storing the band structure.
A dos node for storing the density of states.
Other nodes for storing other relevant quantities such as the born effective charges.
Main difference from the previous version
pydantic is used to validate the parser settings at submission time.
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.
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#
Settings for the VASP parser. |
|
Class for parsing VASP output files and storing the results in AiiDA. |
|
Compose errors codes based on the notifications |
Functions#
Gather quantities and put them into the target dictionary |
|
Compose a structure node from the dictionary output by the parser |
|
Check if all elements of a dictionary or list are empty |
|
Get a KpointData node from parsed kpoints data and cell matrix |
Data#
API#
- exception aiida_vasp.parsers.vasp.ParserError[source]#
Bases:
RuntimeError
- 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.OptionContainerSettings 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.
- class aiida_vasp.parsers.vasp.VaspParser(node: aiida.orm.CalcJobNode)[source]#
Bases:
aiida.parsers.parser.ParserClass 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.
- _compose_structure(quantities_each: dict[str, Any]) aiida.orm.StructureData | None[source]#
Compose the structure 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
- 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.
- 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