# 2. Solvated water molecule

Let's build on the previous tutorial and add solvation.
Open the input file `in`, here instead of repeating all the commands from the previous calculation, 
the first command line:

    include ../1_H2O_vac/in

brings them all in, and we can only add what we need.
(If you need to remove a command, a strategy would be to
have a `common.in` with the shared settings, and include
them from both input files.)

So, here we only add solvation commands,
asking for solvation by water using the CANDLE LinearPCM model.
We are also including 1M non-adsorbing NaF electrolyte using the final two commands.
(Implicit models are always non-adsorbing, and using NaF reinforces this.
The simple solvation models are not specific to which electrolyte species you use.)

Finally, we ask for an additional output, the solvent bound charge.

## Run the calculation

As before, start an interactive session:

    beast-interactive

run:

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

This calculation will take around 20 s. At the end of the calculation terminate the interactive session (`Ctrl+D`).

The output will have the same structure as before,
but you will now have an initial vacuum calculation,
followed by a solvated section.
Then, every ionic step continues with the solvated ElecMinimize
(which has a fluid solver running between every iteration).

Note that the solvated calculations for molecules takes noticeably longer
because the fluid minimize in a double-sized box for coulomb truncation
becomes more expensive than the quantum-mechanical part for just 4 bands.
In larger calculations, such as for the slabs, the fluid cost is relatively smaller.
To save time, we should start from the converged geometry and electronic state
of the vacuum calculation:
see the [Website tutorials](http://jdftx.org/SolvationMolecule.html) for this;
we started the calculation independently here for simplicity.

In the energy components, you now see an additional `A_diel`,
which is the contribution due to the liquid/electrolyte interactions.
Let's compare the energy of the vacuum and solvated water molecule
to compute the solvation energy.

    listEnergy ../*_H2O_*/out

gets us the final energy of both calculations:

    -17.268308291338595 ../1_H2O_vac/out
    -17.280982853391535 ../2_H2O_sol/out

The difference of `sol - vac` of -0.01267 $E_h$ = -7.95 kcal/mol
is the solvation energy of water in water (related to its vapor pressure).
Note that `A_diel` is not the same as the solvation energy
(and is a bit more negative) because the electronic system changes in
response  to the solvation i.e. the solvation is self-consistent.

## Visualization

At the end of `out`, we get a `jdftx.nbound` in addition to `jdftx.n`.
Open the `Visualize.ipynb` in this directory to visualize this.

## Further exercises

Compare the solvation energies and bound charges obtained from various solvation models:

+ Change the `pcm-variant` to `GLSSA13`. This is the default LinearPCM, and is identical to VASPsol.
+ With `pcm-variant` at `GLSSA13`, switch to `fluid NonlinearPCM`.
+ Try `pcm-variant SCCS`, which is equivalent to the model in QE.
+ Switch to `fluid SaLSA` (and remove pcm-variant) to try the linear nonlocal sovation model.

How much do the solvation energies vary between the models for this neutral molecule?
Which is the most accurate compared to experiment (look up the experimental solvation energies)?
