# Code

These are several things that are in out TODO list (or wish list) for octopus 3.0

• Include PAW
• Make octopus Dirac relativistic

## Contents

### Curvilinear

• Fix the multigrid solver to work with curvilinear coordinates
• Fix Modine curvilinear coordinates. This involves adding the restrictions on the Jacobian close to the atoms, and then debug. Preconditioning the poisson cg solver would also help a lot.

### Periodic systems

• Separate the external potential in two parts, one short ranged and the other long ranged. The long ranged is defined by a (gaussian) charge (for example the nuclear valence charge), and the corersponding potential is obtained by solving Poisson's equation (This is done). This will put the burden of handling the periodic boundaries in the Poisson solver (that already knows about them). The local part can now be handled solely in real-space (this is still missing, but shouldn't be too complicated), just like the non-local part of the pseudopotential. This would allow to get rid of a lot of complicated code.
• Now we are calculating the laplacian for periodic systems by doing which implies the calculation of the gradients of psi. This can be avoided (thereby making the code much faster) by using the following trick. Instead of throwing away the boundary points in the periodic directions, we should keep them. Then, before calculating Hpsi, these boundaries are updated. Then the wf is multiplied by the phase , one applies Hpsi, just like for the finite system, and then we multiply the wf by . This also simplifies the calculation of the non-local part of the pseudopotential. For this to work in parallel, we will have to scatter points in order to build the boundary points.
• We should allow the use of non simple-cubic unit cells. Besides the changes in the generation of the k-points (we can get the code from ABINIT or PWSCF), this would require using a non-orthogonal mesh, with the points along the unit-cell directions. The weights of the derivatives will be constant, but we will not be able to use the star stencil, of course.
• To calculate a LDA spectrum, one needs to apply the vector potential in the velocity gauge. This purely time-dependent vector potential will then obey a diferential equation in time that should be solved together with the time-dependent Kohn-Sham equations.

### Parallel stuff

• Parallelize octopus using openMP. This involves identifying in the code the routines that really take a significant amount of time and fill them with openMP directives.
• Parallelize the k-points. This is quite easy, and one only needs to replace 1..nik to ik_start..ik_end, and a couple of reduces (roughly in the same place as the reduces for the states)

### Varia

• There are several conjugated gradients routines lying around in the code, namely for the SCF cycle, for the poisson solver, and for the linear response. At maximum, we need *2* of standard cg routines, one for the solution of the eigenvalue equation, and the other to solve linear systems (several of this latter kind may exists, e.g., for non-Hermitian operators). Furthermore, not all cg solvers are preconditioned. We should clean up this mess!

## Done

• (By Florian) Parallelize the use of FFTs, at least for the solution of the Poisson equation. This is very important when running, e.g. EXX, where 90% of the time is spend solving Coulomb integrals through the Poisson equation. This involves changing the cube_function stuff. Maybe it would be good to also interface to Goedecker's FFTs (they are distributed with ABINIT). They exist in both serial and parallel versions. The ISF solver, now integrated in Octopus, can be used in parallel and uses Goedecker's FFT, we could use that.
• Decrease the latency when running parallel in domains. This can be done by using asynchronous MPI calls. For example, in Hpsi, do "call laplacian_prepare (send the ghost points); do other stuff; call laplacian_calculate. A two step call completely solves the problem of latency.