Added support for potentials on the log-likelihood.