Add thermodynamic potentials

Not ready to be merged. Opening for comments/suggestions.
This function is called many times and always reopens/parses the data file. This is not good.