Constrained spin-density functional theory for excited magnetic configurations in an adiabatic approximation