  We present a new formulation of monotonically convergent algorithms which
allows to optimize both the control duration and the field fluence. A standard
algorithm designs a control field of fixed duration which both brings the
system close to the target state and minimizes its fluence, whereas here we
include in addition the optimization of the duration in the cost functional. We
apply this new algorithm to the control of spin systems in Nuclear Magnetic
Resonance. We show how to implement CNOT gates in systems of two and four
coupled spins.
