YamboDftParser

Class to perform the parsing of the ns.db1 database in the SAVE folder of a Yambo computation. This database collects information on the lattice properties and electronic band structure of the system.

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

Bases: object

Class to read information about the lattice and electronic structure from the ns.db1 database created by Yambo

Parameters:
  • file (string) – string with the name of the file to be parsed

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

syms

the symmetries of the lattice

lattice

array with the lattice vectors. The i-th row represents the i-th lattice vector in cartesian units

alat

the lattice parameter. Yambo stores a three dimensional array in this field, with the lenght of the cell in the three dimension

num_electrons

number of electrons

nbands

number of bands

nbands_full

number of occupied bands

nbands_empty

number of empty bands

nkpoints

numer of kpoints

kpoints

list of the kpoints expressed in cartesian coordinates in units of 2pi/alat. Note the Yambo uses a vector like alat parameter, so the components of the kpoints can differ from Pw ones

evals

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

spin

number of spin components

spin_degen

1 if the number of spin components is 2, 2 otherwise

eval_lattice_volume(rescale=False)[source]
Compute the volume of the direct lattice. If rescale is False the results is expressed in a.u., otherwise

the lattice vectors are expressed in units of alat.

Returns:

lattice volume

Return type:

float

eval_reciprocal_lattice_volume(rescale=False)[source]

Compute the volume of the reciprocal lattice. If rescale is True the reciprocal lattice vectors are expressed in units of 2*np.pi/alat.

Returns:

reciprocal lattice volume

Return type:

float

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.

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_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_info()[source]

Provide information on the attributes of the class

get_kpoints(use_scalar_alat=True)[source]

Get the kpoints using cartesian coordinates in units of 2*np.pi/alat (with a vector alat).

Parameters:

use_scalar_alat (bool) – if True express the kpoints in units of 2*np.pi/alat[0]

Returns:

array with the kpoints

Return type:

array

get_lattice(rescale=False)[source]

Compute the lattice vectors. If rescale = True the vectors are expressed in units of the lattice constant. We use the first component of the lattice constant, which corresponds to the alat or celldm1 variable of the class PwParser

Parameters:

rescale (bool) – if True express the lattice vectors in units alat

Returns:

array with the lattice vectors a_i as rows

Return type:

array

get_reciprocal_lattice(rescale=False)[source]

Compute the reciprocal lattice vectors. If rescale = False the vectors are normalized so that np.dot(a_i,b_j) = 2*np.pi*delta_ij, where a_i is a basis vector of the direct lattice. If rescale = True the reciprocal lattice vectors are expressed in units of 2*np.pi/alat. We use the first component of the lattice constant, which corresponds to the alat or celldm1 variable of the class PwParser

Parameters:

rescale (bool) – if True express the reciprocal vectors in units of 2*np.pi/alat

Returns:

array with the reciprocal lattice vectors b_i as rows

Return type:

array

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

readDB()[source]

Read the data from the ns.db1 database created by Yambo. Some variables are extracted from the database and stored in the attributes of the object.