Ab-initio calculations of luminescence and optical gain properties in silicon nanostructures