Quantum mechanics of atomic spectra and atomic structure