Infrared and electronic spectral study of metal–ammonia complexes