ParsersUtils

Function used by the the PwParser and the YamboDftParser classes. The elements of this module can be also directly accessed by the user to perform some useful operations like compute the volume of a lattice, or perform the conversion from cartesian to crystal units.

mppi.Parsers.ParsersUtils.compute_transitions(bands, in_list, fin_list)[source]

Compute the (positive) transition energies for the bands (on a single kpoint). The fast index is associated to the bands in the fin_list list.

Parameters:
  • bands (list) – list with the energies

  • in_list (list) – indexes of the bands used as starting points of the transitions

  • fin_list (list) – indexes of the bands used as final points of the transitions

Returns:

list with the transition energies for each possible couple of (distinct) in and out bands

Return type:

list

mppi.Parsers.ParsersUtils.get_evals(evals, nbands, nbands_full, set_scissor=None, set_gap=None, set_direct_gap=None, verbose=True)[source]

Return the bands energies for each kpoint (in eV). The top of the valence band is used as the reference energy value. It is possible to shift the energies of the empty bands by setting an arbitrary value for the gap (direct or indirect) or by adding an explicit scissor. Implemented only for semiconductors.

Parameters:
  • evals (numpy.array) – an array with the bands energy (in Hartree) for each k point

  • nbands (int) – number of bands

  • nbands_full (int) – number of occupied bands

  • set_scissor (float) – set the value of the scissor (in eV) that is added to the empty bands. If a scissor is provided the set_gap and set_direct_gap parameters are ignored

  • set_gap (float) – set the value of the gap (in eV) of the system. If set_gap is provided the set_direct_gap parameter is ignored

  • set_direct_gap (float) – set the value of the direct gap (in eV) of the system.

Returns:

an array with the ks energies for each kpoint

Return type:

numpy.array

mppi.Parsers.ParsersUtils.get_gap(evals, nbands_full, verbose=True)[source]

Compute the energy gap of the system (in eV). The method check if the gap is direct or indirect. Implemented and tested only for semiconductors.

Parameters:
  • evals (numpy.array) – an array with the bands energy (in Hartree) for each k point

  • nbands_full (int) – number of occupied bands

Returns:

a dictionary with the values of direct and indirect gaps and the k-point indexes of the VMB of the CBM and of the direct gap

Return type:

dict

mppi.Parsers.ParsersUtils.get_transitions(evals, nbands, nbands_full, initial='full', final='empty', set_scissor=None, set_gap=None, set_direct_gap=None)[source]

Compute the (vertical) transitions energies. For each kpoint compute the transition energies, i.e. the (positive) energy difference (in eV) between the final and the initial states.

Parameters:
  • evals (numpy.array) – an array with the bands energy (in Hartree) for each k point

  • nbands (int) – number of bands

  • nbands_full (int) – number of occupied bands

  • initial (string or list) – specifies the bands from which electrons can be extracted. It can be set to full or empty to select the occupied or empty bands, respectively. Otherwise a list of bands can be provided

  • final (string or list) – specifies the final bands of the excited electrons. It can be set to full or empty to select the occupied or empty bands, respectively. Otherwise a list of bands can be provided

  • set_scissor (float) – set the value of the scissor (in eV) that is added to the empty bands. If a scissor is provided the set_gap and set_direct_gap parameters are ignored

  • set_gap (float) – set the value of the gap (in eV) of the system. If set_gap is provided the set_direct_gap parameter is ignored

  • set_direct_gap (float) – set the value of the direct gap (in eV) of the system.

Returns:

an array with the transition energies for each kpoint

Return type:

numpy.array

mppi.Parsers.ParsersUtils.get_variable_from_db(ndb_file, var_name)[source]

Extract the value of a variable from a ndb database

Parameters:
  • ndb_file (string) – the name of the database

  • var_name (string) – name of the variable

Returns:

array with the values of the variable

Return type:

numpy.ndarray