  We describe how density-functional theory, well-known for its many uses in ab
initio calculations of electronic structure, can be used to study the ground
state of inhomogeneous model Hamiltonians. The basic ideas and concepts are
discussed for the particular case of the Heisenberg model. As representative
applications, illustrating scope and limitations of the procedure, we calculate
the ground-state energy of one-, two- and three-dimensional antiferromagnetic
Heisenberg models in the presence of boundaries and of impurities in the bulk
and at the surfaces. Correlations are shown to lift degeneracies present in the
mean-field approximation. Comparison with exact (brute force) diagonalization
shows that the density-functional results are a significant improvement over
the mean-field ones, at negligible extra computational cost.
