A functional method for condensed systems