C routine that calculates intermolecular interaction energies of confined water from a Gromacs MD simulation.