Add thermodynamic potentials

Not ready to be merged. Opening for comments/suggestions.
"Somehow" is the operative word! I have no idea why your 27th July update wasn't included when we branched on the 29th.

<shrug>