def writeDensity(temp, model):
    """Main collider densities."""
    temp.append('void density(double x, double y,')
    temp.append('double z, double *density) {\n\n')
    for i, val in enumerate(model.rescaledens):
        temp.append('\tdensity[%d] = %.2f *' % (i, val))
        temp.append(' findvalue(x, y, z, dens);\n')
        temp.append('\tif (density[%d] < 1e3)' % i)
        temp.append(' {\n\t\tdensity[%d] = 1e3;\n\t}\n\n' % i)
    temp.append('}\n\n\n')
    return
