# Identifying principal quantum numbers in natural population analysis

Following a Hartree-Fock calculation, I would like my program to perform some kind of Natural Bond Orbital (NBO) analysis. Preceding this I would like to output a list of atomic orbitals, along with their identity (i.e. 2$p$, 3$d$) and their occupancy. The occupancy is simply gathered from a population analysis:

$$occ_k = 2 \sum_{\mu\in k} (\bf DS \rm)_{\mu\mu}$$

Where $\bf D$ is the density matrix and $\bf S$ the overlap. Of course, the angular momentum of the relevant basis function provides us with the $s$, $p$, $d$, ... character. I understand that to find the principal quantum number $n$, and label a basis function as core, valence, or excited/Rydberg state, you can use the orbital energy (eigenvalues of the Fock matrix) and occupancy, along with some intuition.

My question is, does there exist some algorithm for this task which does not rely on such intuition? I have thought of using some method of 2-objective clustering of the occupancy and orbital energies, but this seems far to over the top for this task.