the function to construct the gibbs energy is almost at the end.
the further step is to rewrite it in the form of a function and verify the result of the functions.