# A Cost Optimal Parallel Algorithm for Computing Force Field in N-Body Simulations

## Abstract

We consider the following force field computation problem: given a cluster of *n* particles in 3-dimensional space, compute the force exerted on each particle by the other particles. Depending on different applications, the pairwise interaction could be either gravitational or Lennard-Jones. In both cases, the force between two particles vanishes as the distance between them approaches to infinity. Since there are *n*(*n*−1)/2 pairs, direct method requires *Θ*(*n* ^{2}) time for force-evaluation, which is very expensive for astronomical simulations. In 1985 and 1986, two famous *Θ*(*n* log *n*) time hierarchical tree algorithms were published by Appel [3] and by Barnes and Hut [4] respectively. In a recent paper, we presented a linear time algorithm which builds the oct tree bottom-up and showed that Appel’s algorithm can be implemented in *Θ*(*n*) sequential time. In this paper, we present an algorithm which computes the force field in *Θ*(log *n*) time using an _{n} ^{ log n } processor CREWPR AM. A key to this optimal parallel algorithm is replacing a recursive top-down force calculation procedure of Appel by an equivalent non-recursive bottom-up procedure. Our parallel algorithm also yields a new *Θ*(*n*) time sequential algorithm for force field computation.

## Keywords

Paralle algorithms spatial tree data structures force field evaluation N-body simulations PRAM cost optimal algorithms## Preview

Unable to display preview. Download preview PDF.

## References

- 1.S. Aluru, Greengard’s n-body algorithm is not
*O*(*n*),*SIAM Journal on Scientific Computing*, Vol. 17(1996), pp. 773–776.zbMATHCrossRefMathSciNetGoogle Scholar - 2.R.J. Anderson, Tree data structures for N-body simulation,
*37th Annual Symposium of Foundations of Computer Science*, IEEE(1996):224–233.Google Scholar - 3.A.W. Appel, An efficient program for many-body simulation,
*SIAM Journal on Scientific and Statistical Computing*, 6 (1985):85–103.CrossRefMathSciNetGoogle Scholar - 4.J. Barnes and P. Hut, A hierarchical
*O*(*n*log*n*) force-calculation algorithm,*Nature*, 324(1986):446–449.CrossRefGoogle Scholar - 5.P.B. Callahan and S.R. Kosaraju, A decomposition of multidimensional point sets with applications to
*k*-nearest-neighbors and*n*-body potential fields,*Journal of the ACM*, 42(1995):67–90.zbMATHCrossRefMathSciNetGoogle Scholar - 6.K. Esselink, The order of Appel’s algorithm,
*Information Processing Letters*, 41(1992):141–147.zbMATHCrossRefGoogle Scholar - 7.A. Grama, V. Kumar and A. Sameh, Scalable parallel formulations of the Barnes-Hut method for n-body simulations, In
*Supercomputing’94 Proceedings*, 1994.Google Scholar - 8.L. Greengard and V. Rokhlin, A fast algorithm for particle simulations,
*Journal of Computational Physics*, 73(1987):325–348.zbMATHCrossRefMathSciNetGoogle Scholar - 9.L. Greengard,
*The rapid evaluation of potential fields in particle systems*, The MIT Press, 1988.Google Scholar - 10.L. Greengard, Fast algorithms for classical physics,
*Science*, 265(1994):909–914.CrossRefMathSciNetGoogle Scholar - 11.V. Kumar, A. Grama, A. Gupta and G. Karypis,
*Introduction to Parallel Computing: Design and Analysis of Algorithms*, The Benjamin/Cummings Publishing Company, Inc. 1994.Google Scholar - 12.J. Singh, C. Holt, T. Totsuka, A. Gupta, and J. Hennessy, Load balancing and data locality in hierarchical n-body methods,
*Journal of Parallel and Distributed Computing*, 1994.Google Scholar - 13.M. Warren and J. Salmon, Astrophysical n-body simulations using hierarchical tree data structures, In
*Supercomputing’92 Proceedings*, 1992.Google Scholar - 14.M. Warren and J. Salmon, A parallel hashed oct tree n-body algorithm, In
*Supercomputing’ 93 Proceedings*, 1993.Google Scholar - 15.G.L. Xue, Minimum inter-particle distance at global minimizers of Lennard-Jones clusters,
*Journal of Global Optimization*, Vol. 11(1997):83–90.zbMATHCrossRefGoogle Scholar - 16.G.L. Xue, An
*O*(*n*) time algorithm for computing force field in*n*-body simulations,*Theoretical Computer Science*, Vol. 197(1998), pp. 157–169.zbMATHCrossRefMathSciNetGoogle Scholar - 17.F. Zhao and S.L. Johnson, The parallel multipole method on the connection machine,
*SIAM Journal of Scientific and Statistical Computing*, Vol. 12(1991), pp. 1420–1437.zbMATHCrossRefGoogle Scholar