Calculations of energy levels for atoms with several valence electrons