# Developers Manual:Double Grid

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Results

Test system: CO molecule

Default spacing: 0.35 [b]

### Convergence of the energy with the spacing

Converged spacing (0.1 [eV]) double grid: 0.35 [b]

Converged spacing (0.1 [eV]) single grid: 0.32 [b]

### Eggbox effect in energy

To get the eggbox effect the molecule is displaced and the energy and forces are calculated for each displacement. The energy and forces shown in the graphs are the energy for each displacement minus the average over all the displacements, so they oscilate around zero.

### Energy v/s interatomic distance

This is the calculation of energy in function of the interatomic distance for the CO molecule. The zero of energy is at the minimum.

## Method 1 (by Miguel)

It works on the following way. Imagine that you have two functions defined in two different grids, and that you want to calculate the integral of their product:

where is known in the fine grid, and in the coarse grid. in this case is the pseudopotential (including the angular momentum functions for the non-local part). To obtain the values of in all points of the fine grid , we can interpolate from the known points in the coarse grid :

The simplest thing is to take, e. g., a bilinear interpolation. Inserting this into

and changing the order of the sums:

where is the volume element of the fine grid, and the volume element of the coarse grid. We now define a , so that

This is the maths. In practice you have to do (cartesian grid for simplicity):

• Choose a 3D interpolation routine. Let's assume that it is bilinear interpolation.
• To calculate , generate a fine grid around . Odd numbers are easier, so let's imagine that you triple the box (reduce the mesh spacing by a factor of 3). For example, in 2D:
O X  X O X  X O
X X  X X X  X X
+-----+
X X |7 4 1| X X
O X |8 5 2| X O
X X |9 6 3| X X
+-----+
X X  X X X  X X
O X  X O X  X O


The points O are the points in the coarse grid (the standard grid of Octopus), and X are the finer grid. We will only be interested in the points inside the square (the neighbours)

If the grid is uniform, the positions of the points in the fine grid relative to are constant, and can be calculated once and for all. In this case, e. g.

Interpolate to get the values in each one of this points. For example, defining:

i.e., these are the values of in the coarse grid in the neighboring points of . For the interpolation we get

(this is much harder in 3D).

Now I collect all coefficients for p. The loop would look like

I remember I managed to get general formulas for an order n interpolation. Probably it is best to stay with odd numbers, as for an even increase of the grid points (for example grid doubling), there will be some points in the fine grid that will be shared.

Fine grid , 1D.

Interpolation:

Coefficients:

Coefficients 2: