\section{Development of exchange and correlation functionals}
%Micael, Miguel, Xavier

The central quantity of the KS scheme of DFT is the xc energy $E_{\rm xc}[n]$, which describes all
non-trivial many-body effects.  Clearly, the exact form of this
quantity is unknown and it must be approximated in any practical
application of DFT. We emphasize that the accuracy of any DFT
calculation depends solely on the form of this quantity, as this is
the only real approximation in DFT (neglecting numerical
approximations that are normally controllable).

During the past 50 years, hundreds of different forms
have appeared~\cite{Scuseria2005}. They are usually arranged in
families, which have names such as generalized-gradient approximations
(GGAs), meta-GGAs, hybrid functionals, etc. In 2001, John Perdew came
up with a beautiful idea on how to illustrate these families and their
relationship~\cite{perdew:1}. He ordered the families as rungs in a
ladder that leads to the heaven of ``chemical accuracy'', which he
christened the ``Jacob's ladder'' of density-functional approximations for
the xc energy.  Every rung adds a dependency on another quantity,
thereby increasing the precision of the functional but also increasing
the numerical complexity and the computational cost.

The first three rungs of this ladder are : (i)~the
local-density approximation (LDA), where the functional has a local
dependence on the density only; (ii)~the
generalized-gradient approximation (GGA), which includes also a local
dependence on the gradient of the density \(\nabla n(\vec r)\); and
(iii)~the meta-GGA, which adds a local dependence on the Laplacian of
the density and on the kinetic-energy density. In the fourth rung we have functionals that depend on
the occupied KS orbitals, such as exact exchange or hybrid
functionals. Finally, the fifth rung adds a dependence on the virtual
KS orbitals.

Support for the first three rungs and for the local part of the hybrid
functionals in Octopus is provided through the Libxc
library~\cite{Marques_2012}. Libxc started as a spin-off project during
the initial development of Octopus. At that point, it became clear that
the task of evaluating the xc functional was completely independent
of the main structure of the code, and could therefore be transformed into
a stand-alone library. Over the years, Libxc became more and more independent of
Octopus, and is now used in a variety of DFT codes. There are
currently more than 150 xc functionals implemented in Libxc
that are available in Octopus, a number that has been increasing steadily
over the years. All of the standard functionals are included and many
of the less common ones. There is also support for LDAs and GGAs of
systems of reduced dimensionality (1D and 2D), which allow for direct
comparisons with the direct solution of the many-body Schr\"odinger
equation for model systems described in section~\ref{sec:mbse}.

Octopus also includes support for other functionals of the fourth
rung, such as exact exchange or the self-interaction correction of
Perdew and Zunger~\cite{Zunger_1980}, through the solution of the optimized effective potential equation. This can be done exactly~\cite{K_mmel_2003}, or within the Slater~\cite{Slater_1951} or Krieger-Li-Iafrate approximations~\cite{Krieger_1990}.

Besides the functionals that are supported by Octopus, the code has
served as a platform for the testing and development of new
functionals. For example, the method described in section
\ref{sec:mbse} can be used in a straightforward way to obtain reference
data against which to benchmark the performance of a given xc
functional, for example a one-dimensional LDA~\cite{1DLDA}. In that case, both calculations, exact and approximate,
make use of the same real-space grid approach, which makes the
comparison of the results obtained with both straightforward. Despite
the obvious advantage of using exact solutions of the many-body
problem as reference data, this is often not possible and one usually
needs to resort to the more commonly used experimental or
highly-accurate quantum-chemistry data. In this case, the flexibility
of the real-space method, allowing for the calculation of many
different properties of a wide variety of systems, is again an
advantage. Octopus has therefore been used to benchmark
the performance of xc functionals whose potential has a correct
asymptotic behavior~\cite{Oliveira_2010} when calculating ionization
potentials and static polarizabilities of atoms, molecules, and
hydrogen chains. 

In this vein, Andrade and Aspuru-Guzik~\cite{Andrade_2011} proposed a method to obtain an asymptotically correct xc potential starting from any approximation. Their method is based on considering the xc potential as an electrostatic potential generated by a fictitious xc charge. In terms of this charge, the asymptotic condition is given as a simple formula that is local in real space and can be enforced by a simple procedure. The method, implemented in Octopus, was used to perform test calculations in molecules. Additionally, with this correction procedure it is possible to find accurate predictions for the derivative discontinuity and, hence, predict the fundamental gap~\cite{Mosquera_2014}.