We choose to minimise the total functional whilst constraining the
normalisation of the density-matrix to the correct value. This is
achieved firstly by projecting all gradients to be perpendicular to the
gradient of the electron number, thus maintaining the electron number to
first order, and secondly by re-converging the electron number to its
correct value before each evaluation of the total functional.