Calculate spectroscopy limited maximum efficiency (SLME) given dielectric function data

Forked and adjusted from :

References: 1) &


Calculate the optical absorption coefficient from an input set of pymatgen vasprun dielectric constant data. :param dielectric: 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.


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

Return type:



Get direct and indirect bandgaps for a vasprun.xml


Calculate the eigenvalues of a matrix. :param matrix: The matrix to diagonalise. :type matrix: np.array


Array of the matrix eigenvalues.

Return type:



Helper function to calculate optical absorption coefficient


Convert a set of 2D vasprun formatted dielectric data to the eigenvalues of each corresponding 3x3 symmetric numpy matrices. :param data: length N list of dielectric data. Each entry should be

a list of [xx, yy, zz, xy, xz, yz ] dielectric tensor elements.


a Nx3 numpy array. Each row contains the eigenvalues

for the corresponding row in data.

Return type:


slme(material_energy_for_absorbance_data, material_absorbance_data, material_direct_allowed_gap, material_indirect_gap, thickness=5e-05, temperature=293.15, absorbance_in_inverse_centimeters=False, cut_off_absorbance_below_direct_allowed_gap=True, plot_current_voltage=False)[source]

Calculate the SLME

  • material_energy_for_absorbance_data – energy grid for absorbance data

  • material_absorbance_data – absorption coefficient in m^-1

  • material_direct_allowed_gap – direct bandgap in eV

  • material_indirect_gap – indirect bandgap in eV

  • thickness – thickness of the material in m

  • temperature – working temperature in K

  • absorbance_in_inverse_centimeters – whether the absorbance data is in the unit of cm^-1

  • cut_off_absorbance_below_direct_allowed_gap – whether to discard all absorption below bandgap

  • plot_current_voltage – whether to plot the current-voltage curve


The calculated maximum efficiency.

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. :param xx: xx component of the matrix. :type xx: float :param yy: yy component of the matrix. :type yy: float :param zz: zz component of the matrix. :type zz: float :param xy: xy component of the matrix. :type xy: float :param yz: yz component of the matrix. :type yz: float :param xz: xz component of the matrix. :type xz: float


The matrix, as a 3x3 numpy array.

Return type: