Add thermodynamic potentials

Not ready to be merged. Opening for comments/suggestions.
were you working based on an older version? I think I removed these useless comments in an earlier commit.