< prev. lesson Next lesson >

## Content of this lesson

- Defining a surface configuration
- Plot the potential values
- Add an electric field

## Material

- H2O-slab/input.dft
- H2O-slab/posinp.xyz
- H2O-slab/psppar.O
- H2O-slab/psppar.H

This lesson has been created for current stable version. Earlier versions are fully capable of running this tutorial but input files may have to be changed according to possible earlier formats.

# Basics of BigDFT: surface calculations with an ideal monolayer of water molecules

The purpose of this lesson is to introduce the surface calculation, the output of different scalar field like the local potential and to add an electric field.

## Defining a surface configuration

The boundary conditions are specified in the position file. No other parameters are necessary to be changed. To do it, modify the second line of the XYZ `posinp.xyz` file to write the keyword `surface` like in this example:

    3 angstroem
    surface 3.5 1.0 3.0
    O  1.5     0.0      1.5
    H  0.7285  0.620919 1.5
    H  2.2715  0.620919 1.5

Three floats are required after the `surface` keyword to define the bounding box in x, y and z direction. In BigDFT, the direction perpendicular to the surface must be the y direction. The box size in that one is then irrelevant (ignored by the code).

The example above describes a mono layer of water molecules. This un-realistic example is used to easily illustrate the capability of BigDFT to exactly compute the local potential, even in the case of an internal dipolar moment.

Exercise: run BigDFT for the given atomic configuration.

You can get here the other usal files for BigDFT: the input file `input.dft` and the pseudo-potentials `psppar.O` and `psppar.H`.

The convergence is still good and calculation terminates within 13 iterations. One can notice also the y free direction in the screen output when looking at the Poisson solver output, giving a box dimensions of 40x163x36 in grid spacings. One should also notice that the hgrid values are lower than the one specified in the input file for the x and z directions (i.e.the periodic ones) since the number of grid points in the periodic directions should be compatible with the FFT treatments (which in BigDFT is based on Goedecker's FFT).

     Shift of=  0.00000E+00  1.03766E+01  0.00000E+00 H grids=  0.3307  0.3500  0.3150
    Box Sizes=  6.61404E+00  2.31000E+01  5.66918E+00           19        66        17

## Plot the potential values

It is possible to output scalar fields like the different potentials (Hartree, ionic and local) after the last electronic convergence. To do this, set the third number of the eleventh line of `input.dft` to 2:

    0 0    2  InputPsiId, output_wf, output_grid

Exercise: rerun the previous calculation to give a look to the local potential. A file `local_potential_avg_y` will be generated in the `data` directory and contains the projection along the y axis of the local potential (i.e.Hartree plus ionic).

One can see the existence of a dipolar moment due to the displacement between the center of mass of negative charges and positive charges. The plot shows the quality of the Poisson solver calculation introducing no artifact or necessary accordance at boundaries.

## Add an electric field

Thanks to the Green function treatment in the Poisson solver, we've seen that's it's possible to exactly treat the dipolar moment in a box, add a charge (cf. previous tutorial) but it is also possible to add an electric field. To do this, set the second value of the fourth line of `input.dft`:

    0 0.0 0.010 0.0 charge of the system, Electric field

The unit for the electric field is hartree per bohr and the direction of the field is always the y direction (even for non surface calculations).

Exercise: rerun the previous calculation with an electric field of 0.01Ht/bohr.

The local potential is bent by the field as expected.