To determine the equilibrium water and ion distributions via cDFT, the total Helmholtz free energy functional is minimized with respect to the densities of all the species in the presence of rigid nanoparticles or mineral surfaces. For this optimization, it is convenient to partition the total free energy of the system into so-called ideal (F id ) and excess components (F ex ). The ideal free energy corresponds to the non-interacting system and is determined by the configurational entropy contributions from water and small ions,