Parsing VASP calculations#

Note

This notebook can be downloaded as parsing.ipynb and parsing.md

AiiDA-VASP provides flexible parsing of VASP output files to store data in the AiiDA database and repository.

The user interface for configuring the parsing settings takes place in the settings['parser_settings'] dictionary entry. The default parser_settings is presently:

from aiida_vasp.parsers.vasp import ParserSettingsConfig
ParserSettingsConfig().dict()
/tmp/ipykernel_645/3839934977.py:2: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
  ParserSettingsConfig().dict()
{'include_quantity': [],
 'exclude_quantity': [],
 'required_quantity': ['run_status', 'run_stats'],
 'include_node': [],
 'exclude_node': [],
 'file_mapping': {'vasprun.xml': 'vasprun.xml',
  'vasp_output': 'vasp_output',
  'OUTCAR': 'OUTCAR',
  'CONTCAR': 'CONTCAR',
  'CHGCAR': 'CHGCAR',
  'IBZKPT': 'IBZKPT'},
 'kpoints_from_ibzkpt': False,
 'check_completeness': True,
 'electronic_step_energies': False,
 'energy_type': ['energy_extrapolated'],
 'keep_stream_history': False,
 'ignore_notification_errors': False,
 'critical_notification_errors': ['brmix',
  'edwave',
  'brmix',
  'cnormn',
  'denmp',
  'dentet',
  'edddav_zhegv',
  'eddrmm_zhegv',
  'edwav',
  'fexcp',
  'fock_acc',
  'non_collinear',
  'not_hermitian',
  'pzstein',
  'real_optlay',
  'rhosyg',
  'rspher',
  'set_indpw_full',
  'sgrcon',
  'no_potimm',
  'magmom',
  'bandocc'],
 'critical_objects': ['vasprun.xml', 'OUTCAR'],
 'check_errors': True,
 'check_ionic_convergence': True,
 'omit_structure': True}

These settings can be configured by setting the parser_settings inside the settings input node to the VaspCalculation or VaspWorkChain processes.

The parser is responsible for extracting information for a VASP calculation and store them as Data nodes in the database.

Error checking#

The parser will check for any error detected for the underlying VASP calculation. This information is stored in the notification quantity stored in the misc output node, which contains a list of error/warnings detected in the STDOUT of the VASP calculation. By default, a non-zero exit state is returned if any critical error is found. The default list of critical errors is defined under the critical_notification_errors key inside the parser_settings. Additional settings may also be supplied under parser_settings to modify the behaviors:

  • ignore_notification_errors: a boolean value to control whether all notifications should be ignored, defaults to False.

  • critical_notification_errors: a list with items for controlling which errors present in the stdout to be regarded as critical or not.

  • check_completeness: whether to check the completeness of the retrieved files, defaults to True.

  • critical_objects: a list of objects (files) that must be present as the outputs of a calculation.

  • check_errors: whether to check for errors in the VASP output, defaults to True.

Configuring the output nodes#

The parser will generate a set of output nodes based on the parsed data. Most of the common outputs are placed in the misc output node (Dict), and those that are typically large arrays are stored in the array output node (ArrayData).

Other output nodes includes:

  • structure: the final structure of the calculation (StructureData).

  • bands: the electronic band structure (BandsData).

  • dos: the density of states (ArrayData).

  • born_charges: the Born effective charges (ArrayData).

  • dielectrics: the dielectric function (ArrayData).

  • hessian: the Hessian matrix (ArrayData).

  • dynmat: the dynamical matrix (ArrayData).

  • wavecar: the wave function (ArrayData).

Note that the parser will only generate output nodes for those data that are present in the retrieved files. For simplicity, all available quantities are collected from the parser for each retrieved files. One can turn on/off of these outputs by modifying the included quantities as well as turning on/off the node output directly. For example, the bands node is essentially made of two quantities: eigenvalues and occupancies, but the band structure output if off by default at the node level. This is because most of the calculation do contain these two quantities, but only those from a dedicated band structure calculation are meaningful in analysis. We achieve this by including the bands node in the DEFAULT_EXCLUDED_NODE. For a band structure calculations, one should set settings['parser_settings']['include_node'] to ['bands'] to indicate that the bands node should be created.

Likewise, certain quantities/nodes are excluded by default:

from aiida_vasp.parsers.vasp import DEFAULT_EXCLUDED_NODE, DEFAULT_EXCLUDED_QUANTITIES
print(DEFAULT_EXCLUDED_NODE)
print(DEFAULT_EXCLUDED_QUANTITIES)
('bands', 'dos', 'kpoints', 'trajectory', 'energies', 'wavecar', 'chgcar', 'projectors')
('elastic_moduli', 'symmetries', 'parameters')