  We use Lanczos exact diagonalization to compute the exact
exchange-correlation (xc) potential of a Hubbard chain with large binding
energy ("the bulk") followed by a chain with zero binding energy ("the
vacuum"). Several results of density functional theory in the continuum
(sometimes controversial) are verified in the lattice. In particular we show
explicitly that the fundamental gap is given by the gap in the Kohn-Sham
spectrum plus a contribution due to the jump of the xc-potential when a
particle is added. The presence of a staggered potential and a nearest-neighbor
interaction V allows to simulate a ionic solid. We show that in the ionic
regime in the small hopping amplitude limit the xc-contribution to the gap
equals V, while in the Mott regime it is determined by the Hubbard U
interaction. In addition we show that correlations generates a new potential
barrier at the surface.
