The metal-insulator transition in doped semiconductors : an ab initio approach