  We develop a variational calculus for a certain free energy functional on the
space of all probability measures on a Kahler manifold X. This functional can
be seen as a generalization of Mabuchi's K-energy functional and its twisted
versions to more singular situations. Applications to Monge-Amp\`ere equations
of mean field type, twisted Kahler-Einstein metrics and Moser-Trudinger type
inequalities on Kahler manifolds are given. Tian's \alpha- invariant is
generalized to singular measures, allowing i particular the construction of
Kahler-Einstein metrics with positive Ricci curvature that are singular along a
given anti-canonical divisor (as proposed in a very recent program of
Donaldson). As another application we show that if the Calabi flow in the
(anti-) canonical class exits for all times then it converges to a
Kahler-Einstein metric, when one exists. Applications to the
probabilistic/statistical mechanical approach to the construction of
Kahler-Einstein metrics, very recently introduced by the author, will appear
elsewhere.
