#!/usr/bin/env amspython import numpy as np from scm.plams import Units def get_values(): E_eV = np.array([1.7576, 1.7581, 1.7587]) D = np.array([4.6005, 26.599, 196.61]) R = np.array([-0.34615e-1, -0.35678e-1, 0.10183]) tau = np.array([0.2433e-2, 0.4205e-3, 0.5683e-4]) refractive_index = 1 return E_eV, R, D, tau, refractive_index def main(): E_eV, R, D, tau, refractive_index = get_values() use_boltzmann_weights = False if use_boltzmann_weights: weights = calc_boltzmann_weights(E_eV, T=298) else: weights = np.ones(np.shape(E_eV)) g = 4 * np.dot(R, weights) / np.dot(D, weights) print(f"g_lum_av: {g:.3e}") tau_av = 1.0 / refractive_index**2 * np.sum(weights) / np.dot(1.0 / tau, weights) print(f"tau_av: {tau_av:.3e} s") def calc_boltzmann_weights(E_eV, T=298): k_B = Units.constants["k_B"] * Units.convert(1, "J", "eV") # eV/K boltzmann_weights = np.exp(-(E_eV - np.min(E_eV)) / (k_B * T)) return boltzmann_weights if __name__ == "__main__": main()