Assigning oxidation states in compounds