Thermodynamic insights into the free energy of the processes in lithium iron phosphate batteries