Constrained-random-phase approximation