Localized states at GaN surfaces, Schottky barriers, and quantum well interfaces