YamboRTGlesserParser

Module that manages the parsing of the ndb.RT_G_PAR database created by yambo_rt.

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

Bases: object

Class to manage information about the \(G^<\) from the ndb.RT_G_PAR database created by yambo_rt.

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

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

Gless

Array with the variable dG_lesser that contains the lesser component of the time-dependent Green function expressed in the Kohn-Sham basis. The structure of the array is [time,kpoint,band1,band2,real and imaginary part]

Type:

np.array

buildDensityMatrix(first_time=None, last_time=None, first_k=None, last_k=None, first_band=None, last_band=None, equilibrium_dm=None)[source]

Compute the density matrix from the Green function according to the relation

\[\rho_{b1,b2,k}(t) = -iG^<_{b2,b1,k}(t)\]

The real and complex parts of the dG array are recasted to produce the complex structure of the density matrix. Note that the band indices are transposed, since in this way we are able to reproduce the correct expectation of on observable using the relation \(<O> = Tr(\rho O)\). If the equilibrium_dm argument is not None add the equilibrium occupations, provided in the argument, to the density matrix.

Parameters:
  • first_time (int) – index of the first time variable. If None the first value of the Green function is used

  • last_time (int) – index of the last time variable. If None the last value of the Green function is used

  • first_k (int) – index of the first k variable. If None the first value of the Green function is used

  • last_k (int) – index of the last k variable. If None the last value of the Green function is used

  • first_band (int) – index of the first band. If None the first value of the Green function is used

  • last_band (int) – index of the last band. If None the last value of the Green function is used

  • equilibrium_dm (array) – if not None include the equilibrium occupations. The equilibrium_dm has to be an array with shape equal to (band1,band2) and the slice corresponding to the block of the Green function is extracted

Returns:

the complex array with the density matrix.

The structure of the array is [time,kpoint,band1,band2]

Return type:

(array)

buildEqDensityMatrix(num_occupied_bands=1, band_occupation=2)[source]

Compute the equilibrium density matrix, that is a (time and k independent) diagonal array filled with the occupations of the bands

Parameters:
  • num_occupied_bands (int) – number of occupied bands

  • occupation (int) – set the number of electrons in the occupied bands

Returns:

diagonal array (of the dimension of the Green function)

with the equilibrium occupations

Return type:

array

get_info()[source]

Provide information on the attributes of the class

readDB(verbose)[source]

Read the data from the ndb.RT_G_PAR database created by yambo_rt. The variables are extracted from the database and stored in the attributes of the object.

Parameters:

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

mppi.Parsers.YamboRTGlesserParser.buildBlochVectors(dm)[source]

Build the Bloch vectors \(u_i(t,k)\) (for each time step and for each k point) associated to the 2x2 density matrix provided as input. Bloch vectors are computed according to the relation

\[u_1(t,k) = 2Re(\rho_{0,1,k}(t)) \, , \ u_2(t,k) = -2Im(\rho_{0,1,k}(t)) \, , \ u_3(t,k) = \rho_{0,0,k}(t) - \rho_{1,1,k}(t)\]

The Bloch vectors are rescaled by the value of the trace of the density matrix (for each time and k point). If one trace vanishes the vector associated to the same time and k is set to zero.

Parameters:

dm (array) – time and k dependent array(s) with the 2x2 density matrix. The function assumes that the shape of dm is (time,kpoint,2,2)

Returns:

the real array with the Bloch vectors for all the times and k points.

The shape of the array is (component,time,kpoint)

Return type:

(array)