Add code fragments from thermopy to help with gibbs minimization