  Perhaps the simplest first-principles approach to electronic structure is to
fit the charge distribution of each orbital pair and use those fits wherever
they appear in the entire electron-electron (EE) interaction energy. The charge
distributions in quantum chemistry are typically represented as a sums over
products of Gaussian orbital basis functions. If fitted, they are also
represented as a sum over single-center Gaussian fitting basis functions. With
two representations of the charge distributions, the proper definition of
energy is ambiguous. To remedy this, we require that the variation of the
energy with respect to a product of orbitals generates a fitted potential. This
makes the quantum-mechanical energy robust, i.e. corrected to first order for
the error made using an incomplete fitting basis. The coupled orbital and
fitting equations are then the result of making the energy stationary with
respect to two independent sets of variables. We define the potentials and
unique energies for methods based on the Hartree Fock model and variationally
fit the full EE interaction in DFT. We compare implementations of variational
fitting in DFT at six different levels for three different functionals. Our
calculations are performed on transition metal atoms, for which first-order
Coulomb errors, due to an incomplete fitting basis sets, are significant.
Variational first-order exchange and correlation errors have similar magnitude
in all cases. Robust energy differences are much smaller, particularly in the
local density approximation.
