**description:**Increases the number of particles in a particle input file by sampling a simplified distribution based the input file. Intended to be used to increase the number of particles produced by a photoinjector simulation to improve stability of CSR and LSC simulations. Can also add energy and density modulations for performing gain studies.The algorithm is as follows:

- Fit a 12-order polynomial to as a function of . Evaluate the polynomial at 10,000 equispaced points to generate a lookup table for the momentum variation with time.
- Compute the standard deviation of the momentum for blocks of 2,000 successive particles. Fit this data with a 12-order polynomial and evaluate it a 10,000 equispaced points to generate a lookup table for as a function of .
- Create a histogram of and smooth it with a low-pass filter having a cutoff at 0.1 THz. This may resulting in ringing at the ends of the histogram, which is clipped off by masking with the original histogram.
- Optionally modulate the histogram H(t) with a sinusoid, by multiplying the histogram by , where is the modulation depth and is the modulation wavelength. For non-zero , this will result in a longitudinal-density-modulated distribution when the histogram is used as a probability distribution and sampled to create time coordinates.
- Sample the time histogram times using a ``quiet start'' Halton sequence with radix 2, where is the number of desired particles. The sampling operation is performed by first numerically computing the cumulative distribution function . Inverting this to obtain , we generate each sample from by evaluating , where is a quantity on the interval [0, 1] generated from the Halton sequence.
- Create samples for other coordinates by quiet-sampling of gaussian distributions:
- Scaled transverse coordinates , , , and using Halton radices 3, 5, 7, and 11, respectively. For convenience in scaling (step 9), these are defined such that the standard deviation of each coordinate is and all coordinates are uncorrelated.
- Scaled fractional momentum deviation using Halton radix 13, with unit standard deviation.

- Interpolate the look-up tables to determine the mean and standard deviation of the momentum at each particle's time coordinate. Use these to compute the individual particle momenta using .
- Compute the projected transverse rms emittances and Twiss parameters for the original beam.
- Transform the scaled transverse phase-space coordinates to give the desired projected Twiss parameters in the x and y planes. The x and y planes are assumed to be uncorrelated.

**synopsis:**`smoothDist6 -input`*name*-output*name*-factor*number*-rippleAmplitude*%*-rippleWavelength*microns*-smoothPasses*num(500)*-energyMod*%*-betaSlices*n***files:**`input`-- A particle distribution file, such as might be used with`sdds_beam`

.`output`-- A particle distribution file, such as might be used with`sdds_beam`

.

**switches:**`-factor`-- Factor by which to multiply the number of particles.*number*`-rippleAmplitude`-- Density ripple amplitude, in percent.*value*`-energyMod`-- Energy modulation amplitude, in percent. The wavelength is fixed at 1 m.*value*`-rippleWavelength`-- Density ripple and energy modulation wavelength, in microns.*value*`-betaSlices`-- Number of longitudinal slices to use for analysis of twiss parameters. The twiss parameters of the beam will vary step-wise from slice to slice. This discontinuous variation may cause problems (e.g., unstable behavior).*n*`-smoothPases`-- Presently ignored.*num*

**author:**M. Borland, ANL/APS.**see also:**`doubleDist6`