DielectricFunction

class py4vasp.data.DielectricFunction(raw_data)

Bases: py4vasp.data._base.DataBase, py4vasp.data._export.Image

The dielectric function resulting from electrons and ions.

You can use this class to extract the dielectric function of a Vasp calculation. Vasp evaluates actually evaluates the (symmetric) dielectric tensor, so all the returned quantities are 3x3 matrices. For plotting purposes this is reduced to the 6 independent variables.

Parameters

raw_dielectric_function (RawDielectricFunction) – Dataclass containing the raw data necessary to produce a dielectric function.

Methods Summary

from_dict(dict_)

Initialize refinement class from data dictionary

from_file([file])

Read the data dictionary from the given file.

plot([selection])

Read the data and generate a plotly figure.

print()

Print a string representation of this class to standard output.

read()

Read the data into a dictionary.

to_dict()

Read the data into a dictionary.

to_image(*args[, filename])

Read the data and generate an image writing to the given filename.

to_plotly([selection])

Read the data and generate a plotly figure.

Methods Documentation

classmethod from_dict(dict_)

Initialize refinement class from data dictionary

Parameters

data_dict (dict) – Data dictionary that contains one or more different raw data sources.

classmethod from_file(file=None)

Read the data dictionary from the given file.

You want to use this method if you want to avoid using the Calculation wrapper, for example because you renamed the output of the VASP calculation.

Parameters

file (str or Path or raw.File) – Filename from which the data is extracted. If not present the default filename is used. Alternatively, you can open the file yourself and pass the File object. In that case, you need to take care the file is properly closed again and be aware the generated instance of this class becomes unusable after the file is closed.

Returns

The returned instance handles opening and closing the file for every function called on it, unless a File object in which case this is left to the user.

Return type

DataBase

plot(selection=None)

Read the data and generate a plotly figure.

Parameters

selection (str) – Specify along which directions and which components of the dielectric function you want to plot. Defaults to isotropic and both the real and the complex part.

Returns

plotly figure containing the dielectric function for the selected directions and components.

Return type

plotly.graph_objects.Figure

print()

Print a string representation of this class to standard output.

read()

Read the data into a dictionary.

Returns

Contains the energies at which the dielectric function was evaluated and the dielectric tensor (3x3 matrix) at these energies.

Return type

dict

to_dict()

Read the data into a dictionary.

Returns

Contains the energies at which the dielectric function was evaluated and the dielectric tensor (3x3 matrix) at these energies.

Return type

dict

to_image(*args, filename=None, **kwargs)

Read the data and generate an image writing to the given filename.

The filetype is automatically deduced from the filename; possible are common raster (png, jpg) and vector (svg, pdf) formats. If no filename is provided a default filename is deduced from the name of the class and the picture has png format.

Note that the filename must be a keyword argument, i.e., you explicitly need to write filename=”name_of_file” because the arguments are passed on to the plot() function. Please check the documentation of that function to learn which arguments are allowed.

to_plotly(selection=None)

Read the data and generate a plotly figure.

Parameters

selection (str) – Specify along which directions and which components of the dielectric function you want to plot. Defaults to isotropic and both the real and the complex part.

Returns

plotly figure containing the dielectric function for the selected directions and components.

Return type

plotly.graph_objects.Figure