vasppy.optics module

functions for working with optical properties from vasprun.xml

absorption_coefficient(dielectric)[source]

Calculate the optical absorption coefficient from an input set of pymatgen vasprun dielectric constant data.

Parameters:

dielectric (list) –

A list containing the dielectric response function in the pymatgen vasprun format.

element 0: list of energies
element 1: real dielectric tensors, in [xx, yy, zz, xy, xz, yz] format.
element 2: imaginary dielectric tensors, in [xx, yy, zz, xy, xz, yz] format.

Returns:

absorption coefficient using eV as frequency units (cm^-1).

Return type:

(np.array)

Notes

The absorption coefficient is calculated as

\[\alpha = \frac{2\sqrt{2} \pi}{\lambda} \sqrt{-\epsilon_1+\sqrt{\epsilon_1^2+\epsilon_2^2}}\]
matrix_eigvals(matrix)[source]

Calculate the eigenvalues of a matrix.

Parameters:

matrix (np.array) – The matrix to diagonalise.

Returns:

Array of the matrix eigenvalues.

Return type:

(np.array)

parse_dielectric_data(data)[source]

Convert a set of 2D vasprun formatted dielectric data to the eigenvalues of each corresponding 3x3 symmetric numpy matrices.

Parameters:

data (list) – length N list of dielectric data. Each entry should be a list of [xx, yy, zz, xy, xz, yz ] dielectric tensor elements.

Returns:

a Nx3 numpy array. Each row contains the eigenvalues

for the corresponding row in data.

Return type:

(np.array)

plot_dielectric_functions(dielectric, ax=None)[source]
to_matrix(xx, yy, zz, xy, yz, xz)[source]

Convert a list of matrix components to a symmetric 3x3 matrix.

Inputs should be in the order xx, yy, zz, xy, yz, xz.

Parameters:
  • xx (float) – xx component of the matrix.

  • yy (float) – yy component of the matrix.

  • zz (float) – zz component of the matrix.

  • xy (float) – xy component of the matrix.

  • yz (float) – yz component of the matrix.

  • xz (float) – xz component of the matrix.

Returns:

The matrix, as a 3x3 numpy array.

Return type:

(np.array)