Electrochemistry from first-principles in the grand canonical ensemble.