  We derive an analytical density functional for the single-site entanglement
of the one-dimensional homogeneous Hubbard model, by means of an approximation
to the linear entropy. We show that this very simple density functional
reproduces quantitatively the exact results. We then use this functional as
input for a local density approximation to the single-site entanglement of
inhomogeneous systems. We illustrate the power of this approach in a
harmonically confined system, which could simulate recent experiments with
ultracold atoms in optical lattices as well as in a superlattice and in an
impurity system. The impressive quantitative agreement with numerical
calculations -- which includes reproducing subtle signatures of the particle
density stages -- shows that our density-functional can provide entanglement
calculations for actual experiments via density measurements. Next we use our
functional to calculate the entanglement in disordered systems. We find that,
at contrast with the expectation that disorder destroys the entanglement, there
exist regimes for which the entanglement remains almost unaffected by the
presence of disordered impurities.
