The thermodynamics of the insertion electrochemistry of solid metal hexacyanometallates