aiida_vasp.parsers package¶
Subpackages¶
- aiida_vasp.parsers.content_parsers package
- Submodules
BaseFileParser
ChgcarParser
DoscarParser
EigenvalParser
IncarParser
KpointsParser
parsevasp_to_aiida()
OutcarParser
VtstNebOutcarParser
PoscarParser
fetch_symbols_from_elements()
parsevasp_to_aiida()
MultiPotcarIo
PotcarIo
PotcarParser
StreamParser
VasprunParser
VasprunParser.DEFAULT_SETTINGS
VasprunParser.ENERGY_MAPPING
VasprunParser.ENERGY_MAPPING_VASP5
VasprunParser.OPEN_MODE
VasprunParser.PARSABLE_QUANTITIES
VasprunParser.band_properties
VasprunParser.born_charges
VasprunParser.dielectrics
VasprunParser.dos
VasprunParser.dynmat
VasprunParser.eigenvalues
VasprunParser.energies
VasprunParser.fermi_level
VasprunParser.final_forces
VasprunParser.final_stress
VasprunParser.final_structure
VasprunParser.forces
VasprunParser.hessian
VasprunParser.kpoints
VasprunParser.last_forces
VasprunParser.last_stress
VasprunParser.last_structure
VasprunParser.maximum_force
VasprunParser.maximum_stress
VasprunParser.occupancies
VasprunParser.projectors
VasprunParser.run_status
VasprunParser.stress
VasprunParser.structure
VasprunParser.total_energies
VasprunParser.trajectory
VasprunParser.version
BaseKeyValueParser
KeyValueParser
KeyValueParser.assignment
KeyValueParser.bool()
KeyValueParser.bool_false
KeyValueParser.bool_true
KeyValueParser.clean_value()
KeyValueParser.comment
KeyValueParser.find_kv()
KeyValueParser.flatten()
KeyValueParser.float()
KeyValueParser.float_unit()
KeyValueParser.get_converter_iter()
KeyValueParser.get_lines()
KeyValueParser.int()
KeyValueParser.int_unit()
KeyValueParser.kv_dict()
KeyValueParser.kv_list()
KeyValueParser.retval()
KeyValueParser.string()
KeyValueParser.try_convert()
WinParser
- Submodules
Submodules¶
Common code for parsers.
- class aiida_vasp.parsers.base.BaseParser(node)[source]¶
Bases:
Parser
Does common tasks all parsers carry out and provides convenience methods.
- aiida_vasp.parsers.base.list_files_recursive(retrieved, top_level='')[source]¶
Recursively list the content of a retrieved FolderData node.
Parser for NEB calculations using VASP compiled with VTST
- class aiida_vasp.parsers.neb.NEBNodeComposer(nodes, equivalent_quantity_keys, quantities, logger=None)[source]¶
Bases:
NodeComposer
NodeComposer for NEB
Some quantities are composed at a per-image basis
- COMBINED_NODES = ['neb_misc', 'image_forces']¶
- COMBINED_QUANTITY = ['neb_data', 'outcar-forces']¶
- compose_nodes()[source]¶
Compose the nodes as required.
The major difference compared to the standard calculations is that NEB calculations have different images and most data are parsed at a per image basis. For example, each image would have its own output structure, bands, and kpoints.
However, some output includes the data from images, and needs to be handed separately.
- class aiida_vasp.parsers.neb.NEBParsableQuantities(vasp_parser_logger=None)[source]¶
Bases:
ParsableQuantities
Quantity settings for NEB
- class aiida_vasp.parsers.neb.NEBSettings(settings, default_settings=None, vasp_parser_logger=None)[source]¶
Bases:
ParserSettings
Settings for NEB calculations
- NODES = {'chgcar': {'link_name': 'chgcar', 'quantities': ['chgcar'], 'type': 'vasp.chargedensity'}, 'image_forces': {'link_name': 'image_forces', 'quantities': ['forces'], 'type': 'core.array'}, 'kpoints': {'link_name': 'kpoints', 'quantities': ['kpoints-kpoints'], 'type': 'core.array.kpoints'}, 'misc': {'link_name': 'misc', 'quantities': ['notifications', 'run_stats', 'run_status'], 'type': 'core.dict'}, 'neb_misc': {'link_name': 'neb_misc', 'quantities': ['neb_data'], 'type': 'core.dict'}, 'site_magnetization': {'link_name': 'site_magnetization', 'quantities': ['site_magnetization'], 'type': 'core.dict'}, 'structure': {'link_name': 'structure', 'quantities': ['structure'], 'type': 'core.structure'}, 'wavecar': {'link_name': 'wavecar', 'quantities': ['wavecar'], 'type': 'vasp.wavefun'}}¶
- class aiida_vasp.parsers.neb.VtstNebParser(node)[source]¶
Bases:
VaspParser
Parser for parsing NEB calculations performed with VASP compiled with VTST tools.
The major difference compared with standard VASP calculations is that the output files are placed in subfolders. With the only exception being vasprun.xml it is not clear what image this file is for.
- COMPOSER_CLASS¶
alias of
NEBNodeComposer
Node composer.
- class aiida_vasp.parsers.node_composer.NodeComposer(nodes, equivalent_quantity_keys, quantities, logger=None)[source]¶
Bases:
object
Prototype for a generic NodeComposer, that will compose output nodes based on parsed quantities.
Provides methods to compose output_nodes from quantities. Currently supported node types are defined in NODES_TYPES.
Parameters¶
- static compose_core_array_kpoints(node_type, inputs)[source]¶
Compose an array.kpoints node based on inputs.
- static compose_core_array_trajectory(node_type, inputs)[source]¶
Compose a trajectory node.
Parameters¶
- node_typestr
‘array.trajectory’
- inputsdict
trajectory data is stored at VasprunParser. The keys are ‘cells’, ‘positions’, ‘symbols’, ‘forces’, ‘stress’, ‘steps’.
Returns¶
- nodeTrajectoryData
To store the data, due to the definition of TrajectoryData in aiida-core v1.0.0, data, using the same keys are those from inputs, for ‘symbols’, the value is stored by set_attribute and for the others, the values are stored by by set_array.
- static compose_core_structure(node_type, inputs)[source]¶
Compose a structure node from consumable inputs.
- Parameters:
node_type – str Contains which type of AiiDA data structure you want for the node, i.e.
structure
.inputs – Containing a key
structure
with keyssites
andunitcell
.
Here sites should contains an entry for each site with keys
position
,symbol
andkind_name
, which contain the position, the atomic symbol (e.g.Fe
) and the name to separate e.g. different symbols from each other, e.g.Fe1
.
- compose_node(node_type, inputs)[source]¶
A wrapper for compose_node with a node definition taken from NODES.
- Parameters:
node_type – str holding the type of the node. Must be one of the keys of NODES_TYPES.
quantities – A list of strings with quantities to be used for composing this node.
- Returns:
An AiidaData object of a type corresponding to node_type.
- property failed¶
- property successful¶
- aiida_vasp.parsers.node_composer.clean_nan_values(inputs: dict) dict [source]¶
Recursively replace NaN, Inf values (np.float) into None in place.
This is because AiiDA does not support serializing these values as node attributes.
Parser quantity configuration.
- class aiida_vasp.parsers.quantity.ParsableQuantities(vasp_parser_logger=None)[source]¶
Bases:
object
A Database of parsable quantities.
Get the parsable quantities from the object parsers and initialise them.
Provide ways to get parsable quantities.
- add_parsable_quantity(quantity_key, quantity_dict)[source]¶
Put parsable quantity in the waiting list
- property equivalent_quantity_keys¶
Equivalent quantity keys of quantity names
Returns¶
- dict
{quantity_name: [quantity_key, …], …}
- property quantity_keys_to_content¶
Dictionary of quantity key -> object name
- property quantity_keys_to_parse¶
List of quantity keys to parse after screening
Parser settings.
- aiida_vasp.parsers.settings.CONTENT_PARSER_SETS = {'default': {'CHGCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.chgcar.ChgcarParser'>, 'status': 'Unknown'}, 'CONTCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.poscar.PoscarParser'>, 'status': 'Unknown'}, 'DOSCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.doscar.DoscarParser'>, 'status': 'Unknown'}, 'EIGENVAL': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.eigenval.EigenvalParser'>, 'status': 'Unknown'}, 'IBZKPT': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.kpoints.KpointsParser'>, 'status': 'Unknown'}, 'OUTCAR': {'is_critical': True, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.outcar.OutcarParser'>, 'status': 'Unknown'}, 'vasp_output': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.stream.StreamParser'>, 'status': 'Unkonwn'}, 'vasprun.xml': {'is_critical': True, 'mode': 'rb', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.vasprun.VasprunParser'>, 'status': 'Unknown'}}, 'neb': {'CHGCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.chgcar.ChgcarParser'>, 'status': 'Unknown'}, 'CONTCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.poscar.PoscarParser'>, 'status': 'Unknown'}, 'DOSCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.doscar.DoscarParser'>, 'status': 'Unknown'}, 'EIGENVAL': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.eigenval.EigenvalParser'>, 'status': 'Unknown'}, 'IBZKPT': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.kpoints.KpointsParser'>, 'status': 'Unknown'}, 'OUTCAR': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.outcar.VtstNebOutcarParser'>, 'status': 'Unknown'}, 'stdout': {'is_critical': False, 'mode': 'r', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.stream.StreamParser'>, 'status': 'Unknown'}, 'vasprun.xml': {'is_critical': False, 'mode': 'rb', 'parser_class': <class 'aiida_vasp.parsers.content_parsers.vasprun.VasprunParser'>, 'status': 'Unknown'}}}¶
NODES
- class aiida_vasp.parsers.settings.ParserDefinitions(content_parser_set='default')[source]¶
Bases:
object
Container of parser definitions
- property parser_definitions¶
- class aiida_vasp.parsers.settings.ParserSettings(settings, default_settings=None, vasp_parser_logger=None)[source]¶
Bases:
object
Settings object for the VaspParser.
- Parameters:
settings – Dict with the ‘parser_settings’.
default_settings – Dict with default settings.
This provides the following properties to other components of the VaspParser:
nodes_dict: A list with all requested output nodes.
parser_definitions: A Dict with the definitions for each specific content parser.
quantities_to_parse: Collection of quantities in nodes_dict.
- NODES = {'bands': {'link_name': 'bands', 'quantities': ['eigenvalues', 'kpoints', 'occupancies'], 'type': 'core.array.bands'}, 'born_charges': {'link_name': 'born_charges', 'quantities': ['born_charges'], 'type': 'core.array'}, 'charge_density': {'link_name': 'charge_density', 'quantities': ['charge_density'], 'type': 'core.array'}, 'dielectrics': {'link_name': 'dielectrics', 'quantities': ['dielectrics'], 'type': 'core.array'}, 'dos': {'link_name': 'dos', 'quantities': ['dos'], 'type': 'core.array'}, 'dynmat': {'link_name': 'dynmat', 'quantities': ['dynmat'], 'type': 'core.array'}, 'energies': {'link_name': 'energies', 'quantities': ['energies'], 'type': 'core.array'}, 'forces': {'link_name': 'forces', 'quantities': ['forces'], 'type': 'core.array'}, 'hessian': {'link_name': 'hessian', 'quantities': ['hessian'], 'type': 'core.array'}, 'kpoints': {'link_name': 'kpoints', 'quantities': ['kpoints'], 'type': 'core.array.kpoints'}, 'misc': {'link_name': 'misc', 'quantities': ['total_energies', 'maximum_stress', 'maximum_force', 'notifications', 'run_status', 'run_stats', 'version'], 'type': 'core.dict'}, 'poscar-structure': {'link_name': 'structure', 'quantities': ['poscar-structure'], 'type': 'core.structure'}, 'projectors': {'link_name': 'projectors', 'quantities': ['projectors'], 'type': 'core.array'}, 'site_magnetization': {'link_name': 'site_magnetization', 'quantities': ['site_magnetization'], 'type': 'core.dict'}, 'stress': {'link_name': 'stress', 'quantities': ['stress'], 'type': 'core.array'}, 'structure': {'link_name': 'structure', 'quantities': ['structure'], 'type': 'core.structure'}, 'trajectory': {'link_name': 'trajectory', 'quantities': ['trajectory'], 'type': 'core.array.trajectory'}, 'wavecar': {'link_name': 'wavecar', 'quantities': ['wavecar'], 'type': 'vasp.wavefun'}}¶
- add_output_node(node_name, node_dict, is_custom_node=False)[source]¶
Add a definition of node to the nodes dictionary.
- property critical_notifications_to_check¶
Return the list of critical notification names to be checked
- property output_nodes_dict¶
- property quantity_names_to_parse¶
Return the combined list of all the quantities, required for the current nodes.
- property settings¶
Return the settings dictionary.
VASP parser.
node_composer
handles the quantity composition of nodesquantity
the actual quantity to parse and what object parsers to use to obtain itsettings
general parser settingsmanager
takes the quantity definitions and executes the actual parsing needed
- class aiida_vasp.parsers.vasp.NotificationComposer(notifications, parsed_quantities, inputs, exit_codes, parser_settings)[source]¶
Bases:
object
Compose errors codes based on the notifications
- property brmix¶
Check if BRMIX should be emitted
- compose()[source]¶
Compose the exit codes
Returns None if no exit code should be emitted, otherwise emit the error code.
- property edddav_zhegv¶
Check if EDDDAV call to ZHEGV should be emitted. Sometimes it has converged.
- property eddrmm_zhegv¶
Check if EDDRMM call to ZHEGV should be emitted. Sometimes it has converged.
- class aiida_vasp.parsers.vasp.VaspParser(node)[source]¶
Bases:
BaseParser
Parses all VASP calculations.
This particular class manages all the specific parsers located in aiida_vasp.parsers.content_parsers. The parser will check which quantities to parse and which nodes to add to the calculation based on the ‘parser_settings’ card in the ‘settings’ Dict of the corresponding VaspCalculation.
Parser Settings usage:
Parser settings can be passed through the input node settings as follows:
settings = Dict(dict={ 'parser_settings': { ... } })
Valid keys for parser_settings are:
add_<quantity>, where quantity is one of:
‘misc’: (Default) Parameterdata node containing various quantities from OUTCAR and vasprun.xml. ‘structure’: (Default) StructureData node parsed from CONTCAR ‘bands’: Band structure node parsed from EIGENVAL. ‘dos’: ArrayData node containing the DOS parsed from DOSCAR. ‘kpoints’: KpointsData node parsed from IBZKPT. ‘wavecar’: SinglefileData node containing the WAVECAR. ‘charge_density’: SinglefileData node containing the CHGCAR.
If the value is set to
False
the quantity will not be returned.critical_notifications: A dictionary of critical errors to be checked with items like ‘add_<key>’: True, similiar to the add_<quantity> syntax described above.
output_params: A list of quantities, that should be added to the ‘misc’ node.
content_parser_set: String (DEFAULT = ‘default’).
By this option the default set of object parsers can be chosen. See settings.py for available options.
ignore_all_errors: If set to True, will skip checks for critical error messages. Defaults to False.
Additional object parsers can be added to the VaspParser by using
VaspParser.add_content_parser(parser_name, parser_definition_dict),
where the ‘parser_definition_dict’ should contain the ‘parser_class’ and the ‘is_critical’ flag. Keep in mind adding an additional object parsers after ‘parse_with_retrieved’ is called, will only have an effect when parsing a second time.
- COMPOSER_CLASS¶
alias of
NodeComposer
- add_parsable_quantity(quantity_name, quantity_dict)[source]¶
Add a single parsable quantity to the _parsable_quantities.
- add_parser_definition(name, parser_dict)[source]¶
Add the definition of an oobject parser to self._definitions.
- property parser_settings¶
The parser_settings dictionary passed
VASP to Wannier90 parser.
- class aiida_vasp.parsers.vasp2w90.Vasp2w90Parser(node)[source]¶
Bases:
VaspParser
Parse a finished aiida_vasp.Vasp2w90Calculation.