# 4. Solvated Pt surface with adsorbed *H and 0 V SHE bias

To add an adsorbed H with solvation and bias the same as the previous exercise,
our input file `in` has only one command after including the previous input file:

    ion H -0.333333 0.333333  0.669   1

which makes the overall initial ionic positions for the slab to be:

    ion Pt  -0.333333  0.333333  0.379 1
    ion Pt   0.000000  0.000000  0.500 1
    ion Pt   0.333333 -0.333333  0.621 1
    ion H   -0.333333  0.333333  0.669 1

This corresponds to the H in the FCC hollow sites of the Pt surface.

If we had the first two fractional coordinates to be zero for the H,
that would be the HCP hollow, while if they had matched the third Pt line,
it would have been an atop site.
As a subsequent exercise, repeat this calculation for those two sites.

## 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 be identical to the previous calculation,
just with one additional atom.


## Analysis

In the `FillingsUpdate` lines, the mu stays at the target value for O V SHE,
and the number of electrons now equilibrates to 49.15.
The difference in electrons to the previous calculation is therefore 0.95,
which is close to, but not exactly 1.
Consequently, this is close to a 1 proton and 1 electron transfer step,
i.e. a proton-coupled electron transfer (PCET) step commonly assumed
for analyses of the hydrogen evolution reaction (HER) on Pt.
However, the deviations of charge from the ideal case captured
automatically by GC-DFT accounts for the potential dependence 
of the interfacial energetics beyond the ideal PCET case.

We can now analyze the adsorption energetics of H on Pt under applied bias.
Using `listEnergy ../*_0V/out`, we get:

    -258.678276113181312 ../3_Pt_surf_0V/out
    -259.104263180880764 ../4_Pt_H_0V/out

We will compute the grand free energy of adsorption:

    Gads = G(Pt+H) - G(Pt) - G(H+)
    
where we have the first two energies on the RHS from the last two calculations.
Note that we didn't need to balance the number of electrons in this equation
because we are in the electron grand canonical ensemble.
This allows us to use a proton reference here, and we could have
equally well picked a gas-phase H2 reference if we wanted to.
(Note that H+ and H2 are in equilibrium at the SHE potential, so have the same free energy.)

Now, by definition

    G(H+) = E(H+) - mu N(H+) = E(H+)

because the proton has N(H+) = 0 electrons.
Additionally, we have already computed 
    
    E(H+) = E(H3O+) - E(H2O) = -0.4245 Eh

in the first session (this was also the proton solvation energy,
by definition, as the proton has zero internal electronic energy).

Putting these together, we have 

    Gads = -259.10426 - (-258.67828) - (-0.42452)
         = -0.00146 Eh
         = -0.0397 eV
         = -0.916 kcal/mol

H adsorption on Pt hollow sites during HER is known to be nearly thermoneutral.
This is in close agreement with our nearly thermoneutral / slightly exothermic Gads.


## Visualization

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

The same methodology can now be used to study other adsorbate-surface combinations.
Session 3 will discuss running similar JDFTx calculations with more automation using Python/ASE.


## Further exercises

+ How does the H adsorption energy change with potential?
+ And for 1/4 coverage instead of 100% coverage considered above?
+ What about the other possible adsorption sites (atop, bridge, hcp hollow)?
