[Numpy-discussion] huge array calculation speed
Sat Aug 30 21:12:20 CDT 2008
[ 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 <email@example.com> wrote:
> r2 = numpy.power(r2,2).sum(axis=1)
> r2 = numpy.extract(r2<cut2, r2)
> coord[i] = r2.shape-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)-
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.
More information about the Numpy-discussion