  The progress of a multiple bunches of electrons through several thousand
accelerator structures results in a wakefield which if left unchecked will kick
successive bunches off the axis of the accelerator and can at the very least
dilute the final luminosity of the final colliding beams, or at worst can lead
to a BBU (Beam Break Up) instability. In order to damp the wakefields to
acceptable levels for travelling wave structures we detune the frequencies of
the cells and we couple out the field to four adjacent manifolds. Optimizing
the manifold-cell coupling for several hundred cells and changing the bandwidth
parameters of the distribution has in previous structures been achieved by a
process of trial and error. Here, we report on an optimized Fortran code that
has been specifically written with the aim minimizing the sum of the squares of
the RMS and standard deviation of the sum wakefield. Sparse matrix techniques
are employed to reduce the computational time required for each frequency step.
The wakefield is minimized whilst ensuring that no significant local surface
heating occurs due to slots cuts into the accelerator cells to couple out the
wakefield.
