The removal of spin contamination from unrestricted Hartree-Fock Møller-Plesset calculations is now recognized to be important. Here the Handy-Knowles formulation, previously presented, is studied. An evaluation of the energy and the energy gradient, for the removal of one- and two-spin contaminants, is described. The cost of the algorithm for the gradient is proportional to n2v3, where n and v are the number of occupied and virtual orbitals, respectively. Applications of this algorithm are presented for CN, Li3, and the abstraction of H from CH4. © 1990 American Institute of Physics.