\documentclass[aip,jcp,reprint,noshowkeys,superscriptaddress]{revtex4-1}
\usepackage{graphicx,dcolumn,bm,xcolor,microtype,multirow,amsmath,amssymb,amsfonts,physics,mhchem}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{txfonts}

\usepackage[
	colorlinks=true,
    citecolor=blue,
    breaklinks=true
	]{hyperref}
\urlstyle{same}

\newcommand{\alert}[1]{\textcolor{red}{#1}}
\usepackage[normalem]{ulem}
\newcommand{\titou}[1]{\textcolor{red}{#1}}
\newcommand{\manu}[1]{\textcolor{blue}{#1}}
\newcommand{\trashPFL}[1]{\textcolor{red}{\sout{#1}}}
\newcommand{\trashEF}[1]{\textcolor{blue}{\sout{#1}}}

%useful stuff
\newcommand{\cdash}{\multicolumn{1}{c}{---}}
\newcommand{\mc}{\multicolumn}
\newcommand{\mr}{\multirow}
\newcommand{\fnm}{\footnotemark}
\newcommand{\fnt}{\footnotetext}
\newcommand{\tabc}[1]{\multicolumn{1}{c}{#1}}
\newcommand{\la}{\lambda}
\newcommand{\si}{\sigma}

% numbers
\newcommand{\nEl}{N}

% operators
\newcommand{\hH}{\Hat{H}}
\newcommand{\hh}{\Hat{h}}
\newcommand{\hT}{\Hat{T}}
\newcommand{\vne}{v_\text{ne}}
\newcommand{\hWee}{\Hat{W}_\text{ee}}
\newcommand{\WHF}{W_\text{HF}}

% functionals, potentials, densities, etc
\newcommand{\eps}{\epsilon}
\newcommand{\e}[2]{\eps_\text{#1}^{#2}}
\newcommand{\E}[2]{E_\text{#1}^{#2}}
\newcommand{\bE}[2]{\overline{E}_\text{#1}^{#2}}
\newcommand{\be}[2]{\overline{\eps}_\text{#1}^{#2}}
\newcommand{\bv}[2]{\overline{f}_\text{#1}^{#2}}
\newcommand{\n}[2]{n_{#1}^{#2}}
\newcommand{\DD}[2]{\Delta_\text{#1}^{#2}}
\newcommand{\LZ}[2]{\Xi_\text{#1}^{#2}}

% energies
\newcommand{\EHF}{E_\text{HF}}
\newcommand{\Ec}{E_\text{c}}
\newcommand{\Ecat}{E_\text{cat}}
\newcommand{\Eneu}{E_\text{neu}}
\newcommand{\Eani}{E_\text{ani}}
\newcommand{\EPT}{E_\text{PT2}}
\newcommand{\EFCI}{E_\text{FCI}}

% matrices/operator
\newcommand{\br}[1]{\bm{r}_{#1}}
\newcommand{\bw}{{\bm{w}}}
\newcommand{\bG}{\bm{G}}
\newcommand{\bS}{\bm{S}}
\newcommand{\bGam}[1]{\bm{\Gamma}^{#1}}
\newcommand{\bgam}[1]{\bm{\gamma}^{#1}}
\newcommand{\opGam}[1]{\hat{\Gamma}^{#1}}
\newcommand{\bh}{\bm{h}}
\newcommand{\bF}[1]{\bm{F}^{#1}}
\newcommand{\Ex}[1]{\Omega^{#1}}


% elements
\newcommand{\ew}[1]{w_{#1}}
\newcommand{\eG}[1]{G_{#1}}
\newcommand{\eS}[1]{S_{#1}}
\newcommand{\eGam}[2]{\Gamma_{#1}^{#2}}
\newcommand{\hGam}[2]{\Hat{\Gamma}_{#1}^{#2}}
\newcommand{\eh}[2]{h_{#1}^{#2}}
\newcommand{\eF}[2]{F_{#1}^{#2}}
\newcommand{\ERI}[2]{(#1|#2)}
\newcommand{\dbERI}[2]{(#1||#2)}

% Numbers
\newcommand{\Nel}{N}
\newcommand{\Nbas}{K}

% AO and MO basis
\newcommand{\Det}[1]{\Phi^{#1}}
\newcommand{\MO}[2]{\phi_{#1}^{#2}}
\newcommand{\SO}[2]{\varphi_{#1}^{#2}}
\newcommand{\cMO}[2]{c_{#1}^{#2}}
\newcommand{\AO}[1]{\chi_{#1}}

% units
\newcommand{\IneV}[1]{#1~eV}
\newcommand{\InAU}[1]{#1~a.u.}
\newcommand{\InAA}[1]{#1~\AA}

\newcommand{\SI}{\textcolor{blue}{supplementary material}}

\newcommand{\LCPQ}{Laboratoire de Chimie et Physique Quantiques (UMR 5626), Universit\'e de Toulouse, CNRS, UPS, France}
\newcommand{\LCQ}{Laboratoire de Chimie Quantique, Institut de Chimie, CNRS, Universit\'e de Strasbourg, Strasbourg, France}

%%% added by Manu %%%
\newcommand{\beq}{\begin{equation}}
\newcommand{\eeq}{\end{equation}}
\newcommand{\bmk}{\bm{\kappa}} % orbital rotation vector
\newcommand{\bmg}{\bm{\Gamma}} % orbital rotation vector
\newcommand{\bxi}{\bm{\xi}} 
\newcommand{\bfx}{{\bf{x}}}
\newcommand{\bfr}{{\bf{r}}}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
%%%% 

\begin{document}	

\title{Weight-dependent local density-functional approximations for ensembles}

\author{Pierre-Fran\c{c}ois Loos}
\email{loos@irsamc.ups-tlse.fr}
\affiliation{\LCPQ}
\author{Emmanuel Fromager}
\email{fromagere@unistra.fr}
\affiliation{\LCQ}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
We report a first generation of local, weight-dependent correlation density-functional approximations (DFAs) that incorporate information about both ground and excited states in the context of density-functional theory for ensembles (eDFT). 
These density-functional approximations for ensembles (eDFAs) are specially designed for the computation of single and double excitations within eDFT, and can be seen as a natural extension of the ubiquitous local-density approximation for ensemble (eLDA).
The resulting eDFAs, based on both finite and infinite uniform electron gas models, automatically incorporate the infamous derivative discontinuity contributions to the excitation energies through their explicit ensemble weight dependence. 
Their accuracy is illustrated by computing single and double excitations in one-dimensional many-electron systems in the weak, intermediate and strong correlation regimes.
\end{abstract}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec:intro}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Over the last two decades, density-functional theory (DFT) \cite{Hohenberg_1964, Kohn_1965} has become the method of choice for modeling the electronic structure of large molecular systems and materials. \cite{ParrBook}
The main reason is that, within DFT, the quantum contributions to the electronic repulsion energy --- the so-called exchange-correlation (xc) energy --- is rewritten as a functional of the electron density $\n{}{}(\br)$, the latter being a much simpler quantity than the many-electron wave function. 
The complexity of the many-body problem is then transferred to the xc functional. 
Despite its success, the standard Kohn-Sham (KS) formulation of DFT \cite{Kohn_1965} (KS-DFT) suffers, in practice, from various deficiencies. \cite{Woodcock_2002, Tozer_2003, Tozer_1999, Dreuw_2003, Sobolewski_2003, Dreuw_2004, Tozer_1998, Tozer_2000, Casida_1998, Casida_2000, Tapavicza_2008, Levine_2006}
The description of strongly multiconfigurational ground states (often referred to as ``strong correlation problem'') still remains a challenge. 
Another issue, which is partly connected to the previous one, is the description of electronically-excited states. 

The standard approach for modeling excited states in DFT is linear response time-dependent DFT (TDDFT). \cite{Casida}
In this case, the electronic spectrum relies on the (unperturbed) ground-state KS picture, which may break down when electron correlation is strong. 
Moreover, in exact TDDFT, the xc functional is time dependent. 
The simplest and most widespread approximation in state-of-the-art electronic structure programs where TDDFT is implemented consists in neglecting memory effects. \cite{Casida}
In other words, within this so-called adiabatic approximation, the xc functional is assumed to be local in time. 
As a result, double electronic excitations are completely absent from the TDDFT spectrum, thus reducing further the applicability of TDDFT. \cite{Maitra_2004,Cave_2004,Mazur_2009,Mazur_2011,Huix-Rotllant_2011,Elliott_2011,Maitra_2012,Sundstrom_2014}

When affordable (i.e., for relatively small molecules), time-independent state-averaged wave function methods \cite{Roos,Andersson_1990,Angeli_2001a,Angeli_2001b,Angeli_2002} can be employed to fix the various issues mentioned above. 
The basic idea is to describe a finite ensemble of states (ground and excited) altogether, i.e., with the same set of orbitals. 
Interestingly, a similar approach exists in DFT. 
Ensemble DFT (eDFT) was proposed at the end of the 80's by Gross, Oliveira and Kohn (GOK), \cite{Gross_1988a, Oliveira_1988, Gross_1988b} and is a generalization of Theophilou's variational principle for equi-ensembles. \cite{Theophilou_1979}
In eDFT, the (time-independent) xc functional depends explicitly on the weights assigned to the states that belong to the ensemble of interest. 
This weight dependence of the xc functional plays a crucial role in the calculation of excitation energies. 
It actually accounts for the infamous derivative discontinuity contribution to energy gaps. \cite{Levy_1995, Perdew_1983}
%\titou{Shall we further discuss the derivative discontinuity? Why is it important and where is it coming from?}
Despite its formal beauty and the fact that eDFT can in principle tackle near-degenerate situations and multiple excitations, it has not been given much attention until recently. \cite{Franck_2014,Borgoo_2015,Kazaryan_2008,Gould_2013,Gould_2014,Filatov_2015,Filatov_2015b,Filatov_2015c,Gould_2017,Deur_2017,Gould_2018,Gould_2019,Sagredo_2018,Ayers_2018,Deur_2018a,Deur_2018b,Kraisler_2013, Kraisler_2014,Alam_2016,Alam_2017,Nagy_1998,Nagy_2001,Nagy_2005,Pastorczak_2013,Pastorczak_2014,Pribram-Jones_2014,Yang_2013a,Yang_2014,Yang_2017,Senjean_2015,Senjean_2016,Senjean_2018,Smith_2016}
The main reason is simply the absence of density-functional approximations (DFAs) for ensembles in the literature. 
Recent works on this topic are still fundamental and exploratory, as they rely either on simple (but nontrivial) models like the Hubbard dimer \cite{Carrascal_2015,Deur_2017,Deur_2018a,Deur_2018b,Senjean_2015,Senjean_2016,Senjean_2018,Sagredo_2018} or on atoms for which highly accurate or exact-exchange-only calculations have been performed. \cite{Yang_2014,Yang_2017}
In both cases, the key problem, namely the design of weight-dependent DFAs for ensembles (eDFAs), remains open. 
A first step towards this goal is presented in this article with the ambition to turn, in the near future, eDFT into a practical computational method for modeling excited states in molecules and extended systems.
%\titou{Mention WIDFA?}
In the following, the present methodology is illustrated on \emph{strict} one-dimensional (1D), spin-polarized electronic systems. \cite{Loos_2012, Loos_2013a, Loos_2014a, Loos_2014b}
In other words, the Coulomb interaction used in this work describes particles which are \emph{strictly} restricted to move within a 1D sub-space of three-dimensional space.
Despite their simplicity, 1D models are scrutinized as paradigms for quasi-1D materials \cite{Schulz_1993, Fogler_2005a} such as carbon nanotubes \cite{Bockrath_1999, Ishii_2003, Deshpande_2008} or nanowires. \cite{Meyer_2009, Deshpande_2010}
%Early models of 1D atoms using this interaction have been used to study the effects of external fields upon Rydberg atoms \cite{Burnett_1993, Mayle_2007} and the dynamics of surface-state electrons in liquid helium. \cite{Nieto_2000, Patil_2001}
This description of 1D systems also has interesting connections with the exotic chemistry of ultra-high magnetic fields (such as those in white dwarf stars), where the electronic cloud is dramatically compressed perpendicular to the magnetic field. \cite{Schmelcher_1990, Lange_2012, Schmelcher_2012}
In these extreme conditions, where magnetic effects compete with Coulombic forces, entirely new bonding paradigms emerge. \cite{Schmelcher_1990, Schmelcher_1997, Tellgren_2008, Tellgren_2009, Lange_2012, Schmelcher_2012, Boblest_2014, Stopkowicz_2015}
Atomic units are used throughout.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Theory}
\label{sec:eDFT}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{GOK-DFT}\label{subsec:gokdft}

The GOK ensemble energy~\cite{Gross_1988a,Oliveira_1988,Gross_1988b} is defined as follows:
\beq
	\E{}{\bw}=\sum_{K \geq 0} \ew{K} \E{}{(K)},
\eeq
where the $K$th energy level $\E{}{(K)}$ [$K=0$ refers to the ground state] is the eigenvalue of the electronic Hamiltonian $\hH = \hh + \hWee$, where 
\beq
	\hh = \sum_{i=1}^\nEl \qty[ -\frac{1}{2} \nabla_{\br{i}}^2 + \vne(\br{i}) ]
\eeq
is the one-electron operator describing kinetic and nuclear attraction energies, and $\hat{W}_{\rm ee}$ is the electron repulsion operator. 
The (positive) ensemble weights $w_K$ decrease with increasing index $K$. They are normalized, i.e.,
\beq
	\ew{0} = 1 - \sum_{K>0} \ew{K},
\eeq
so that only the weights $\bw \equiv \qty( \ew{1}, \ew{2}, \ldots, \ew{K}, \ldots )$ assigned to the excited states can vary independently.  
For simplicity we will assume in the following that the energies are not degenerate. Note that the theory can be extended to multiplets simply by assigning the same ensemble weight to all degenerate states~\cite{}. In GOK-DFT, the ensemble energy is determined variationally as follows:
\beq\label{eq:var_ener_gokdft}
	\E{}{\bw}
 	= \min_{\opGam{\bw}}\qty{ \Tr[\opGam{\bw} \hh]
	+ \E{Hx}{\bw} \qty[\n{\opGam{\bw}}{}]
	+ \E{c}{\bw}  \qty[\n{\opGam{\bw}}{}]
	},
\eeq
where $\Tr$ denotes the trace and the trial ensemble density matrix operator reads
\beq
	\opGam{\bw}=\sum_{K \geq 0} \ew{K} \dyad*{\Det{(K)}}.
\eeq
The determinants (or configuration state functions) $\Phi^{(K)}$ are all constructed from the same set of (ensemble Kohn--Sham) orbitals that is optimized variationally and the trial ensemble density is simply the weighted sum of the individual densities: 
\beq\label{eq:KS_ens_density}
	\n{\opGam{\bw}}{}(\br{}) = \sum_{K\geq 0} \ew{K} \n{\Phi^{(K)}}{}(\br{}).
\eeq
As readily seen from Eq.~\eqref{eq:var_ener_gokdft}, both Hartree-exchange and correlation energies are described with density functionals that are \textit{weight dependent}. 
We focus here on the (exact) Hx part which is defined as follows:
\beq\label{eq:exact_ens_Hx}
	\E{Hx}{\bw}[\n{}{}]=\sum_{K \geq 0} \ew{K} \mel*{\Det{(K)}[\n{}{}]}{\hWee}{\Det{(K)}[\n{}{}]}
\eeq
where the KS wavefunctions fulfill the ensemble density constraint
\beq
	\sum_{K\geq 0} \ew{K} \n{\Det{(K)}[\n{}{}]}{}(\br{}) = \n{}{}(\br{}).
\eeq 
The (approximate) description of the correlation part is discussed in Sec.~\ref{sec:eDFA}.

In practice, one is not much interested in ensemble energies but rather in excitation energies or individual energy levels (for geometry optimizations, for example). The latter can be extracted exactly as follows~\cite{}: 
\beq\label{eq:indiv_ener_from_ens}
	\E{}{(I)} = \E{}{\bw} + \sum_{K>0} \qty(\delta_{IK} - \ew{K} ) \pdv{\E{}{\bw}}{\ew{K}},
\eeq
where, according to the {\it variational} ensemble energy expression of Eq.~\eqref{eq:var_ener_gokdft}, the derivative in $w_K$ can be evaluated from the minimizing KS wavefunctions $\Det{(K)} = \Det{(K),\bw}$ as follows:  
\beq\label{eq:deriv_Ew_wk}
\begin{split}
	\pdv{\E{}{\bw}}{\ew{K}} 
	& = \mel*{\Det{(K)}}{\hh}{\Det{(K)}}-\mel*{\Det{(0)}}{\hh}{\Det{(0)}}
	\\
	& + \Bigg\{\int d\br{}\,\fdv{\E{Hx}{\bw}[\n{}{}]}{\n{}{}(\br{})} \qty[ \n{\Det{(K)}}{}(\br{}) - \n{\Det{(0)}}{}(\br{}) ]
	+ \pdv{\E{Hx}{\bw} [\n{}{}]}{\ew{K}}
	\\
	& + \int d\br{} \fdv{\E{c}{\bw}[n]}{\n{}{}(\br{})} \qty[ \n{\Det{(K)}}{}(\br{}) - \n{\Det{(0)}}{}(\br{}) ]
	+ \pdv{\E{c}{\bw}[n]}{\ew{K}}
	\Bigg\}_{\n{}{} = \n{\opGam{\bw}}{}}.
\end{split}
\eeq
The Hx contribution to Eq.~\eqref{eq:deriv_Ew_wk} can be rewritten as follows: 
\beq\label{eq:_deriv_wk_Hx}
	\left.
	\pdv{}{\xi_K} \qty(\E{Hx}{\bxi} [\n{}{\bxi,\bxi}]
	- \E{Hx}{\bw}[\n{}{\bw,\bxi}] )
	\right|_{\bxi=\bw},
\eeq
where $\bxi \equiv (\xi_1,\xi_2,\ldots,\xi_K,\ldots)$ and
\beq
	\n{}{\bw,\bxi}(\br{}) = \sum_{K\geq 0} \ew{K} \n{\Det{(K),\bxi}}{}(\br{}).
\eeq 
Since, for given ensemble weight $\bw$ and $\bxi$ values, the ensemble densities $\n{}{\bxi,\bxi}$ and $\n{}{\bw,\bxi}$ are generated from the \textit{same} KS potential (which is unique up to a constant), it comes
from the exact expression in Eq.~\ref{eq:exact_ens_Hx} that 
\beq
	\E{Hx}{\bxi}[\n{}{\bxi,\bxi}] = \sum_{K \geq 0} \xi_K \mel*{\Det{(K),\bxi}}{\hWee}{\Det{(K),\bxi}}
\eeq  
with $\xi_0 = 1 - \sum_{K>0}\xi_K$
and
\beq
	\E{Hx}{\bw}[\n{}{\bw,\bxi}] = \sum_{K \geq 0} \ew{K} \mel*{\Det{(K),\bxi}}{\hWee}{\Det{(K),\bxi}},
\eeq  
thus leading, according to Eqs.~\eqref{eq:deriv_Ew_wk} and \eqref{eq:_deriv_wk_Hx}, to the simplified expression
\beq\label{eq:deriv_Ew_wk_simplified}
\begin{split}
	\pdv{\E{}{\bw}}{\ew{K}} 
	& = \mel*{\Det{(K)}}{\hH}{\Det{(K)}} 
	- \mel*{\Det{(0)}}{\hH}{\Det{(0)}}
	\\
	& + \qty{
	\int d\br{} \fdv{\E{c}{\bw}[\n{}{}]}{\n{}{}({\br{}})} 
	\qty[ \n{\Det{(K)}}{}(\br{}) - \n{\Det{(0)}}{}(\br{}) ]
	+
	\pdv{\E{c}{\bw} [\n{}{}]}{\ew{K}} 
	}_{\n{}{} = \n{\opGam{\bw}}{}}.
\end{split}
\eeq
Since the ensemble energy can be evaluated as follows:
\beq
	\E{}{\bw} = \sum_{K \geq 0} \ew{K} \mel*{\Det{(K)}}{\hH}{\Det{(K)}} + \E{c}{\bw}[\n{\opGam{\bw}}{}],
\eeq 
with $\Det{(K)} = \Det{(K),\bw}$ [note that, when the minimum is reached in Eq.~\eqref{eq:var_ener_gokdft}, $\n{\opGam{\bw}}{} = \n{}{\bw,\bw}$], 
we finally recover from Eqs.~\eqref{eq:KS_ens_density} and
\eqref{eq:indiv_ener_from_ens} the {\it exact} expression of Ref.~\cite{} for the $I$th energy level:
\beq\label{eq:exact_ener_level_dets}
\begin{split}
	\E{}{(I)} 
	& = \mel*{\Det{(I)}}{\hH}{\Det{(I)}} + \E{c}{{\bw}}[\n{\opGam{\bw}}{}]
	\\
	& + \int d\br{} \fdv{\E{c}{\bw}[\n{\opGam{\bw}}{}]}{\n{}{}(\br{})}
	\qty[ \n{\Det{(I)}}{}(\br{}) - \n{\opGam{\bw}}{}(\br{}) ]
	\\
	&+
	\sum_{K>0} \qty(\delta_{IK} - \ew{K} )
	\left.
	\pdv{\E{c}{\bw}[\n{}{}]}{\ew{K}}
	\right|_{\n{}{} = \n{\opGam{\bw}}{}}.
\end{split}
\eeq
%%%%%%%%%%%%%%%%
\subsection{One-electron reduced density matrix formulation}
%%%%%%%%%%%%%%%%
For implementation purposes, we will use in the rest of this work 
(one-electron reduced) density matrices 
as basic variables, rather than Slater determinants. If we expand the
ensemble KS spinorbitals [from which the latter are constructed] in an atomic orbital (AO) basis,
\beq
	\SO{p}{}(\br{}) = \sum_{\mu} \cMO{\mu p}{} \AO{\mu}(\br{}),
\eeq
then the density matrix elements obtained from the   
determinant $\Det{(K)}$ can be expressed as follows in the AO basis:
\beq
	\bGam{(K)} \equiv \eGam{\mu\nu}{(K)} = \sum_{\SO{p}{} \in (K)} \cMO{\mu p}{} \cMO{\nu p}{},
\eeq
where the summation runs over the spinorbitals that are occupied in $\Det{(K)}$. 
Note that the density of the $K$th KS state reads
\beq
	\n{\bGam{(K)}}{}(\br{}) = \sum_{\mu\nu} \AO{\mu}(\br{}) \eGam{\mu\nu}{(K)} \AO{\nu}(\br{}).
\eeq 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Manu's derivation %%%
\iffalse%%
\blue{
\beq
n_{\bmg^{(K)}}(\br{})&=&\sum_\sigma\left\langle\hat{\Psi}^\dagger(\br{}\sigma)\hat{\Psi}(\br{}\sigma)\right\rangle^{(K)}
\nonumber\\
&=&\sum_\sigma\sum_{pq}\varphi^\sigma_p(\br{})\varphi^\sigma_q(\br{})\left\langle\hat{a}_{p^\sigma,\sigma}^\dagger\hat{a}_{q^\sigma,\sigma}\right\rangle^{(K)}
\nonumber\\
&=&\sum_\sigma\sum_{\varphi^\sigma_p\in(K)}\left(\varphi^\sigma_p(\br{})\right)^2
\nonumber\\
&=&\sum_\sigma\sum_{\varphi^\sigma_p\in(K)}\sum_{\mu\nu}c^\sigma_{{\mu
p}}c^\sigma_{{\nu p}}\AO{\mu}(\br{})\AO{\nu}(\br{})
\nonumber\\
&=&\sum_{\mu\nu}\AO{\mu}(\br{})\AO{\nu}(\br{})\sum_\sigma\sum_{\varphi^\sigma_p\in(K)}c^\sigma_{{\mu
p}}c^\sigma_{{\nu p}}
\eeq
}
\fi%%%
%%%% end Manu
We can then construct the ensemble density matrix
and the ensemble density as follows:
\beq
	\bGam{\bw} 
	= \sum_{K\geq 0} \ew{K} \bGam{(K)}
	\equiv \eGam{\mu\nu}{\bw}
	= \sum_{K\geq 0} \ew{K} \eGam{\mu\nu}{(K)}
\eeq
and
\beq
	\n{\bGam{\bw}}{}(\br{}) = \sum_{\mu\nu} \AO{\mu}(\br{}) \eGam{\mu\nu}{\bw} \AO{\nu}(\br{}),
\eeq
respectively. The exact energy level expression in Eq.~\eqref{eq:exact_ener_level_dets} can be
rewritten as follows:
\beq\label{eq:exact_ind_ener_rdm}
\begin{split}
	\E{}{(I)} 
	& =\Tr[\bGam{(I)} \bh]
	+ \frac{1}{2} \Tr[\bGam{(I)} \bG \bGam{(I)}]
	+ \E{c}{{\bw}}[\n{\bGam{\bw}}{}]
	\\
	& + \int d\br{} \fdv{\E{c}{\bw}[\n{\bGam{\bw}}{}]}{\n{}{}(\br{})}
	\qty[ \n{\bGam{(I)}}{}(\br{}) - \n{\bGam{\bw}}{}(\br{}) ]
	\\
	& + \sum_{K>0} \qty(\delta_{IK} - \ew{K})
	\left. \pdv{\E{c}{\bw}[\n{}{}]}{\ew{K}}\right|_{\n{}{} = \n{\bGam{\bw}}{}}
	,
\end{split}
\eeq
where 
\beq
	\bh \equiv h_{\mu\nu} = \int d\br{} \AO{\mu}(\br{}) \qty[-\frac{1}{2} \nabla_{\br{}}^2 + \vne(\br{}) ]\AO{\nu}(\br{})
\eeq
denote the one-electron integrals matrix.
The individual Hx energy is obtained from the following trace
\beq
	\Tr[\bGam{(K)} \bG \bGam{(L)}]
	= \sum_{\mu\nu\la\si} \eGam{\mu\nu}{(K)} \eG{\mu\nu\la\si} \eGam{\la\si}{(L)},
\eeq
where the two-electron Coulomb-exchange integrals read
\beq
	G_{\mu\nu\la\omega} 
	= \dbERI{\mu\nu}{\la\si} 
	= \ERI{\mu\nu}{\la\si} - \ERI{\mu\si}{\la\nu},
\eeq
with
\beq
	\ERI{\mu\nu}{\la\si} = \iint \frac{\AO{\mu}(\br{1}) \AO{\nu}(\br{1}) \AO{\la}(\br{2}) \AO{\si}(\br{2})}{\abs{\br{1} - \br{2}}} d\br{1} d\br{2}.
\eeq
%Note that, in Sec.~\ref{sec:results}, the theory is applied to (1D) spin
%polarized systems in which $\eGam{\mu\nu}{(K)\beta}=0$ and
%$G_{\mu\nu\lambda\omega}^{\alpha\alpha}\equiv G_{\mu\nu\lambda\omega}=({\mu}{\nu}\vert{\lambda}{\omega})
%-(\mu\omega\vert\lambda\nu)$. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% Hx energy ...
%%% Manu's derivation
\iffalse%%%%
\blue{
\beq
&&\dfrac{1}{2}\sum_{PQRS}\langle PQ\vert\vert
RS\rangle\eGam{PR}^{(K)}\eGam{QS}^{(L)}
\nonumber\\
&&
=\dfrac{1}{2}\sum_{\sigma,\tau}\sum_{p^{\sigma} q^{\tau}RS}
\nonumber\\
&&\Big(\langle p^\sigma\sigma q^\tau\tau\vert RS\rangle -\langle
p^\sigma\sigma q^\tau\tau
\vert SR\rangle
\Big)\Gamma^{(K)}_{p^\sigma\sigma,R}\Gamma^{(L)}_{q^\tau\tau, S}
\nonumber\\
&&
=\dfrac{1}{2}\sum_{\sigma,\tau}\sum_{p^{\sigma} q^{\tau}}
\nonumber\\
&&\Big(\sum_{r^\sigma s^\tau}\langle p^\sigma q^\tau\vert r^\sigma s^\tau\rangle
\Gamma^{(K)\sigma}_{p^\sigma r^\sigma}\Gamma^{(L)\tau}_{q^\tau s^\tau}
\nonumber\\
&& -\sum_{s^\sigma r^\tau}\langle
p^\sigma q^\tau
\vert s^\sigma r^\tau\rangle
\delta_{\sigma\tau}\Gamma^{(K)\sigma}_{p^\sigma
r^\sigma}\Gamma^{(L)\sigma}_{q^\sigma s^\sigma}\Big)
\nonumber\\
&&=\dfrac{1}{2}\sum_{\sigma,\tau}\sum_{p^{\sigma} q^{\tau}}
\nonumber\\
&&\left(\langle p^\sigma q^\tau\vert p^\sigma q^\tau\rangle
n_{p^\sigma}^{(K)\sigma}n_{q^\tau}^{(L)\tau}
-\delta_{\sigma\tau}\langle p^\sigma q^\sigma\vert q^\sigma p^\sigma \rangle
n_{p^\sigma}^{(K)\sigma}n_{q^\sigma}^{(L)\sigma}\right) 
\nonumber\\
&&=\dfrac{1}{2}\sum_{\mu\nu\lambda\omega}\sum_{\sigma,\tau}\Big(\langle{\mu}{\lambda}\vert{\nu}{\omega}\rangle
\Gamma_{\mu\nu}^{(K)\sigma}\Gamma_{\lambda\omega}^{(L)\tau}
-\delta_{\sigma\tau}\langle\mu\lambda\vert\omega\nu\rangle\Gamma_{\mu\nu}^{(K)\sigma}\Gamma_{\lambda\omega}^{(L)\sigma}
\Big)
\nonumber\\
&&=\dfrac{1}{2}\sum_{\mu\nu\lambda\omega}\sum_{\sigma,\tau}\Big(\langle{\mu}{\lambda}\vert{\nu}{\omega}\rangle
-\delta_{\sigma\tau}\langle\mu\lambda\vert\omega\nu\rangle
\Big)
\Gamma_{\mu\nu}^{(K)\sigma}\Gamma_{\lambda\omega}^{(L)\tau}
\nonumber\\
&&=\dfrac{1}{2}\sum_{\mu\nu\lambda\omega}\sum_{\sigma,\tau}\Big[({\mu}{\nu}\vert{\lambda}{\omega})
-\delta_{\sigma\tau}(\mu\omega\vert\lambda\nu)
\Big]
\Gamma_{\mu\nu}^{(K)\sigma}\Gamma_{\lambda\omega}^{(L)\tau}
\eeq
}
\fi%%%%%%%
%%%%
%%%%%%%%%%%%%%%%%%%%%
\iffalse%%%% Manu's derivation ...
\blue{
\beq
n^{\bw}({\br{}})&=&\sum_{K\geq 0}\sum_{\sigma=\alpha,\beta}{\tt
w}_Kn^{(K)}({\bfx})
\nonumber\\
&=&
\sum_{K\geq 0}\sum_{\sigma=\alpha,\beta}{\tt
w}_K\sum_{pq}\varphi_p({\bfx})\varphi_q({\bfx})\Gamma_{pq}^{(K)}
\nonumber\\
&=&
\sum_{\sigma=\alpha,\beta}
\sum_{K\geq 0}
{\tt
w}_K\sum_{p\in (K)}\varphi^2_p({\bfx})
\nonumber\\
&=&
\sum_{\sigma=\alpha,\beta}
\sum_{K\geq 0}
{\tt
w}_K
\sum_{\mu\nu}
\sum_{p\in (K)}c_{\mu p}c_{\nu p}\AO{\mu}({\bfx})\AO{\nu}({\bfx})
\nonumber\\
&=&\sum_{\sigma=\alpha,\beta}\sum_{\mu\nu}\AO{\mu}({\bfx})\AO{\nu}({\bfx}){\Gamma}^{\bw}_{\mu\nu}
\eeq
}
\fi%%%%%%%% end
%%%%%%%%%%%%%%%
%\subsection{Hybrid GOK-DFT}
%%%%%%%%%%%%%%%


\subsection{Approximations}\label{subsec:approx}

As Hartree and exchange energies cannot be separated in the
one-dimension systems considered in the rest of this work, we will substitute the Hartree--Fock
density-matrix-functional interaction energy,
\beq\label{eq:eHF-dens_mat_func}
	\WHF[\bGam{}] = \frac{1}{2} \Tr[\bGam{} \bG \bGam{}], 
\eeq
for the Hx density-functional energy in the variational energy
expression of Eq.~\eqref{eq:var_ener_gokdft}:  
\beq
	\bGam{\bw} 
	\approx \argmin_{\bgam{\bw}} 
	\qty{ 
	\Tr[\bgam{\bw} \bh ] + \WHF[ \bgam{\bw}] + \E{c}{\bw}[\n{\bgam{\bw}}{}]
	}.
\eeq
The minimizing ensemble density matrix fulfills the following
stationarity condition
\beq\label{eq:commut_F_AO}
	\bF{\bw} \bGam{\bw} \bS = \bS \bGam{\bw} \bF{\bw},
\eeq
where $\bS \equiv \eS{\mu\nu} = \braket*{\AO{\mu}}{\AO{\nu}}$ is the metric and the ensemble Fock-like matrix reads
\beq
	\eF{\mu\nu}{\bw} = \eh{\mu\nu}{\bw} + \sum_{\la\si} \eG{\mu\nu\la\si} \eGam{\la\si}{\bw}
\eeq 
with
\beq
	\eh{\mu\nu}{\bw} 
	= \eh{\mu\nu}{} + \int d\br{} \AO{\mu}(\br{}) \fdv{\E{c}{\bw}[\n{\bGam{\bw}}{}]}{\n{}{}(\br{})} \AO{\nu}(\br{}).
\eeq

%%%%%%%%%%%%%%%
\iffalse%%%%%%
% Manu's derivation %%%%
\color{blue}
I am teaching myself ...\\
Stationarity condition
\beq
&&0=\sum_{K\geq 0}w_K\sum_{t^\sigma}\Big(f_{p^\sigma\sigma,t^\sigma\sigma}\Gamma^{(K)\sigma}_{t^\sigma
q^\sigma}-\Gamma^{(K)\sigma}_{p^\sigma
t^\sigma}f_{t^\sigma\sigma,q^\sigma\sigma}\Big)
\nonumber\\
&&=\sum_{K\geq 0}w_K
\Big(f_{p^\sigma\sigma,q^\sigma\sigma}n^{(K)\sigma}_{q^\sigma}-n^{(K)\sigma}_{p^\sigma}f_{p^\sigma\sigma,q^\sigma\sigma}\Big)
\nonumber\\
&&
=\sum_{\mu\nu}\sum_{K\geq 0}w_KF_{\mu\nu}^\sigma c^\sigma_{\mu
p}c^\sigma_{\nu q}\left(n^{(K)\sigma}_{q^\sigma}-n^{(K)\sigma}_{p^\sigma}\right)
\eeq
thus leading to
\beq
&&0=\sum_{p^\sigma q^\sigma}c^\sigma_{\lambda
p}c^\sigma_{\omega q}\left(\sum_{\mu\nu}\sum_{K\geq 0}w_KF_{\mu\nu}^\sigma c^\sigma_{\mu
p}c^\sigma_{\nu q}\left(n^{(K)\sigma}_{q^\sigma}-n^{(K)\sigma}_{p^\sigma}\right)\right)
\nonumber\\
&&=\sum_{\mu\nu}\sum_{K\geq 0}w_K
F_{\mu\nu}^\sigma\left(\Gamma^{(K)\sigma}_{\nu\omega}\sum_{p^\sigma}c^\sigma_{\lambda
p}c^\sigma_{\mu
p}-\Gamma^{(K)\sigma}_{\mu\lambda}\sum_{q^\sigma}c^\sigma_{\omega q}c^\sigma_{\nu q}\right)
\nonumber\\
\eeq
If we denote $M^\sigma_{\lambda\mu}=\sum_{p^\sigma}c^\sigma_{\lambda
p}c^\sigma_{\mu
p}$ it comes 
\beq
S_{\mu\nu}=\sum_{\lambda\omega}S_{\mu\lambda}M^\sigma_{\lambda\omega}S_{\omega\nu}
\eeq
which simply means that
\beq
{\bm S}={\bm S}{\bm M}{\bm S}
\eeq
or, equivalently,
\beq
{\bm M}={\bm S}^{-1}.
\eeq
The stationarity condition simply reads
\beq
\sum_{\mu\nu}F_{\mu\nu}^\sigma\left(\Gamma^{\bw\sigma}_{\nu\omega}
\left[{\bm S}^{-1}\right]_{\lambda\mu}
-\Gamma^{\bw\sigma}_{\mu\lambda}\left[{\bm S}^{-1}\right]_{\omega\nu}\right)
=0
\eeq
thus leading to
\beq
{\bm S}^{-1}{{\bm F}^\sigma}{\bm \Gamma}^{\bw\sigma}={\bm \Gamma}^{\bw\sigma}{{\bm F}^\sigma}{\bm S}^{-1}
\eeq
or, equivalently,
\beq
{{\bm F}^\sigma}{\bm \Gamma}^{\bw\sigma}{\bm S}={\bm S}{\bm
\Gamma}^{\bw\sigma}{{\bm F}^\sigma}.
\eeq
%%%%%

Fock operator:\\
\beq
&&f_{p^\sigma\sigma,q^\sigma\sigma}-\langle\varphi_p^\sigma\vert\hat{h}\vert\varphi_q^\sigma\rangle
\nonumber\\
&&=\sum_{L\geq 0}w_L\sum_{\tau}\sum_{r^\tau s^\tau}
\nonumber\\
&&
\Big(\langle p^\sigma r^\tau\vert
q^\sigma s^\tau\rangle
-\delta_{\sigma\tau}\langle p^\sigma r^\sigma\vert
s^\sigma q^\sigma\rangle
\Big)
\Gamma^{(L)\tau}_{r^\tau
s^\tau}
\nonumber\\
&&
=\sum_{L\geq 0}w_L\sum_{\tau}\sum_{r^\tau}\Big(\langle p^\sigma r^\tau\vert
q^\sigma r^\tau\rangle
-\delta_{\sigma\tau}\langle p^\sigma r^\tau\vert
r^\tau q^\sigma\rangle
\Big)
n^{(L)\tau}_{r^\tau}
\nonumber\\
&&=\sum_{L\geq 0}w_L
\sum_{\lambda\omega}\sum_{\tau}\Big[\langle
p^\sigma\lambda\vert q^\sigma\omega\rangle
-\delta_{\sigma\tau}
\langle
p^\sigma\lambda\vert \omega q^\sigma\rangle\Big]
\Gamma^{(L)\tau}_{\lambda\omega}
\nonumber\\
&&=
\sum_{\lambda\omega}\sum_{\tau}\Big[\langle
p^\sigma\lambda\vert q^\sigma\omega\rangle
-\delta_{\sigma\tau}
\langle
p^\sigma\lambda\vert \omega q^\sigma\rangle\Big]
\Gamma^{\bw\tau}_{\lambda\omega}
\nonumber\\
&&=\sum_{\mu\nu\lambda\omega}\sum_{\tau}
\Big(\langle{\mu}{\lambda}\vert{\nu}{\omega}\rangle
-\delta_{\sigma\tau}\langle\mu\lambda\vert\omega\nu\rangle
\Big)\Gamma^{\bw\tau}_{\lambda\omega}c^\sigma_{\mu p}c^\sigma_{\nu q}
\nonumber\\
\eeq
or, equivalently,
\beq
f_{p^\sigma\sigma,q^\sigma\sigma}=\sum_{\mu\nu}F_{\mu\nu}^\sigma c^\sigma_{\mu p}c^\sigma_{\nu q}
\eeq
where
\beq
F_{\mu\nu}^\sigma=h_{\mu\nu}+\sum_{\lambda\omega}\sum_\tau
G_{\mu\nu\lambda\omega}^{\sigma\tau}\Gamma^{\bw\tau}_{\lambda\omega}
\eeq
and
\color{black}
\\
\fi%%%%%%%%%%%
%%%%% end Manu 
%%%%%%%%%%%%%%%%%%%%
Note that this approximation, where the ensemble density matrix is
optimized from a non-local exchange potential [rather than a local one,
as expected from Eq.~\eqref{eq:var_ener_gokdft}] is applicable to real
(three-dimension) systems. As readily seen from
Eq.~\eqref{eq:eHF-dens_mat_func}, \textit{ghost interactions}~\cite{Gidopoulos_2002, Pastorczak_2014, Alam_2016, Alam_2017, Gould_2017}
and curvature~\cite{} will be introduced in the Hx energy:
\beq
\begin{split}
	\WHF[\bGam{\bw}] 
	& = \frac{1}{2} \sum_{K\geq 0} \ew{K}^2 \Tr[\bGam{(K)} \bG \bGam{(K)}]
	\\
	& + \sum_{L>K\geq 0} \ew{K} \ew{L}\Tr[\bGam{(K)} \bG \bGam{(L)}].
\end{split}
\eeq
These errors will be removed when computing individual energies
according to Eq.~\eqref{eq:exact_ind_ener_rdm}.    

Turning to the density-functional ensemble correlation energy, the
following eLDA will be employed:  
\beq\label{eq:eLDA_corr_fun}
	\E{c}{\bw}[\n{}{}] = \int d\br{} \n{}{}(\br{}) \e{c}{\bw}[\n{}{}(\br{})],
\eeq
where the correlation energy per particle is {\it weight-dependent}. Its
construction from a finite uniform electron gas model is discussed
in detail
in Sec.~\ref{sec:eDFA}. Combining Eq.~\eqref{eq:exact_ind_ener_rdm} with
Eq.~\eqref{eq:eLDA_corr_fun} leads to our final energy level expression
within eLDA: 
\beq
\begin{split}
	\E{}{(I)} 
	& \approx \Tr[\bGam{(I)} \bh] + \frac{1}{2} \Tr[\bGam{(I)} \bG \bGam{(I)}]
	\\
	& + \int d\br{} \e{c}{\bw}[\n{\bGam{\bw}}{}(\br{})] \n{\bGam{(I)}}{}(\br{})
	\\
	&
	+ \int d\br{} \n{\bGam{\bw}}{}(\br{}) \qty[ \n{\bGam{(I)}}{}(\br{}) - \n{\bGam{\bw}}{}(\br{}) ]
	\left. \pdv{\e{c}{{\bw}}(\n{}{})}{\n{}{}} \right|_{\n{}{} = \n{\bGam{\bw}}{}(\br{})}
	\\
	& + \int d\br{} \sum_{K>0} \qty(\delta_{IK} - \ew{K} ) \n{\bGam{\bw}}{}(\br{})
	\left. \pdv{\e{c}{\bw}(\n{}{})}{\ew{K}} \right|_{\n{}{}=\n{\bGam{\bw}}{}(\br{})}.
\end{split}
\eeq

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Density-functional approximations for ensembles}
\label{sec:eDFA}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Most of the standard local and semi-local DFAs rely on the infinite uniform electron gas (UEG) model (also known as jellium). \cite{ParrBook, Loos_2016}
One major drawback of the jellium paradigm, when it comes to develop eDFAs, is that the ground and excited states cannot be easily identified like in a molecule. \cite{Gill_2012, Loos_2012, Loos_2014a, Loos_2014b, Agboola_2015, Loos_2017a}
Moreover, because the infinite UEG model is a metal, it is gapless, which means that both the fundamental and optical gaps are zero.
From this point of view, using finite UEGs \cite{Loos_2011b, Gill_2012} (which have, like an atom, discrete energy levels) to construct eDFAs can be seen as more relevant. \cite{Loos_2014a, Loos_2014b, Loos_2017a}
Here, we propose to construct a weight-dependent eDFA for the calculations of excited states in 1D systems. 

As a finite uniform electron gas, we consider the ringium model in which electrons move on a perfect ring (i.e., a circle). \cite{Loos_2012, Loos_2013a, Loos_2014b}
The most appealing feature of ringium (regarding the development of functionals in the context of eDFT) is the fact that both ground- and excited-state densities are uniform. 
As a result, the ensemble density will remain constant (and uniform) as the ensemble weights vary. 
This is a necessary condition for being able to model derivative discontinuities. 

The present weight-dependent eDFA is specifically designed for the calculation of excitation energies within eDFT.
As mentioned previously, we consider a three-state ensemble including the ground state ($I=0$), the first singly-excited state ($I=1$), and the first doubly-excited state ($I=2$) of the (spin-polarized) two-electron ringium system.
All these states have the same (uniform) density $\n{}{} = 2/(2\pi R)$ where $R$ is the radius of the ring where the electrons are confined.
We refer the interested reader to Refs.~\onlinecite{Loos_2012, Loos_2013a, Loos_2014b} for more details about this paradigm.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Weight-dependent correlation functional}
\label{sec:Ec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Based on highly-accurate calculations (see {\SI} for additional details), one can write down, for each state, an accurate analytical expression of the reduced (i.e., per electron) correlation energy \cite{Loos_2013a, Loos_2014a} via the following Pad\'e approximant
\begin{equation}
\label{eq:ec}
	\e{c}{(I)}(\n{}{}) = \frac{a_1^{(I)}\,\n{}{}}{\n{}{} + a_2^{(I)} \sqrt{\n{}{}} + a_3^{(I)}},
\end{equation}
where the $a_k^{(I)}$'s are state-specific fitting parameters provided in Table \ref{tab:OG_func}.
The value of $a_1^{(I)}$ is obtained via the exact high-density expansion of the correlation energy. \cite{Loos_2013a, Loos_2014a}
Equation \eqref{eq:ec} provides three state-specific correlation DFAs based on a two-electron system.
Combining these, one can build a three-state weight-dependent correlation eDFA:
\begin{equation}
\label{eq:ecw}
	\e{c}{\bw}(\n{}{}) =  (1-\ew{1}-\ew{2}) \e{c}{(0)}(\n{}{}) + \ew{1} \e{c}{(1)}(\n{}{}) + \ew{2} \e{c}{(2)}(\n{}{}).
\end{equation}

%%% TABLE 1 %%%
\begin{table*}
	\caption{
	\label{tab:OG_func}
	Parameters of the weight-dependent correlation DFAs defined in Eq.~\eqref{eq:ec}.}
%	\begin{ruledtabular}
		\begin{tabular}{lcddd}
			\hline\hline
			State					&	$I$		&	\tabc{$a_1^{(I)}$}	&	\tabc{$a_2^{(I)}$}	&	\tabc{$a_3^{(I)}$}	\\
			\hline
			Ground state			&	$0$		&	-0.0137078			&	0.0538982			&	0.0751740			\\
			Singly-excited state	&	$1$		&	-0.0238184			&	0.00413142			&	0.0568648			\\
			Doubly-excited state	&	$2$		&	-0.00935749			&	-0.0261936			&	0.0336645			\\
			\hline\hline
		\end{tabular}
%	\end{ruledtabular}
\end{table*}
%%% %%% %%% %%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{LDA-centered functional}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In order to make the two-electron-based eDFA defined in Eq.~\eqref{eq:ecw} more universal and to ``center'' it on the jellium reference (as commonly done in DFT), we propose to \emph{shift} it as follows:
\begin{equation}
\label{eq:becw}
	\be{c}{\bw}(\n{}{}) =  (1-\ew{1}-\ew{2}) \be{c}{(0)}(\n{}{}) + \ew{1} \be{c}{(1)}(\n{}{}) + \ew{2} \be{c}{(2)}(\n{}{}),
\end{equation}
where
\begin{equation}
	\be{c}{(I)}(\n{}{}) = \e{c}{(I)}(\n{}{}) + \e{c}{\text{LDA}}(\n{}{}) - \e{c}{(0)}(\n{}{}).
\end{equation}
The local-density approximation (LDA) correlation functional,
\begin{equation}
	\e{c}{\text{LDA}}(\n{}{}) = a_1^\text{LDA} \, F\qty[1,\frac{3}{2},a_3^\text{LDA}, \frac{a_1^\text{LDA}(1-a_3^\text{LDA})}{a_2^\text{LDA}} {\n{}{}}^{-1}],
\end{equation}
specifically designed for 1D systems in Ref.~\onlinecite{Loos_2013} as been used, where $F(a,b,c,x)$ is the Gauss hypergeometric function, \cite{NISTbook} and
\begin{align}
	a_1^\text{LDA} & = - \frac{\pi^2}{360},
	&
	a_2^\text{LDA} & = \frac{3}{4} - \frac{\ln{2\pi}}{2},
	& 
	a_3^\text{LDA} & = 2.408779.
\end{align}
Equation \eqref{eq:becw} can be recast
\begin{equation}
\label{eq:eLDA}
\begin{split}
	\be{c}{\bw}(\n{}{}) 
	& =  \e{c}{\text{LDA}}(\n{}{}) 
	\\
	& + \ew{1} \qty[\e{c}{(1)}(\n{}{})-\e{c}{(0)}(\n{}{})] + \ew{2} \qty[\e{c}{(2)}(\n{}{})-\e{c}{(0)}(\n{}{})],
\end{split}
\end{equation}
which nicely highlights the centrality of the LDA in the present eDFA. 
In particular, $\be{c}{(0,0)}(\n{}{}) = \e{c}{\text{LDA}}(\n{}{})$.
Consequently, in the following, we name this correlation functional ``eLDA'' as it is a natural extension of the LDA for ensembles.

This procedure can be theoretically justified by the generalized adiabatic connection formalism for ensembles (GACE) which was originally derived by Franck and Fromager. \cite{Franck_2014} 
Within this in-principle-exact formalism, the (weight-dependent) correlation energy of the ensemble is constructed from the (weight-independent) ground-state functional (such as the LDA), yielding Eq.~\eqref{eq:eLDA}.
This is a crucial point as we intend to incorporate into standard functionals (which are ``universal'' in the sense that they do not depend on the number of electrons) information about excited states that will be extracted from finite systems (whose properties may depend on the number of electrons).

Finally, we note that, by construction,
\begin{equation}
	\left. \pdv{\be{c}{\bw}[\n{}{}]}{\ew{J}}\right|_{\n{}{} = \n{}{\bw}(\br{})} = \be{c}{(J)}[\n{}{\bw}(\br{})] - \be{c}{(0)}[\n{}{\bw}(\br{})].
\end{equation}
\titou{As shown by Gould and Pittalis, comment on density- and and state-driven errors. \cite{Gould_2019}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Computational details}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Having defined the eLDA functional in the previous section [see Eq.~\eqref{eq:eLDA}], we now turn to its validation.
Our testing playground for the validation of the eLDA functional is the ubiquitous ``electrons in a box'' model where $\Nel$ electrons are confined in a 1D box of length $L$, a family of systems that we call $\Nel$-boxium.
In particular, we investigate systems where $L$ ranges from $\pi/8$ to $8\pi$ and $2 \le \Nel \le 7$. 
\titou{Comment on the quality of these density: density- and functional-driven errors?}

These inhomogeneous systems have non-trivial electronic structure properties which can be tuned by varying the box length.
For small $L$, the system is weakly correlated, while strong correlation effects dominate in the large-$L$ regime. \cite{Rogers_2017,Rogers_2016}
We use as basis functions the (orthonormal) orbitals of the one-electron system, i.e.
\begin{equation}
	\AO{\mu}(x) = 
	\begin{cases}
		\sqrt{2/L} \cos(\mu \pi x/L),	&	\mu \text{ is odd,}
		\\
		\sqrt{2/L} \sin(\mu \pi x/L),	&	\mu \text{ is even,}
	\end{cases}
\end{equation} 
with $ \mu = 1,\ldots,\Nbas$ and $\Nbas = 30$ for all calculations.
For the self-consistent calculations (such as HF, KS-DFT or KS-eDFT), the convergence threshold has been set to $\tau = 10^{-5}$.
For KS-DFT and KS-eDFT calculations, a Gauss-Legendre quadrature is employed to compute numerical integrals.

In order to test the present eLDA functional we have performed various sets of calculations.
To get reference excitation energies for both the single and double excitations, we have performed full configuration interaction (FCI) calculations with the Knowles-Handy FCI program described in Ref.~\onlinecite{Knowles_1989}.
For the single excitations, we have also performed time-dependent HF (TDHF), configuration interaction singles (CIS) and TDLDA calculations. \cite{Dreuw_2005}
For TDLDA, the validity of the Tamm-Dancoff approximation (TDA) has been also investigated.
Concerning the KS-eDFT calculations, two sets of weight have been tested: the zero-weight limit where $\bw = (0,0)$ and the equi-ensemble (or state-averaged) limit where $\bw = (1/3,1/3)$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Results and discussion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In Fig.~\ref{fig:EvsL}, we report the excitation energies (multiplied by $L^2$) for various methods and box sizes in the case of 5-boxium (i.e., $\Nel = 5$).
Similar graphs are obtained for the other $\Nel$ values and they can be found in the {\SI} alongside the numerical data associated with each method.
In the weakly correlated regime (i.e., small $L$), all methods provide accurate estimates of the excitation energies.
When the box gets larger, they start to deviate.
For the single excitation, TDHF is extremely accurate over the whole range of $L$ values, while CIS is slightly less accurate and starts to overestimate the excitation energy by a few percent at $L=8\pi$.
TDLDA yields larger errors at large $L$ by underestimating the excitation energies.
TDA-TDLDA slightly corrects this trend thanks to error compensation. 
Concerning the eLDA functional, our results clearly evidences that the equi-weights [i.e., $\bw = (1/3,1/3)$] excitation energies are much more accurate than the ones obtained in the zero-weight limit [i.e., $\bw = (0,0)$].
This is especially true for the single excitation which is significantly improved by using state-averaged weights.
The effect on the double excitation is less pronounced.
Overall, one clearly sees that, with state-averaged weights, the eLDA functional yields accurate excitation energies for both single and double excitations.
This conclusion is verified for smaller and larger number of electrons (see {\SI}).

%%% FIG 1 %%%
\begin{figure}
	\includegraphics[width=\linewidth]{EvsL_5}
	\caption{
	\label{fig:EvsL}
	Excitation energies (multiplied by $L^2$) associated with the single excitation $\Ex{(1)}$ (bottom) and double excitation $\Ex{(2)}$ (top) of 5-boxium for various methods and box length $L$.
	Graphs for additional values of $\Nel$ can be found as {\SI}.
	}
\end{figure}
%%% %%% %%%

Figure \ref{fig:EvsN} reports the error (in \%) in excitation energies (compared to FCI), for the same methods, as a function of $\Nel$ and fixed $L$ (in this case $L=\pi$).
The graphs associated with other $L$ values are reported as {\SI}.
Again, the graph for $L=\pi$ is quite typical and we draw similar conclusions as in the previous paragraph: irrespectively of the number of electrons, the eLDA functional with state-averaged weights is able to accurately model single and double excitations. 
As a rule of thumb, we see that eLDA single excitations are of the same quality as the ones obtained in the linear response formalism (such as TDHF or TDLDA), while double excitations only deviates from the FCI values by a few tenth of percent for $L=\pi$.
Even for larger boxes, the discrepancy between FCI and eLDA for double excitations is only few percents.

%%% FIG 2 %%%
\begin{figure}
	\includegraphics[width=\linewidth]{EvsN_1}
	\caption{
	\label{fig:EvsN}
	Error with respect to FCI in single and double excitation energies for $\Nel$-boxium for various methods and number of electrons $\Nel$ at $L=\pi$.
	Graphs for additional values of $L$ can be found as {\SI}.
	}
\end{figure}
%%% %%% %%%

\titou{Need further discussion on DD and LZ shift. Linearity of energy wrt weights?}

\titou{For small $L$, the single and double excitations are ``pure''. In other words, the excitation is dominated by a single reference Slater determinant.
However, when the box gets larger, there is a strong mixing between different degree of excitations.
In particular, the single and double excitations strongly mix.
This is clearly evidenced if one looks at the weights of the different configurations in the FCI wave function.
In one hand, if one does construct a eDFA with a single state (either single or double), one clearly sees that the results quickly deteriorates when the box gets larger.
On the other hand, building a functional which does mix singles and doubles corrects this by allowing configuration mixing.}

\manu{It might be useful to add eHF results where one switch off the correlation part.
For both zero weight and state-averaged weights?
It would highlight the contribution of the derivative discontinuity.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Concluding remarks}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In the present article, we have constructed a weight-dependent three-state DFA in the context of ensemble DFT.
This eDFA delivers accurate excitation energies for both single and double excitations.
Generalization to a larger number of states is straightforward and will be investigated in future work.
Using similar ideas, a three-dimensional version \cite{Loos_2009,Loos_2009c,Loos_2010,Loos_2010d,Loos_2017a} of the present eDFA is currently under development to model excited states in molecules and solids.

Similar to the present excited-state methodology for ensembles, one can easily design a local eDFA for the calculations of the ionization potential, electron affinity, and fundamental gap.\cite{Senjean_2018}
This can be done by constructing DFAs for the one- and three-electron ground state systems, and combining them with the two-electron DFA in complete analogy with Eqs.~\eqref{eq:ec} and \eqref{eq:ecw}.
We hope to report on this in the near future.
%However, as shown by Senjean and Fromager, \cite{Senjean_2018} one must modify the weights accordingly in order to maintain a constant density.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Supplementary material}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
See {\SI} for the additional details about the construction of the functionals, raw data and additional graphs.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{acknowledgements}
PFL thanks the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (Grant agreement No.~863481) for financial support.
This work has also been supported through the EUR grant NanoX ANR-17-EURE-0009 in the framework of the \textit{``Programme des Investissements d'Avenir''.} 
EF thanks the \textit{Agence Nationale de la Recherche} (MCFUNEX project, Grant No.~ANR-14-CE06-0014-01) for funding.
\end{acknowledgements}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




\bibliography{eDFT}

\end{document}
