About This Code

This code generates coordinates in array sph for each of the 196560 neighbors of the central ball.

The global variable v illustrates much of what I dislike about C's scope notions; they encourage code like this. To write short fast code I resort to scattered mutation of v.

If the first if(0) in main is changed to if(1) then we compute the inner product of each pair of neighbors to the origin. We demand that for each neighbor the histogram of inner products agree. This is a fairly strong symmetry test and test of neighbor generation code.

Otherwise we do a Monte Carlo generation of maximal clumps which are clumps that are not a proper sub-clump. Here is the output. We report the coördintes for the first 20 clumps. We report the number of free choices available for adding each ball for the first 100 clumps. It is amusing to see how 24 balls each manage to be the right distance from each of the other balls.

In this Monte Carlo generation the probability of choosing a clump is proportional to its size because any of its balls was equally likely to be chosen as the seed clump. What goes for clumps also goes for lumps! The curious distribution of 1000 clump sizes is reported at the end:

 12    20
 15   284
 17   381
 23    85
 24   230