Weyl sums and atomic energy oscillations