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:
objectDefinition 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 Dosweights (
numpy.array) – one-dimensional array with the weight of each value. If None a uniform array normalized to one is usedminVal (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.
-
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 computationset_gap (
float) – set the value of the gap (in eV) of the systemset_direct_gap (
float) – set the value of the direct gap (in eV) of the system. If set_gap is provided this parameter is ignoredlabel (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 PwParserweights (
numpy.array) – array with the structure of the self.weights of the PwParserlabel (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 computationset_gap (
float) – set the value of the gap (in eV) of the systemset_direct_gap (
float) – set the value of the direct gap (in eV) of the system. If set_gap is provided this parameter is ignoredminVal (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, rescale=False, include=None)[source]¶ Plot the elements of the Dos class
- Parameters
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
-
-
mppi.Utilities.Dos.build_histogram(values, weights=None, norm=1.0, minVal=None, maxVal=None, step=0.01, eta=0.05, broad_kind=<function 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 Dosweights (
numpy.array) – one-dimensional array with the weight of each value. If None a uniform array normalized to one is usednorm (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)
- 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 PwParserweights (
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)