Ionic terms in valence states