Developers Manual:Double Grid

From OctopusWiki
Revision as of 20:01, 21 April 2021 by Xavier (talk | contribs) (→‎Method 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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]

Co dg conv energy.png

Convergence of the forces with the spacing

Co dg conv forces.png

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.

Co dg eggbox energy.png

Eggbox effect in force

Co dg eggbox force.png

Co dg eggbox force dp.png

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. Co dg dist energy.png

Force v/s interatomic distance

Co dg dist force.png

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.

Method 2

Fine grid , 1D.



Coefficients 2: