Ab-initio calculation of the optical properties of surfaces