We propose a unique scheme to construct fully optimized atomic basis sets for
density-functional calculations. The shapes of the radial functions are
optimized by minimizing the {\it spillage} of the wave functions between the
atomic orbital calculations and the converged plane wave calculations for dimer
systems. The quality of the bases can be systematically improved by increasing
the size of the bases within the same framework. The scheme is easy to
implement and very flexible. We have done extensive tests of this scheme for
wide variety of systems. The results show that the obtained atomic basis sets
are very satisfactory for both accuracy and transferability