The effect of localized modes on radiationless electronic transitions. I. Diatomic impurities in a crystal