Density functional theory: How do I derive potentials $V[n]$ from expressions for the energy $E[n]$? In the following, suppose $n$ is the electron density and $n^\uparrow$ and $n^\downarrow$ denote the density of spin up and spin down electrons respectively. Therefore $n = n^\uparrow + n^\downarrow$.
I am following NIST in their calculation of exchange and correlation for the DFT LDA approximation. The authors state that
$$
V_{xc} = \frac{d}{dn} n\cdot\big(\varepsilon_x(n) + \varepsilon_c(n)\big), \tag{1}
$$
but with the definition $\varepsilon_x \equiv \varepsilon_x^P + f(\zeta)(\varepsilon_x^F  - \varepsilon_x^P)$ where $\zeta = (n^\uparrow - n^\downarrow)/n$, I will need the total derivative $dn^\uparrow/dn$ (by the chain rule). To me, it seems that this is impossible to determine, because I do not have enough equations to solve $n^\uparrow$ as a function of $n$ only, and I am therefore stuck in the cycle
$$
\frac{d n^\uparrow}{dn} = \frac{\partial n^\uparrow}{n} + \frac{\partial n^\uparrow}{\partial n^\downarrow} \frac{d n^\downarrow}{d n} = 1 - \frac{d n^\downarrow}{d n} = 1 - \left[ \frac{\partial n^\downarrow}{n} + \frac{\partial n^\downarrow}{\partial n^\uparrow} \frac{d n^\uparrow}{d n} \right] = 1 - \left[1 - \frac{d n^\uparrow}{dn} \right] = \frac{d n^\uparrow}{dn}.
$$
This is just using the definition of the total derivative twice. This leads me to these three questions:


*

*Which principle/definition does equation $(1)$ derive from? Is this some functional derivative magic? 

*Could it be that the authors mean the partial derivative of some kind instead, i.e. 
$$
V_{xc} = \frac{\partial}{\partial n} n\cdot\big(\varepsilon_x(n) + \varepsilon_c(n)\big) \quad ?
$$
This would solve my problem.

*Can I use the answer to 1. to determine $V_{xc}^\sigma$, where $\sigma \in \{\uparrow, \downarrow\}$? 


PS: For reference, I believe we have the following relation
$$
E_{xc}[n^\uparrow,n^\downarrow] = \int d^3r n(r) (\varepsilon_x(n^\uparrow(r), n^\downarrow(r)) + \varepsilon_c(n(r))),
$$
according to my textbook by Richard M Martin on Electronic structure theory. 
 A: To arrive at the exchange correlation potential starting from the exchange correlation energy, one indeed does not take a total derivative with respect to the density. The exchange correlation energy is a functional of the density, and the exchange correlation potential is given by the functional derivative of the exchange correlation energy
$$E_{\rm xc} = \int_{\rm Volume} {\rm d}^3r n(\vec r)(\epsilon_{\rm x}[n(\vec r)]+\epsilon_{\rm c}[n(\vec r)])$$
($\epsilon_{\rm x}$ and $\epsilon_{\rm c}$ are energy densities per particle, hence the above multiplication by the density $n$) with respect to $n(\vec r)$. Laxly speaking, the functional derivative will here basically correspond taking the partial derivative of the integral kernel with respect to $n$.
If $n_{\uparrow} \neq n_{\downarrow}$, the exchange and correlation energy densities will also depend on the polarization $$\zeta = \frac{n_{\uparrow} - n_{\downarrow}}{n_{\uparrow} + n_{\downarrow}},$$ leading to an additional functional derivative term in the potential with respect to $\zeta(\vec r)$:
$$
V_{\rm xc}[n_{\uparrow,\downarrow}(\vec r)] = \frac{\delta E_{\rm xc}}{\delta n(\vec r)} + \frac{\delta E_{\rm xc}}{\delta \zeta(\vec r)} \frac{\partial \zeta}{\partial n_{\uparrow,\downarrow} } \,\,\,{\rm with}
$$
$$
\frac{\partial \zeta}{\partial n_{\uparrow,\downarrow} } = \frac{1}{n} (\pm 1 - \zeta)
$$
