PwParser

Class to perform the parsing of a QuantumESPRESSO XML file. Makes usage of the data-file-schema.xml file that is found in the run_dir/prefix.save folder.

class mppi.Parsers.PwParser.PwParser(file, verbose=True)[source]

Bases: object

Initialize the data member of the class. The init method is able to manage a TypeError since, if the QeCalculator simulation fails the name of the output file is set to None.

Parameters
  • file (str) – The name, including the path of the data-file-schema.xml

  • verbose (bool) – set the amount of information written on terminal

natoms

number of atoms in the cell

natypes

number of atomic species

atomic_positions

list with the position of each atom

atomic_species

dictionary with mass and pseudo for each species

num_electrons

number of electrons

nkpoints

numer of kpoints

nbands

number of bands

nbands_full

number of occupied bands (for systems with a gap)

nbands_empty

number of empty bands (for systems with a gap)

occupations_kind

type of occupation (fixed or smearing)

kpoints

list of the kpoints

occupations

array with the bands occupation for each kpoint

weights

array with the weight of each kpoint, each element is a one-dimensional array.

energy

total energy of the system (in Hartree)

evals

array of the ks energies for each kpoint (in Hartree)

lsda

True if collinear spin is activated

noncolin

True if noncollinear spin calculation is activated

spinorbit

True if spin-orbit couping is present

spin_degen

1 if lsda or non collinear spin is activated, 2 otherwise

get_energy(convert_eV=True)[source]

Return the total energy the system. If convert_eV is True the energy is provided in eV other the Hartree units are used.

get_evals(set_scissor=None, set_gap=None, set_direct_gap=None, verbose=True)[source]

Return the ks 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, the energy shift of empty bands does not update their occupation levels.

Parameters
  • 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

get_fermi(convert_eV=True)[source]

Return the fermi energy of the system (if present in the xml file). If convert_eV is True the fermi energy is provided in eV, otherwise the Hartree units are used.

get_gap(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.

Returns

a dictionary with the values of direct and indirect gaps and the positions of the VMB and CBM

Return type

dict

get_transitions(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
  • 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

parseXML(file)[source]

Read the data from the xml file in the new format of QuantumESPRESSO. Some variable are extracted from the XML file and stored in the attributes of the object.