# 3. Solvated Pt surface with applied bias (0V SHE)

To apply a bias and use grand-canonical DFT (GC-DFT),
our input file `in` has only one command beyond the previous one:

    target-mu -0.1713

The chemical potential specified here is on an absolute scale.
We start with 0 V SHE, and use the -4.66 eV absolute SHE calibration
for CANDLE mentioned previously to get mu = -(V + 4.66) / 27.2114.
(Here, mu is in $E_h$ while V is in Volts, leading to the 27.2114 conversion factor;
an overall sign is also present due to the negative charge on the electron.)
Consequently, for V = 0 V SHE, we get mu = -0.1713 $E_h$.

## Run the calculation

Within an interactive session (run `beast-interactive` if not already in one), run:

    srun -n 4 --gpus 4 jdftx_gpu -i in | tee out

The structure of the output should now be very similar to the solvated runs
from the first session: a vacuum calculation to initialize, followed by  
solvated calculations at each ionic step.

## Analysis

However, notice one very important difference in `out`
the energy outputs everywhere are now called G, which is the grand free energy,
instead of F (Helmholtz free energy) or Etot (energy) previously.
In the `FillingsUpdate` lines, mu now remains fixed at the specified value,
while nElectrons varies to keep mu fixed (grand-canonical ensemble).

At the end of the calculation, the number of electrons is 48.20,
which means the slab has a net charge of -0.2 e (per unit cell).

We cannot directly compare the grand canonical energies here
with the canonical ones at a different potential from the previous calculation.
Instead, we will look at the difference of two grand canonical free energies
at the same potential for H adsorption in the next exercise.

## Visualization

Open Visualize.ipynb using the file browser to examine how the solvent bound charge changed due to bias.

## Further exercises

+ Repeat the calculations for several potentials spanning about a volt around the neutral potential (PZC). Using the number of electrons from each, plot the charge vs (V - PZC).
+ Use finite difference derivatives to compute differential capacitance and plot that vs potential.
+ Compare these results with other solvation models.

