This script is an example implementation of the method suggested in US patent #5401921 (March 28, 1995) to calculate a two-dimensional primitive root diffuser. Enter your design frequencies at which the diffuser shall operate, and a desired size of the diffuser, based on a prime number P and a primitive root number of P. Note, that P-1 must have two coprime factors which are non-devisible into each other. For example, for P = 157, P-1 has the prime factors 2, 2, 3 and 13. A grid of for example 2*2*3=12 x 13 wells can then be applied (with the two coprime factors being 12 and 13). A "well" is defined as one building block and its height refers to the actual height of the block.
Updates (April 2nd, 2013):