Application of the density functional formalism to the canonical ensemble is of practical interest in cases where there is a marked difference between, say, the canonical and the grand canonical ensemble (cavities or pores). An important role is played by the necessary modification of the famous Ornstein-Zernike relation between pair correlation and direct correlation function, as the former is...