An effective potential for calculating free energies. I. General concepts and approximations