A self-consistent surface-Green-function (SSGF) method