The first-principles calculation for the band gap and refractive index of a semiconductor has been well established. If you search "Refractive index band structure optical first-principles" by Google, you will find many references. The problem is that the band gap of semiconductor or insulator is usually underestimated in the LDA or GGA calculation.
The formula for computing optical properties can be found in the following reference:
1). C. Ambrosch-Draxl and J.O. Sofo. Linear optical properties of solids within the full-potential
linearized augmented planewave method, arXiv:cond-mat/0402523 v1,
http://arxiv.org/abs/cond-mat/0402523 Computer Physics Communications
Volume 175, Issue 1, 1 July 2006, Pages 1-14,
http://dx.doi.org/10.1016/j.cpc.2006.03.0052). Hiroyuki Kageshima and Kenji Shiraishi, Momentum-matrix-element calculation using pseudopotentials, Phys. Rev. B 56, 14985 - 14992 (1997),
http://prola.aps.org/abstract/PRB/v56/i23/p14985_13). B. Adolph, J. Furthmüller, and F. Bechstedt, Optical properties of semiconductors using projector-augmented waves, Phys. Rev. B 63, 125108 (2001),
http://prola.aps.org/abstract/PRB/v63/i12/e125108