  Lanthanide atoms and molecules are promising candidates for atomic data
storage and quantum logic due to the long magnetic lifetime of their electron
quantum states. Accessing these states through electrical transport requires
the engineering of their electronic configuration down to the level of
individual atomic orbitals. Here, we address the magnetism of surface-supported
lanthanide atoms, clusters, and films with orbital selectivity using X-ray
absorption spectroscopy and magnetic circular dichroism. We exploit the
selection rules of electric dipole transitions to reveal the occupation and
magnetism of the valence electrons of Gd and Ho deposited on MgO/Ag(100).
Comparing our results with multiplet calculations and density functional
theory, we identify a charge transfer mechanism that leaves the lanthanide
species in an unconventional singly ionized configuration. Our approach allows
determining the role of valence electrons on the quantum level structure of
lanthanide-based nanostructures.
