Dos

This module defines the tools to build and manage the Density of States (Dos). A Dos can be built starting from various inputs like the output of QuantumESPRESSO or a Yambo computations or from a generic one-dimensional array. Different Dos can be managed together.

class mppi.Utilities.Dos.Dos(energies=None, weights=None, norm=1.0, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function lorentzian>, label=None)[source]

Bases: object

Definition of the density of state class. The dos is normalized so that its integral is equal to the norm of the weights divided the step of x axis sampling.

dos

list with the tuple (energies,histrogram) for each dos appended to the class

Type:

list

labels

list with the labels of the appended dos

Type:

list

Parameters:
  • energies (numpy.array) – one-dimensional array with the values used to build the Dos. If no energy is provided an empty Dos instance is created

  • weights (numpy.array) – one-dimensional array with the weight of each value. If None a uniform array normalized to one is used

  • norm (float) – the normalization of the (uniform) weights array

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

append(energies, weights=None, norm=1.0, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function lorentzian>, label=None)[source]

This method add the tuple (x,histo) generated by the function build_histogram to the dos members of the class. The label of the new dos is added to the labels member.

Parameters:
  • energies (numpy.array) – one-dimensional array with the values used to build the Dos

  • weights (numpy.array) – one-dimensional array with the weight of each value. If None a uniform array normalized to one is used

  • norm (float) – the normalization of the (uniform) weights array

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

  • label (string) – label associated to the dos

append_fromPw(results, set_gap=None, set_direct_gap=None, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function lorentzian>, label=None)[source]

Add one element to the Dos class starting from the xml output file of a QuantumESPRESSO computation.

Parameters:
  • results (string) – the data-file-schema.xml that contains the result of the QuantumESPRESSO computation

  • set_gap (float) – set the value of the gap (in eV) of the system

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

  • label (string) – the label of the appended dos

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

append_fromPwData(evals, weights, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function lorentzian>, label=None)[source]

Add one element to the Dos class starting from arrays with the structure of the evals and weights attributes of the PwParser class. This method can be used to build a JDos, using the transitions as evals.

Parameters:
  • evals (numpy.array) – array with the structure of the self.evals of the PwParser

  • weights (numpy.array) – array with the structure of the self.weights of the PwParser

  • label (string) – the label of the appended dos

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

classmethod from_Pw(results, set_gap=None, set_direct_gap=None, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function lorentzian>, label=None)[source]

Initialize the Dos class from the xml output file of a QuantumESPRESSO computation. The class makes usage of the PwParser of this package.

Parameters:
  • results (string) – the data-file-schema.xml that contains the result of the QuantumESPRESSO computation

  • set_gap (float) – set the value of the gap (in eV) of the system

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

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

plot(plt, axes=None, rescale=False, include=None, legend=True, **kwargs)[source]

Plot the elements of the Dos class

Parameters:
  • plt (matplotlib.pyplot.axes) – the matplotlib object

  • plt – the matplotlib axes object. If provided the plot is performed on the given axes

  • rescale (bool) – if True all the dos are rescaled to the same maximum value equal to 1.0 (useful for comparison)

  • include (list) – list with the indexes (as appended to the dos member ) of the dos that are plotted

  • legend (bool) – if True show the legend of the plot

  • kwargs – further parameter to edit the line style of the plot

mppi.Utilities.Dos.build_histogram(values, weights=None, norm=1.0, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind='lorentzian')[source]

This function builds the histogram associated to a generic one-dimensional array. If the weights are not specified a uniform array of weights, normalized to norm, is assumed.

Parameters:
  • values (numpy.array) – one-dimensional array with the values used to build the Dos

  • weights (numpy.array) – one-dimensional array with the weight of each value. If None a uniform array normalized to one is used

  • norm (float) – the normalization of the (uniform) weights array

  • minVal (float) – values lower than this parameter are not included in the histogram

  • maxVal (float) – values higher than this parameter are not included in the histogram

  • step (float) – size of the bin (in the same units used for the values array)

  • eta (float) – magnitude of the broading parameter (in the same units used for the values array)

  • broad_kind (string) – type of broading function used (lorentzian, gaussian)

  • label (string) – label associated to the dos

Returns:

tuple containing:

(numpy.array) : x axis of the histogram (numpy.array) : histogram values

Return type:

(tuple)

mppi.Utilities.Dos.convert_PwData(evals, weights)[source]

Convert the arrays with the structure of evals and weights of the PwParser class into the form suitable to be managed by the build_histogram function.

Parameters:
  • evals (numpy.array) – array with the structure of the self.evals of PwParser

  • weights (numpy.array) – array with the structure of the self.weights of PwParser

Returns:

tuple containing:

(numpy.array) : one-dimensioanal array with the energies (numpy.array) : one-dimensional array with the associated weights

Return type:

(tuple)

mppi.Utilities.Dos.gaussian(eta, x0, x)[source]

Get the gaussian function.

mppi.Utilities.Dos.lorentzian(eta, x0, x)[source]

Get the lorentzian function.