[Numpy-discussion] huge array calculation speed
Fernando Perez
fperez.net@gmail....
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 <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
More information about the Numpy-discussion
mailing list