Lattice dynamics of perfect and imperfect crystals of NaCl structure