  The total energies and the spin states for atoms and their first ions with Z
= 1-86 are calculated within the the local spin-density approximation (LSDA)
and the generalized-gradient approximation (GGA) to the exchange-correlation
(xc) energy in density-functional theory. Atoms and ions for which the
ground-state density is not pure-state v-representable, are treated as ensemble
v- representable with fractional occupations of the Kohn-Sham system. A newly
developed algorithm which searches over ensemble v-representable densities [E.
Kraisler et al., Phys. Rev. A 80, 032115 (2009)] is employed in calculations.
It is found that for many atoms the ionization energies obtained with the GGA
are only modestly improved with respect to experimental data, as compared to
the LSDA. However, even in those groups of atoms where the improvement is
systematic, there remains a non-negligible difference with respect to the
experiment. The ab-initio electronic configuration in the Kohn-Sham reference
system does not always equal the configuration obtained from the spectroscopic
term within the independent-electron approximation. It was shown that use of
the latter configuration can prevent the energy-minimization process from
converging to the global minimum, e.g. in lanthanides. The spin values
calculated ab-initio fit the experiment for most atoms and are almost
unaffected by the choice of the xc-functional. Among the systems with
incorrectly obtained spin there exist some cases (e.g. V, Pt) for which the
result is found to be stable with respect to small variations in the
xc-approximation. These findings suggest a necessity for a significant
modification of the exchange-correlation functional, probably of a non-local
nature, to accurately describe such systems. PACS numbers: 31.15.A
