Theory of non-radiative transitions in molecules and solids