Localized modes associated with defects in ionic crystals