Moreau-Yosida regularization in DFT