![](https://secure.gravatar.com/avatar/95198572b00e5fbcd97fb5315215bf7a.jpg?s=120&d=mm&r=g)
[ Sorry I never sent this, I just found it in my drafts folder. Just in case it's useful to the OP, here it is. ] On Thu, Jul 10, 2008 at 9:38 AM, Dan Lussier <dtlussier@gmail.com> wrote:
r2 = numpy.power(r2,2).sum(axis=1)
r2 = numpy.extract(r2<cut2, r2) coord[i] = r2.shape[0]-1 r2 = numpy.extract(r2 != 0, r2) # avoid problems of inf when considering own atom. r2 = numpy.divide(1.0,r2) ljTotal[i] = numpy.multiply(2,(numpy.power(r2,6)- numpy.power(r2,3))).sum(axis=0)
That's a Lennard-Jones potential, and there seems to be a fair amount of work on FMM (fast multipole method) for that type of potential. Depending on what the final set of quantities you're after is, the FMM may be worth looking into. Cheers, f