Surface structure and energy spectra of localized states