A steepest-descent method for the calculation of localized orbitals and pseudoorbitals