  We describe a variational approach to solving Anderson impurity models by
means of exact diagonalization. Optimized parameters of a discretized auxiliary
model are obtained on the basis of the Peierls-Feynman-Bogoliubov principle.
Thereby, the variational approach resolves ambiguities related with the bath
discretization, which is generally necessary to make Anderson impurity models
tractable by exact diagonalization. The choice of variational degrees of
freedom made here allows systematic improvements of total energies over mean
field decouplings like Hartree-Fock. Furthermore, our approach allows us to
embed arbitrary bath discretization schemes in total energy calculations and to
systematically optimize and improve on traditional routes to the discretization
problem such as fitting of hybridization functions on Matsubara frequencies.
Benchmarks in terms of a single orbital Anderson model demonstrate that the
variational exact diagonalization method accurately reproduces free energies as
well as several single- and two-particle observables obtained from an exact
solution. Finally, we demonstrate the applicability of the variational exact
diagonalization approach to realistic five orbital problems with the example
system of Co impurities in bulk Cu and compare to continuous-time Monte Carlo
calculations. The accuracy of established bath discretization schemes is
assessed in the framework of the variational approach introduced here.
