Since its discovery, the direct-methods origin-free modulus sum function S, originally denoted ZR by Rius [ Acta Cryst. (1993), A 49, 406–409], has been used for solving some relatively complex crystal structures from powder X-ray diffraction data. In these applications, phase refinement was normally carried out by maximizing the function S with a modified tangent formula. However, further progress in the powder diffraction field was hampered by the complexity of combining the tangent formula refinement that makes explicit use of triple-phase sums, with the introduction of constraints in real space necessary to counterbalance the information loss produced by peak overlap in powder diffraction. Recently, a considerably simpler and completely general phasing procedure (S-FFT) has been developed that maximizes S by means of the FFT algorithm and considers the triple-phase sums implicitly [Rius, Crespi & Torrelles (2007), Acta Cryst. A 63, 131–134]. As pointed out by the authors, this procedure could represent a source of progress in powder diffraction. Here, an algorithm combining the S-FFT procedure with real-space constraints according to the Shake-and-Bake philosophy [Weeks, de Titta, Miller & Hauptman (1993), Acta Cryst. D 49, 179–181] is given and its capability to treat powder diffraction data is proved with some realistic test structures. [ABSTRACT FROM AUTHOR]