YamboOutputParser

Module that manages the parsing of a Yambo o- file(s).

class mppi.Parsers.YamboOutputParser.YamboOutputParser(output, verbose=True, extendOut=True)[source]

Bases: dict

Class that performs the parsing of a Yambo o- file(s). The class ineriths from dict and the instance of the class is a dictionary with the data. The keys correspond to the extension of the parsed files.

Parameters:
  • output (list) – Dictionary with the structure of the output of get_output_files() of the YamboCalculator module.

  • verbose (boolean) – Determine the amount of information provided on terminal

  • extendOut (boolean) – Determine which dictionary is used as reference for the names of the variables

classmethod from_file(file, verbose=True, extendOut=True)[source]

Init the a YamboOutputParser instance using a single ‘o-’ file. The key of the dictionary built by the parser is computed using the type_identifier() method of the YamboCalculator module.

Parameters:
  • file (string) – name of the ‘o-’ file

  • verbose (boolean) – Determine the amount of information provided on terminal

  • extendOut (boolean) – Determine which dictionary is used as reference for the names of the variables

classmethod from_path(path, verbose=True, extendOut=True)[source]

Init the a YamboOutputParser instance using the ‘o-’ files found inside the path. If several replica of the output files are found the method select the one associated to the last Yambo computation.

Parameters:
  • path (string) – name of the folder that contains the ‘o-’ files

  • verbose (boolean) – Determine the amount of information provided on terminal

  • extendOut (boolean) – Determine which dictionary is used as reference for the names of the variables

get_energy(k, bnd, verbose=False)[source]

Compute the energy (in eV) of the selected state with k and bnd indexes. The method is implemented for the ‘hf’ and ‘qp’ runleves. In the first case it seeks for the ‘Ehf’ variable while in the former it looks for the ‘E’ variable (written only with the extendOut option enabled!). In the other cases a warning is created.

Parameters:
  • k (int) – k-point index

  • bnd (int) – band index

Returns:

the value of the energy in eV

Return type:

(float)

get_gap(k_full, band_full, verbose=False, **kwargs)[source]

Compute the energy gap of the selected (k_full,band_full) and (k_empty,band_empty) couples (in eV).

Parameters:
  • k_full (int) – k-point index of the full state

  • band_full (int) – band index of the full state

  • **kwargs – these parameters allow the user to set the k_empty and band_empty parameters. If not provided the values k_empty=k_full and band_empty=band_full+1 are used.

Returns:

the value of the band gap in eV

Return type:

(float)

get_info()[source]

Provide information on the keys structure of the instance of the class

mppi.Parsers.YamboOutputParser.make_dict(columns, suffix, extendOut)[source]

Create a dictionary from the columns array. If the suffix is found in the ref dictionary, and if the number of columns matchs the numnber of elements in the reference key, attribute to the keys the associated names, otherwise associate string value ‘col’+str(ind), where ind is the column index starting from one. The choice of the ref dictionary depends on the value of extendOut.

Parameters:
  • columns (array) – array with the data sorted in columns

  • suffix (string) – specifies the run level

  • extendOut (bool) – specifies which dictionary has to be used as reference values of the columns names

mppi.Parsers.YamboOutputParser.parseYamboOutput(file, suffix, extendOut)[source]

Read the data from the o- file. Data of the file are stored as key : values in the self[suffix] dictionary. The names of the keys are taken from the reference_column_names or from the reference_column_names_extendOut (depending on the value of the boolean extendOut), if the suffix is recognized.