Abstract
A recursive algorithm for sampling properties of physical clusters such as size distribution and percolation is presented. The approach can be applied to any system with periodic boundary conditions, given a spatial definition of a cluster. We also introduce some modifications in the algorithm that increases the efficiency considerably if one is only interested in percolation analysis. The algorithm is implemented in Fortran 90 and is compared with a number of iterative algorithms. The recursive cluster identification algorithm is somewhat slower than the iterative methods at low volume fraction but is at least as fast at high densities. The percolation analysis, however, is considerably faster using recursion, for all systems studied. We also note that the CPU time using recursion is independent on the static allocation of arrays, whereas the iterative method strongly depends on the size of the initially allocated arrays.