Fix both grackle cooling and statistics
Some recent changes are breaking grackle. I have moved the function into the header file to fix it.
The main reason of this merge request is the statistics are broken for the potential. 3 variables are carrying the potential (self, external and sum). Only the two first are used during the computation but we write only the third. Therefore the potential is always 0 in the statistics. In my fix, I removed the sum from the structure and simply compute the sum just before writing to the file.
Edited by Loic Hausammann