Calculation parsers

This section describes the different parsers classes for calculations.

Quantum ESPRESSO parsers

aiida.parsers.plugins.quantumespresso.convert_qe2aiida_structure(output_dict, input_structure=None)[source]

Receives the dictionary cell parsed from quantum espresso Convert it into an AiiDA structure object

Basic Raw Cp Parser

aiida.parsers.plugins.quantumespresso.basic_raw_parser_cp.parse_cp_text_output(data, xml_data)[source]

data must be a list of strings, one for each lines, as returned by readlines(). On output, a dictionary with parsed values

aiida.parsers.plugins.quantumespresso.basic_raw_parser_cp.parse_cp_traj_stanzas(num_elements, splitlines, prepend_name, rescale=1.0)[source]

num_elements: Number of lines (with three elements) between lines with two only elements (containing step number and time in ps). num_elements is 3 for cell, and the number of atoms for coordinates and positions.

splitlines: a list of lines of the file, already split in pieces using string.split

prepend_name: a string to be prepended to the name of keys returned in the return dictionary.

rescale: the values in each stanza are multiplied by this factor, for units conversion

aiida.parsers.plugins.quantumespresso.basic_raw_parser_cp.parse_cp_xml_counter_output(data)[source]

Parse xml file print_counter.xml data must be a single string, as returned by file.read() (notice the difference with parse_text_output!) On output, a dictionary with parsed values.

aiida.parsers.plugins.quantumespresso.basic_raw_parser_cp.parse_cp_xml_output(data)[source]

Parse xml data data must be a single string, as returned by file.read() (notice the difference with parse_text_output!) On output, a dictionary with parsed values. Democratically, we have decided to use picoseconds as units of time, eV for energies, Angstrom for lengths.

Basic Raw Pw Parser

A collection of function that are used to parse the output of Quantum Espresso PW. The function that needs to be called from outside is parse_raw_output(). The functions mostly work without aiida specific functionalities. The parsing will try to convert whatever it can in some dictionary, which by operative decision doesn’t have much structure encoded, [the values are simple ]

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.cell_volume(a1, a2, a3)[source]

returns the volume of the primitive cell: |a1.(a2xa3)|

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.convert_list_to_matrix(in_matrix, n_rows, n_columns)[source]

converts a list into a list of lists (a matrix like) with n_rows and n_columns

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.convert_qe_time_to_sec(timestr)[source]

Given the walltime string of Quantum Espresso, converts it in a number of seconds (float).

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.parse_QE_errors(lines, count, warnings)[source]

Parse QE errors messages (those appearing between some lines with '%%%%%%%%')

Parameters:
  • lines – list of strings, the output text file as read by readlines() or as obtained by data.split(‘n’) when data is the text file read by read()
  • count – the line at which we identified some '%%%%%%%%'
  • warnings – the warnings already parsed in the file
Return messages:
 

a list of QE error messages

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.parse_pw_text_output(data, xml_data=None, structure_data=None, input_dict=None)[source]

Parses the text output of QE-PWscf.

Parameters:
  • data – a string, the file as read by read()
  • xml_data – the dictionary with the keys read from xml.
  • structure_data – dictionary, coming from the xml, with info on the structure
Return parsed_data:
 

dictionary with key values, referring to quantities at the last scf step.

Return trajectory_data:
 

key,values referring to intermediate scf steps, as in the case of vc-relax. Empty dictionary if no value is present.

Return critical_messages:
 

a list with critical messages. If any is found in parsed_data[‘warnings’], the calculation is FAILED!

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.parse_pw_xml_output(data, dir_with_bands=None)[source]

Parse the xml data of QE v5.0.x Input data must be a single string, as returned by file.read() Returns a dictionary with parsed values

aiida.parsers.plugins.quantumespresso.basic_raw_parser_pw.parse_raw_output(out_file, input_dict, parser_opts=None, xml_file=None, dir_with_bands=None)[source]

Parses the output of a calculation Receives in input the paths to the output file and the xml file.

Parameters:
  • out_file – path to pw std output
  • input_dict – not used
  • parser_opts – not used
  • dir_with_bands – path to directory with all k-points (Kxxxxx) folders
  • xml_file – path to QE data-file.xml
Returns out_dict:
 

a dictionary with parsed data

Return successful:
 

a boolean that is False in case of failed calculations

Raises:
  • QEOutputParsingError – for errors in the parsing,
  • AssertionError – if two keys in the parsed dicts are found to be qual

3 different keys to check in output: parser_warnings, xml_warnings and warnings. On an upper level, these flags MUST be checked. The first two are expected to be empty unless QE failures or unfinished jobs.

Basic Pw Parser

class aiida.parsers.plugins.quantumespresso.basicpw.BasicpwParser(calc)[source]

This class is the implementation of the Parser class for PWscf.

get_linkname_out_kpoints()[source]

Returns the name of the link to the output_kpoints Node exists if cell has changed and no bands are stored.

get_linkname_outarray()[source]

Returns the name of the link to the output_array Node may exist in case of calculation=’scf’

get_linkname_outstructure()[source]

Returns the name of the link to the output_structure Node exists if positions or cell changed.

get_linkname_outtrajectory()[source]

Returns the name of the link to the output_trajectory. Node exists in case of calculation=’md’, ‘vc-md’, ‘relax’, ‘vc-relax’

get_parser_settings_key()[source]

Return the name of the key to be used in the calculation settings, that contains the dictionary with the parser_options

parse_with_retrieved(retrieved)[source]

Receives in input a dictionary of retrieved nodes. Does all the logic here.

Constants

Physical or mathematical constants. Since every code has its own conversion units, this module defines what QE understands as for an eV or other quantities. Whenever possible, we try to use the constants defined in :py:mod:aiida.common.constants:, but if some constants are slightly different among different codes (e.g., different standard definition), we define the constants in this file.

Cp Parser

class aiida.parsers.plugins.quantumespresso.cp.CpParser(calc)[source]

This class is the implementation of the Parser class for Cp.

get_linkname_trajectory()[source]

Returns the name of the link to the output_structure (None if not present)

parse_with_retrieved(retrieved)[source]

Receives in input a dictionary of retrieved nodes. Does all the logic here.