Compound formation in metal—semiconductor interactions