Abstract
We present a numerical method to efficiently and accurately re-compute the Coulomb potential of a large ensemble of charged particles after a subset of the particles undergoes a change of position. Errors are bounded even after a large number of such shifts, making it practical for use in Monte Carlo Markov chain methods in molecular dynamics, computational astrophysics, computational chemistry, and other applications. The method uses truncated multipole expansions of the potential energy functional and a tree decomposition of the computational domain to reduce the computational complexity. Computational costs scale logarithmically in the size of the problem. Scaling, accuracy, and efficiency are confirmed with numerical experiments. The new method outperforms a direct calculation for moderate problem sizes.
Keywords: fast multipole method, molecular dynamics, Laplace equation, potential theory, N-body problem
AMS subject classifications: 35J05, 35Q60, 65E05, 68W25, 70F10, 78M16, 92C40, 92E10
1. Introduction.
In this paper we introduce a new multipole-based method for computing the potential energy functional of a large ensemble of particles when one or more of the particles undergoes a change of position. We focus on the Coulomb potential as a model problem in electrostatics. Given a collection of particles with real-valued charges {q1, … , qN} at locations {x1, … , xN} in a domain , the Coulomb potential at xi is
| (1) |
where x = ⟨x1, … , xN⟩ and ∣·∣ denotes Euclidean distance. The potential energy functional of the ensemble is then
| (2) |
where q = ⟨q1, … , qN⟩ and we note that the double summation has N(N − 1)/2 unique terms. Direct evaluation of (2) requires operations.
If a subset of k particles undergoes a change in position then the potential of the ensemble changes. Letting denote the vector containing all positions including changes, we seek to compute efficiently. By expressing the potential in terms of a multipole expansion, decomposing the domain D using an octree structure, and re-using information from the multipole-based computation of V(x, q), the method described below evaluates the new potential energy functional in time. Evaluating the new potential energy functional using a direct calculation requires computation time.
Note that the gravitational potential is of the same form as the Coulomb potential, with charges q replaced by particle masses m; it may be treated in identical fashion as the work presented here.
The method described here has application to problems in applied mathematics, biology, chemistry, and physics. Evaluation of an updated potential energy functional is of use in varied applications including molecular dynamics simulations [8, 20] for protein folding [1, 18], chemical dynamics [34], biomolecules [19, 32], and biological cell membrane dynamics [29]; gravitational interactions in large-scale astrophysics simulations [9]; and computational drug discovery [17, 33].
The computational challenge that motivated this work is quantification of the properties of two-phase fluid systems by chemical Monte Carlo simulation [10, 30]. The Metropolis-Hastings algorithm (see, for example, [27]), used for this purpose, involves frequent updates of molecular configurations structured so that each new configuration involves position changes for relatively few charges. For large systems, update of the potential energy functional at a complexity of for the naive method dominates the computational cost of the update: it is this cost we reduce to .
For molecular or astrophysical dynamics, accurate temporal integrations are governed by time steps limited by the smallest spatial separations among sources (charges or masses) which, correspondingly, may have highly localized coupling and evolution. Under standard methods, however, the trajectories of well-separated sources are also updated at this unnecessarily high rate, potentially entailing prohibitive computational cost. The algorithm of this paper, with further elaboration, could enable a time evolution scheme in which sources would have their trajectories updated at rates that depend on their separations.
The fast multipole method (FMM) was developed beginning in the 1980s [4, 7, 14, 16, 31]; it can be used to evaluate sums of the form (2) in time. Independently, tree codes [2] were developed which evaluate (2) in time. We do not attempt to give a complete description of the FMM here, though we introduce elements of the method in section 2. See [3, 25] for further details on the FMM. Among recent developments in fast multipole methods are kernel-independent methods [24, 35]; parallel codes using GPUs [36], multicore processors [5], and heterogeneous architectures [21]; and volume integral methods [23].
The FMM framework can be used to construct solvers for elliptic PDEs and integral equations; a different approach to the construction of fast algorithms for integral equations involves skeletonization [6, 22], or interpolative decomposition, for the operator or, especially, a factorization of its inverse [11, 26], which offers some advantages over particle methods for these problems. These methods, however, are limited to problems which originate with integral operators, rather than particles, and currently are implemented in two dimensions. This paper provides a fundamental advance for particle methods, implemented in three dimensions.
The paper is organized as follows. In section 2 we provide an overview of the multipole expansion and related formulas. Section 3 describes the new multipole-based potential energy functional updating algorithm. We present numerical results in section 4. Finally, in section 5 we summarize the present work and discuss directions for future work.
2. Mathematical preliminaries.
In subsection 2.1 we derive an expression for the potential energy functional following a shift of k particles. Subsections 2.2, 2.3, 2.4 and 2.5 provide background from the fast multipole method that will be used in section 3. For more details on the background material presented in subsections 2.2 to 2.5, the interested reader is referred to [16] and the references therein.
2.1. Problem formulation.
We consider an ensemble of N particles, indexed {1, … , N}. The particle indexed by i has charge and is located at . The potential at xi due to the other N − 1 charges is given by Φi(x) (1), and the potential energy functional of the ensemble is given by V(x, q) (2). If the i-th particle shifts we let denote its changed position. If k particles undergo a shift we let denote the indices of particles that shift, and denote the indices of particles that remain unchanged. Then the full position vector, as changed, is
| (3) |
We also let denote the vector containing just the k shifted positions, the vector of their k original positions, and the vector of the k charge values. Now, if particles in a subset move, as in an MCMC simulation, we wish to compute the potential energy functional of the new configuration.
The new functional is
| (4) |
Many of the terms in (4) are redundant with (2). Now we adopt the perspective that to compute Vnew from the pre-shift functional Vold we remove k particles from the ensemble, and subtract their contribution to the functional V. Then we introduce k particles (at the new locations ) and add their contribution to the functional.
To arrive at an expression of the form Vnew = Vold−{potential due to charges at old position}+{potential due to charges at new position} we add and subtract terms to (4) and re-arrange to match this form. We begin with
| (5) |
where the first line is zero, the second line is the new potential, and the third line is zero as well. Combining the first sum on line one with the third sum on line three, and the first sum on line two with the first sum on line three, we obtain
| (6) |
where the last line can be simplified further. We expand the Φ terms in the last line according to (1) to write them as
| (7) |
and we see that the middle term from the first line and the middle term from the second line cancel. Expanding the first and last terms of this expression
| (8) |
the only surviving terms are the fourth term of (7) and the first term of the expanded (8). The simplified expression for the last line of (6) is then
| (9) |
where we have returned to using Φ for compactness. A major benefit of this expression is that these terms involve only the k particles being shifted, not the full ensemble of N particles. This, along with a multipole expansion and tree structure, will allow our updating method to be of complexity less than .
Now we can write the new potential energy functional of the ensemble in the desired form:
| (10) |
The form of (10) has a natural interpretation: the change in potential is due to simultaneous removal of particles, inclusion of particles at the new locations, and “correction” terms of the potential energy due to interactions among the particles being shifted.
If only one particle, with index ℓ, is moved then (10) simplifies to
| (11) |
where we have written to indicate replaces xℓ in x. Successive application of (11) is equivalent to (10).
In the remainder of this section, we review formulae, error bounds, and algorithms from the FMM that will be needed in defining and analyzing our updating multipole method.
2.2. Multipole expansion.
Any harmonic function Φ can be expanded as
| (12) |
where are the spherical harmonics obtained by solving Laplace’s equation via separation of variables in spherical coordinates (r, θ, ϕ). The terms are called the multipoles and the coefficients the moments of the expansion. In this work we will only be concerned with convergence outside a small region about r = 0 and thus to ensure decay to zero as r → ∞. In the FMM, the terms (the local expansion) are used for fast evaluation at each location; conversion from multipole to local expansions is at the heart of the FMM.
We define the spherical harmonics of degree n and order m as
| (13) |
where i2 = −1 and are associated Legendre functions. The latter may be defined using Rodrigues’ formula
| (14) |
where Pn(x) is the Legendre polynomial of degree n. Notice that we have omitted from the spherical harmonics a normalization factor . Since the potential (1) is harmonic, we express, and compute, potentials using multipole expansions.
2.3. Truncated multipole representation.
We will divide the domain D into subdomains each containing s ⪡ N charges. For a charge indexed i, sufficiently far away from the subdomain, we will evaluate the potential at xi due to all charges in the subdomain. We wish to aggregate the potential due to these charges into a single multipole representation and truncate the series to a finite number of terms. The following theorem (see [7, 13, 15, 16]), derived from an addition theorem for Legendre polynomials, provides a formula for the coefficients for the desired aggregate potential and provides an error bound for the truncation.
Theorem 1 ([7, Theorem 2.1]). Suppose N charges q1, … , qN at locations x1, … , xN with spherical coordinates (ρ1, α1, β1), … , (ρN, αN, βN) have ρi < a, for i = 1, … , N. That is, N charges lie inside a sphere of radius a centered at the origin. Then, for x = (r, θ, ϕ) with r > a, the potential is
| (15) |
where
| (16) |
Furthermore, for p ≥ 1,
| (17) |
That is, we may evaluate the potential at a point outside the sphere of radius a using a single multipole expansion for all N charges inside the sphere with aggregated coefficients (the aggregation represents superposition of the potential fields). Truncation of the expansion to order p (i.e. retaining (p + 1)2 terms) results in an error proportional to the total charge and, for fixed distance from the sphere, decreasing with increasing order p. Notice that the error becomes large as r → a; we will use this representation to evaluate the potential in subdomains well-separated from the domain containing the charges.
2.4. Translation of a multipole expansion.
Fast multipole methods rely on a hierarchical decomposition of the domain D into an octree structure. At each level ℓ of the tree, the domain is composed of 8ℓ subdomains. It will be useful to store multipole expansions in each subdomain at each level of the tree. We will want to translate the center of expansions from the center of a subdomain at level ℓ to the center of a subdomain at level ℓ − 1. Indeed, translation of multipole expansions is a core part of fast multipole methods.
Theorem 2 ([7, Theorem 2.3]). Suppose we have a multipole expansion with coefficients for the potential due to charges q1, … , qN at locations x1, … , xN inside the sphere of radius a with center x0 having spherical coordinates (ρ0, α0, β0). Let x be a point outside the sphere of radius a + ρ0 centered at the origin1, and let (r′, θ′, ϕ′) be the spherical coordinates of the vector x − x0. Then by (15),
| (18) |
is the potential at x with multipole expansion centered at x0.
The multipole expansion centered at the origin for x = (r, θ, ϕ) with r > a + ρ0 is
| (19) |
where
| (20) |
and
| (21) |
Furthermore, for p ≥ 1,
| (22) |
The multipole translation theorem allows us to move a multipole expansion’s center from x0 to the origin while maintaining a bound on the approximation error for a truncated expansion. Indeed, we may now move an expansion from center x0 to any other point.
The multipole translation formula (20) defines a linear operator TMM mapping the coefficients to the coefficients . The cost of applying TMM is since it maps (p + 1)2 coefficients via a dense (p + 1)2 × (p + 1)2 matrix. The cost of translation can be reduced by rotating the coordinate system with a rotation Ω to align the direction of translation with the z-axis, at a cost of . Translation along the z-axis is then diagonal, or . Rotating back to the original coordinate system requires the rotation Ω−1 and an additional . Denoting rotation by R(·) and translation along the z-axis by we have which in this form is applied at a cost of . For details and formulae we refer the interested reader to [7]. Below, in subsection 3.2.1, we note that to update the potential energy functional, it may be more efficient to re-compute the coefficients for the multipole expansion using (16), which requires operations for each particle, than to use a translation operator.
2.5. The fast multipole method.
Here we briefly describe the classical FMM for evaluating the potential energy functional of a collection of charges. For a more complete description of the FMM, including asymptotic analysis of operation costs, see [7].
The FMM relies on hierarchical decomposition of the computational domain into an octree (either fixed or adaptive), multipole representation of the potential along with translation operators for multipole coefficients, conversion to expansions which converge locally rather than in the far-field, and translation of local expansion coefficients.
Some data structures are required to keep track of interactions between subdomains of the full computational domain. The desired number of particles per box at the leaf level of the octree is chosen by the user. This determines the number of boxes at the leaf level and therefore the number of levels L. The computational domain is recursively subdivided into eight children until the leaf level is reached. The whole domain is labeled level 0 and each successive subdivision increments the level number. The child of a box refers to that box as its parent, and the sequence of parents containing a leaf box is that box’s lineage.
Each leaf box forms a list of the particles residing in that box. Every box in the tree (except at levels 0 and 1) forms two additional lists: its neighbors and its interaction list. Two boxes are neighbors (or nearest neighbors) if they are at the same level of the tree and share a boundary point. The neighbor list of a box b is denoted Nbhd(b). In two dimensions (i.e. in a quadtree) a typical box has nine neighbors including itself. In an octree a typical box has 33 = 27 neighbors including itself. Boxes at a boundary of the domain have fewer than 27 neighbors. Two boxes are well-separated if they are at the same level of the tree and are not nearest neighbors. The interaction list of a box b, Intlist(b), is the set of well-separated boxes which are children of b’s parent’s neighbors. In an octree the interaction list for a typical box contains (2 · 3)3 − 33 = 189 boxes. The interaction lists at levels 0 and 1 are empty.
The fast multipole algorithm consists of an upward pass through the octree followed by a downward pass. The final step evaluates the potential at each particle.
In the upward pass, multipole expansions are computed and stored at each box in the tree. First for each leaf-level box, at level ℓ = L, one forms the truncated multipole expansion (15) for the collection of charges in that box. At level l − 1 each box b translates the expansion of its eight children via TMM to the center of b and adds these expansion coefficients. The result is a multipole expansion representing all charges below box b in the tree. This process repeats recursively up to ℓ = 2, completing the upward pass.
The downward pass converts multipole (far-field) expansions to local expansions and passes these down the tree. Three theorems similar to Theorem 1 and Theorem 2 establish (1) a truncated expansion of the form (12) with which converges inside a box well-separated from the collection of charges, (2) a linear operator TML which converts the multipole expansion coefficients in a box b1 to the local expansion coefficients for a box b2 provided the boxes b1 and b2 are well-separated, and (3) a linear operator TLL to translate the center of a local expansion. First the downward pass converts all multipole expansions to local expansions. Each box in the tree uses TML to convert the multipole expansion from each box in its interaction list to a local expansion, summing the converted expansions. Then, beginning at level l = 2 the downward pass uses TLL to translate the local expansion from each box at level l to each box’s eight children, where the parent coefficients are added to the coefficients from multipole-to-local conversion. This proceeds recursively down to the leaf level. At the end of the downward pass, the leaf boxes have a locally-converging expansion for the potential due to well-separated boxes.
Finally, the potential is evaluated at each particle. The local expansion is evaluated at the particle location, and the direct expression (1) is evaluated for all particles xj in the neighbor list of the box in which the particle resides. Summed over all particles, this is the value of the potential energy functional of the ensemble.
Note that following application of TML, all multipole coefficients may be discarded as the remainder of the method no longer requires them. In the updating method we will retain these throughout as we will use the multipole expansion to evaluate the potential instead of the local expansion.
3. Updating multipole method.
In this section we describe in detail our algorithm for computing the potential energy functional following a shift via (10).
3.1. Data structures.
Several modifications and additions to the data structures for the FMM are necessary to adapt it to the updating multipole method: (i) the list of particles in each leaf-level box must be dynamically updated as shifts may cause particles to cross box boundaries; (ii) the moments (multipole expansion coefficients) for each particle are stored, not only the coefficients for each box.
While (ii) is not necessary, storing each particle’s coefficients avoids re-computing them when removing the particle from the data structure in a delete-insert shift (see below for details). This amounts to a storage-computation tradeoff. In the FMM, once each particle’s moments have been added to its box’s aggregate coefficients the particle moments are no longer needed and thus may be discarded.
3.2. Update.
To shift k particles we mirror the form of (10): We delete the k particles from the data structures, subtract the potential due to these particles from the total, insert k particles at the new locations into the data structures, and add the potential due to these particles to the potential energy functional. The two sets of pre- and post-shift terms in (10) differ only by the locations and sign in front of the summations. Thus, removal of particles is equivalent to introduction of particles with the opposite charge . We describe introduction of particles in detail.
For convenience we re-write (10) as
| (23) |
where
| (24) |
and
| (25) |
The second term in ΔVins (and in ΔVdel) involves only the shifted particles, and in most cases these will all be in each others’ neighborhood. Therefore we compute this term via the direct method, with a cost of k(k − 1) operations. The first term requires both multipole-interaction evaluation and direct-interaction evaluation. The main difference in this term between ΔVins and ΔVdel is the location at which the multipoles are evaluated, versus .
3.2.1. Insert.
The following steps are required for introducing a group of particles: insert the particles’ information into the data structures; evaluate the change in the potential energy functional due to these particles, ΔVins, and add this change to the potential energy functional of the entire configuration; and update the multipole coefficients of every box in each particles’ lineage, from leaf-level up to level 2.
To insert particles to the data structures, we determine the boxes in which they will reside, and append the particles’ indices to the list of indices for that box. For each particle, the box in which it resides can be stored to reduce on-the-fly calculations. Since there is no restriction that a group of particles must respect box boundaries, it is possible that particles from a group reside in several different boxes, and therefore our method must account for the most general case.
To evaluate the change in the potential energy functional ΔVins we compute, for each new particle indexed i, the potential at its location xi due to all particles in boxes in the interaction lists of the particle’s lineage via the corresponding box-aggregated multipole representations, and the potential at xi due to all particles in its neighborhood via the direct formula. The ‘correction’ term we then evaluate using the direct formula.
To update the multipole coefficients in the leaf-level box, we use the property of superposition of potentials or equivalently the addition property of multipole expansions. For simplicity, consider the case where all new particles reside in a single leaf-level box, labeled bL. We will consider exceptions to this scenario in subsection 3.2.2. To update the multipole coefficients of the leaf-level box, we compute the multipole coefficients of each newly-inserted particle i, taking the center of the leaf-level box as the center of the expansion. Then each particle’s multipole coefficients may be added to the coefficients of the box bL so that the box’s coefficients represent the potential due to all particles now in the box, both those previously in the box and those newly added. That is, for n = 1, … , p and m = −n, n for each n, where the are computed via (16). Since it is convenient to store the coefficients of each particle, we compute them for each particle separately using (16) with N = 1 rather than for all k new particles at once with N = k. We also temporarily store the aggregate coefficients for the new particles to use in updating the remainder of the tree.
Now that the leaf-level box bL has been updated we traverse the octree up from level ℓ = L to ℓ = 2 and update the multipole coefficients in each box of b’s lineage. That is, given a box b at level ℓ and its parent at level ℓ − 1, we re-express the multipole coefficients due to the shifted particles, , centered about the midpoint of box b, so that they are centered about the midpoint of box . Then we may add them to ’s stored coefficients. Following this step, ’s multipole coefficients will have been updated to include the effect of the new particles. Performing this translation of multipole coefficients traversing up bL’s lineage completes the update of multipole coefficients due to the introduction of new particles. Since the octree has L levels this step consists of L − 2 multipole-to-multipole translations. We choose L ~ log N so this step consists of translations, and is what drives the asymptotic complexity of the multipole updating method.
To perform each translation, we have three methods from which to choose: (i) apply the multipole-to-multipole linear operator TMM requiring operations, (ii) apply the rotation-based TMM operator requiring operations, or (iii) compute, for each of the k new particles, the multipole coefficients using (16) with the locations of the new particles and center of expansion the midpoint of box requiring operations. Our choice of which method to use depends on k, the constants in the complexity, and implementation-specific details. In our implementation, (i) is always slowest, and (iii) is fastest for small k while (ii) is fastest for large k and N.
3.2.2. Special cases.
If the new particles reside in multiple leaf-level boxes then the above procedure for updating the multipole storage in the octree using TMM requires modification: separate multipole translations are required for each box. Separate translations continue to be necessary at each level until one reaches a level where the multiple leaf-level boxes share a common ancestor. The worst-case scenario, where leaf-level boxes share no common ancestor until the entire computational domain, is possible even when the leaf-level boxes are adjacent. For example, consider eight particles with one in each of the eight leaf-level boxes with one corner at the center of the computational domain. That is, even if one takes care to only move tightly-clustered groups of k particles, translations may be necessary.
It is possible to encounter the scenario where a new particle is introduced in each of the 8L leaf-level boxes, but since L ~ log8 N we reject this case as not a practical operating condition, and certainly one to be avoided if possible. In this case 64(1 − 8L)/7 translations are required; this is a tight upper bound though the upper bound is much lower in practice.
3.2.3. Group-wise shift versus individual shifts.
The choice of method for propagating multipole coefficients up the octree amounts to a choice between updating the multipole representation of the collection of particles in a group-wise versus individual particle fashion.
The rotation-based TMM can operate on the aggregate multipole coefficients for all newly-introduced particles together. For simplicity of discussion, let us assume that all k new particles reside in a single leaf-level box. Each of the (p + 1)2 leaf-level coefficients require summing k spherical harmonics, each evaluated at a point, for a total of operations. Updating the multipole coefficients for all boxes in the leaf-level box’s lineage requires L − 2 translations, each of which costs operations. The total for updating the multipole storage of k new particles is then on the order of kp2 + (L − 2)p3.
Computing multipole coefficients for each particle about the center of each box in the leaf-level box’s lineage requires computing (16) L − 1 times, for a total of operations.
We expect the constant for group-wise rotation-based translation is smaller than the constant for individual translation. We have implemented both methods and comment on the results of numerical experiments below in section 4, offering guidelines for circumstances for use of each method.
3.3. Initialization.
Prior to shifting k particles we must have computed the potential energy functional of the collection and stored multipole coefficients in the tree structure. This initialization step can be carried out either via an FMM modified to store otherwise discarded information or via repeated application of particle insertion beginning with an empty tree structure. If using an existing FMM code, one must store the multipole coefficients for each box; all local expansion coefficients may be discarded as they are not used in our updating method. At complexity this is the faster of the two methods but it requires additional code. A simpler method is to begin with an empty collection of particles: all box multipole coefficients are set to zero and total potential is zero. Then one introduces each of the N particles with the insertion method described above, either one-at-a-time or in groups of k. The complexity is worse, at and may be impractical for large N but the additional code is minimal.
3.4. Error bound.
We now show that the updating multipole method introduced above has an error bound which does not increase with repeated shifts.
The error in any multipole method is controlled by choice of p. For fast multipole methods the worst-case error in the truncated multipole expansion is a good indicator of the global error [25]. That is, the error in the multipole ensemble potential Vp, ∣Vp − V∣, is similar to the the worst-case of (17). In three dimensions (17) decays as . Thus, given a desired accuracy ϵ a heuristic choice is [3].
Theorem 3. Consider an ensemble of particles with real-valued charges q = ⟨q1, … , qN⟩ at locations x = ⟨x1, … , xN⟩ in a domain . Denote by the potential (1) computed using a p-moment multipole expansion (17). Let Vold = V(x, q) be the potential energy functional (2) of the ensemble and let be the same quantity computed using p-moment expansions . Let a bound ϵ > 0 on the error in the p-moment multipole approximation to the total potential of an arbitrary ensemble be given. That is,
| (26) |
Following a k-particle shift, , denote by the new potential energy functional (4). Let the new multipole potential energy functional be computed using (10) where the multipole potentials are used throughout.
Then the bound on the error in the p-moment multipole approximation to the potential energy functional remains
| (27) |
Proof. If we have a bound ϵ on the error ∣Vp − V∣ for an arbitrary ensemble, then it holds for both (x, q) and (, q). That is, the bound on the error remains the same for as it is for x. □
Remark 4. By Theorem 3 we have an upper bound on the error in the total potential due to the updating multipole method which does not change following a k-particle shift. That is, errors do not accumulate following shifts.
3.5. Algorithm.
Here we present formal descriptions of the insertion, potential evaluation, and update algorithms. The first, Algorithm 1, is a high-level routine for moving k particles. It requires the data structures described in subsection 3.1 and the new particles’ positions; it returns the change in potential due to the particle shift, and as a side effect updates the data structures. Algorithm 2 evaluates and returns the potential at particle i. Algorithm 3 inserts k particles and performs the data structure updates of multipole expansions. It requires the new locations and charges of the particles along with the data structures.
| Algorithm 1 Move k particles from xs to xs: update | |
|---|---|
| Algorithm 2 Evaluate Φi(x), the potential at xi: evalpot | |
|---|---|
| Algorithm 3 Introduce k particles: insert | |
|---|---|
3.6. Complexity analysis.
Direct evaluation of the potentials in (10) requires 2(k(N − k) + k(k − 1)/2) + 2k(k − 1)/2 = 2k(N − 1) unique terms; no data structure updates are needed. Thus the direct method’s complexity is for fixed k.
The cost of the updating multipole algorithm for a k-particle shift is the cost of evaluating the change in the potential energy functional plus the cost of updating the stored multipole coefficients. By (10), evaluating the change in the potential energy functional requires 2k times the cost of evaluating Φi (or equivalently ) plus 2k times the cost of evaluating the potential among k particles. The latter is computed using the direct summation expression (1) with cost k(k − 1)/2. The former has two components: (i) multipole evaluations from the interaction list at all levels, which costs 189(L − 1)(p + 1)2 operations, and (ii) direct evaluation of interactions with neighbor boxes, which costs 27s operations where s is the number of particles per box at the leaf level. Updating the stored multipole coefficients costs kp2 + (L − 2)p3 for group-wise update or (L − 1)kp2 for individual update.
The total cost is then approximately
| (28) |
where we have assumed rotation-based group-wise update. Since L ~ log N, we have on the order of
| (29) |
operations per update. For individual update, the corresponding expression is
| (30) |
We use a heuristic choice of s independent of N; see section 4 for further information regarding choice of s in practice. Thus for fixed p, k, and s, the method scales logarithmically in the number of particles N.
For highly nonuniform distributions of particles, it can be advantageous to use an adaptive octree. Since the depth L of an adaptive tree is not known a priori, the assumption L ~ log N no longer holds and we do not know the number T of multipole translations in the updating method. The number of upward pass translations in an adaptive tree for the FMM is bounded by 2B where B is the number of leaf-level boxes [28]. One aims to have approximately s > p particles per box, so B ≈ N/s and we have at most 2N/s upward pass translations. We expect the multipole coefficient updating step to require much less than the full FMM up-pass step. Thus in non-pathological cases T < N and the estimates (29) and (30) remain sub-linear in N.
4. Numerical results.
In this section we present the results of numerical experiments using our updating multipole method.
4.1. Numerical experiment set-up.
We implemented the updating multipole algorithm in Fortran 90. Numerical experiments were performed on a desktop computer with two 3.7GHz quad-core CPUs and 32GB of memory. We use subroutines from [12] to compute multipole coefficients, evaluate multipole expansions, and to compute and apply the rotation-based translation operator TMM.
For experiments with k = 1, that is with non-grouped individual particles, charges are distributed uniformly throughout the domain D, for which we use the unit cube D = [0, 1]3. For k > 1, charges are distributed as follows. Each group is uniformly distributed in a small cube with side 1/100-th the width of a leaf-level box. The center of the group’s cube is uniformly distributed over the domain. This distribution of groups mimics, for example, molecules in solution. Charge values q are distributed uniformly in the interval [0, 1). To compute the initial potential, we use the insert routine of Algorithm 3 rather than a full FMM. This imposes a speed cost but avoids the code complexity of a modifying a full FMM to store multipole coefficients. To choose the number of levels L in the octree we use a heuristic on the average number of particles per leaf-level box. More particles per box provides greater compression into the (p + 1)2 coefficients of the multipole expansion but comes at the cost of increased direct interactions with particles in neighbor boxes. In practice this trade-off may be application- and implementation-dependent. We limit the number of particles per leaf-level box to s = 350, so L = ⌈log8 (N/s)⌉ where ⌈·⌉ indicates the ceiling function which returns the smallest integer larger than the argument. Note that the choice of s is independent of N, so the asymptotic scaling is still as discussed in subsection 3.6. In our implementation and numerical experiments we do not observe a dependence on p or k in this heuristic. Compared to the full FMM we observe a change in the balance of multipole and direct calculations in the direction of larger s, smaller L, and more direct calculations.
Once the initial potential energy functional has been computed, we conduct 1000 shifts as follows. A particle (k = 1) or group (k > 1) is chosen at random. Each component of a shift vector Δx is drawn from a uniform random distribution, scaled to be at most 1/500-th the width of a leaf-level box. Each particle in the group is moved by the vector Δx. The total number of shifted particles is 1000 · k. For simplicity, intra-group shifts are not included. These shifts mimic, for example, the types of shifts that would occur in an MCMC simulation of molecules in solution; the application setting determines the shift vectors. For these experiments, the maximal shift size and group cube size are chosen to reduce the number of shifts that move a group from residing entirely in one box to being distributed across two or more. Of course such shifts do occur and the algorithm handles this case correctly (see subsection 3.2.2). In the tables below we report the time to execute one shift of one particle, in seconds. That is, we report (total time spent shifting)/(1000 · k).
4.2. Individual vs group-wise coefficient update.
Recall that in updating stored multipole coefficients to reflect the new position of shifted particles, we pass changes from the leaf level ℓ = L up the octree to level ℓ = 2. To do so we have two options: update coefficients on an individual particle or group-wise basis (see subsection 3.2.3). Both updates require first computing the multipole coefficients for each particle in the group at the leaf-level box, at a cost proportional to kp2 (for simplicity of analysis we assume for now that all particles reside in a single leaf-level box) followed by L − 2 translations up the octree. The group-wise update aggregates the k sets of coefficients by summing and uses the rotation-based TMM to (recursively) translate the single summed set of coefficients to the parent box at a cost proportional to p3 per shift for a total cost of . The individual update independently propagates each particle’s multipole coefficients up the tree by re-computing the multipole coefficients (16) for the parent box at a cost proportional to p2; repeating this up to level ℓ = 2 and for each particle results in a total of .
Clearly the size k of a group of particles and the order p of expansion impact whether to update individually or group-wise. For large k we expect group-wise updates to be faster. The smaller complexity in p implies that individual updates may be faster as p increases. However, a complication in determining which method to use is that the constants of proportionality for the two methods are quite different: group-wise update requires application of TMM while individual updates require evaluating Legendre polynomials. Overall for fixed p we expect the group-wise shift to become faster as the number of particles in the group increases.
For groups whose particles are distributed across more than a single box, we expect the benefit of group-wise shift to be delayed. For a group covering m leaf-level boxes, up to m applications of TMM are required at each level until a level is reached such that the m boxes share a common ancestor. Thus we expect the number of particles in a group at which group-wise shift becomes faster than individual shift to be larger than in the case where we have only one leaf-level box involved.
4.3. Timings.
Tables 1 to 5 compare the updating multipole method to the direct method for p = 3, 6, 9, 12, 15 and k = 1. The times reported are the time to shift one particle, in seconds. We report ϵmax, the maximum relative error over all shifts of the updating multipole potential energy functional relative to the direct potential energy functional, where the relative error is and VD is the potential energy functional computed using the direct summation expression (1) for Φ.
Table 1.
Timings for direct and multipole updates for k = 1 and p = 3. The values tmple and tdir are time per shift of one particle, in seconds, for the multipole updating method and the direct method, respectively. The value ϵmax is the maximum relative error occurring during the 1000 shifts.
| N | L | tmple | tdir | ϵmax |
|---|---|---|---|---|
| 3000 | 2 | 4.8E-05 | 4.4E-05 | 4.7E-05 |
| 4000 | 2 | 5.3E-05 | 6.0E-05 | 4.9E-05 |
| 5000 | 2 | 5.5E-05 | 7.3E-05 | 5.1E-05 |
| 10000 | 2 | 7.3E-05 | 1.5E-04 | 4.7E-05 |
| 20000 | 2 | 1.1E-04 | 2.9E-04 | 4.9E-05 |
| 40000 | 3 | 1.4E-04 | 5.8E-04 | 6.5E-05 |
| 80000 | 3 | 1.7E-04 | 1.2E-03 | 6.4E-05 |
| 160000 | 3 | 2.3E-04 | 2.3E-03 | 6.5E-05 |
| 320000 | 4 | 2.8E-04 | 4.7E-03 | 6.9E-05 |
Table 5.
Timings for direct and multipole updates for k = 1 and p = 15. The values tmple and tdir are time per shift of one particle, in seconds, for the multipole updating method and the direct method, respectively. The value ϵmax is the maximum relative error occurring during the 1000 shifts.
| N | L | tmple | tdir | ϵmax |
|---|---|---|---|---|
| 10000 | 2 | 2.7E-04 | 1.4E-04 | 7.3E-12 |
| 20000 | 2 | 3.0E-04 | 2.9E-04 | 2.0E-12 |
| 40000 | 2 | 7.3E-04 | 5.9E-04 | 2.7E-12 |
| 80000 | 3 | 7.6E-04 | 1.2E-03 | 4.1E-12 |
| 160000 | 3 | 8.3E-04 | 2.3E-03 | 8.8E-13 |
| 320000 | 4 | 1.5E-03 | 4.7E-03 | 2.8E-12 |
Note that the scaling with N, of for multipole updating versus for direct updating, appears evident in the data. For large N, doubling the number of particles N approximately doubles the direct shift time while the multipole shift time grows sub-linearly. The value of N at which multipole updating becomes faster than direct updating can be found from the tables. As expected, this crossover value increases with p, ranging from ~ 3, 500 for p = 3 to ~ 20,000 for p = 15.
In our experiments, the time to shift a single particle out of a group of k does not appear to decrease meaningfully with increasing k, which might be expected as group-wise shift reduces the per-particle cost of updating. See Table 6 for timings with N = 80, 000 and several values of p and k. Thus the crossover values for N at which the multipole update becomes advantageous over the direct update are unchanged for increasing k.
Table 6.
Time in seconds to shift one particle for a range of values for k, the group size, and p, the multipole expansion size, with N = 80,000; rotation-based TMM is used for group-wise updating for k > 1 while individual (multipole re-expansion) updating is used for k = 1. There is no meaningful difference in time as k increases.
| p | k = 1 | 2 | 5 | 20 | 50 | 100 |
|---|---|---|---|---|---|---|
| 3 | 1.67E-04 | 1.58E-04 | 1.54E-04 | 1.52E-04 | 1.52E-04 | 1.54E-04 |
| 6 | 2.33E-04 | 2.45E-04 | 2.24E-04 | 2.21E-04 | 2.24E-04 | 2.22E-04 |
| 9 | 3.80E-04 | 3.67E-04 | 3.54E-04 | 3.56E-04 | 3.47E-04 | 3.52E-04 |
| 12 | 5.32E-04 | 5.68E-04 | 5.43E-04 | 5.25E-04 | 5.13E-04 | 5.16E-04 |
| 15 | 7.59E-04 | 7.75E-04 | 7.52E-04 | 7.55E-04 | 7.39E-04 | 7.44E-04 |
Tables 7 to 11 compare individual and group-wise updating of the multipole coefficients for p = 3, 6, 9, 12, 15. For p = 3 and p = 6 we do not observe a pattern as to which method is faster. The time difference between the two methods is typically less than two percent, and only occasionally 5-8%, so the impact of the choice is small for p = 3 and p = 6. For p = 9, 12, 15, individual updating is faster for group sizes k = 1, 2, 5 while group updating is generally faster for group sizes k = 20, 50, 100 and large N.
Table 7.
Comparison of timings for individual and group-wise shift for p = 3. Times are time per shift of one particle, in seconds; the median time of three runs of 1000 shifts is reported. Choice of s to determine the number of levels in the octree is as in the text.
| N | k=1 | k=2 | k=5 | |||
|---|---|---|---|---|---|---|
| indiv | group | indiv | group | indiv | group | |
| 4000 | 5.13E-05 | 5.16E-05 | 4.92E-05 | 5.00E-05 | 4.83E-05 | 4.87E-05 |
| 5000 | 5.57E-05 | 5.45E-05 | 5.31E-05 | 5.33E-05 | 5.24E-05 | 5.20E-05 |
| 10000 | 7.35E-05 | 7.35E-05 | 7.20E-05 | 7.16E-05 | 7.07E-05 | 7.14E-05 |
| 20000 | 1.09E-04 | 1.11E-04 | 1.06E-04 | 1.08E-04 | 1.07E-04 | 1.06E-04 |
| 40000 | 1.39E-04 | 1.40E-04 | 1.34E-04 | 1.34E-04 | 1.30E-04 | 1.29E-04 |
| 80000 | 1.66E-04 | 1.65E-04 | 1.57E-04 | 1.61E-04 | 1.56E-04 | 1.57E-04 |
| 160000 | 2.29E-04 | 2.28E-04 | 2.05E-04 | 2.10E-04 | 2.03E-04 | 2.06E-04 |
| 320000 | 2.73E-04 | 2.76E-04 | 2.42E-04 | 2.48E-04 | 2.38E-04 | 2.37E-04 |
| N | k=20 | k=50 | k=100 | |||
| indiv | group | indiv | group | indiv | group | |
| 4000 | 4.91E-05 | 4.87E-05 | 5.01E-05 | 4.97E-05 | 5.14E-05 | 5.92E-05 |
| 5000 | 5.31E-05 | 5.27E-05 | 5.44E-05 | 5.19E-05 | 5.52E-05 | 6.20E-05 |
| 10000 | 6.93E-05 | 6.95E-05 | 7.14E-05 | 7.61E-05 | 6.99E-05 | 7.85E-05 |
| 20000 | 1.06E-04 | 1.09E-04 | 1.06E-04 | 1.07E-04 | 1.09E-04 | 1.20E-04 |
| 40000 | 1.30E-04 | 1.30E-04 | 1.35E-04 | 1.32E-04 | 1.32E-04 | 1.29E-04 |
| 80000 | 1.55E-04 | 1.55E-04 | 1.59E-04 | 1.58E-04 | 1.62E-04 | 1.54E-04 |
| 160000 | 2.04E-04 | 2.05E-04 | 2.07E-04 | 2.07E-04 | 2.02E-04 | 2.03E-04 |
| 320000 | 2.34E-04 | 2.36E-04 | 2.56E-04 | 2.33E-04 | 2.38E-04 | 2.34E-04 |
Table 11.
Comparison of timings for individual and group-wise shift for p = 15. Times are time per shift of one particle, in seconds; the median time of three runs of 1000 shifts is reported. Choice of s to determine the number of levels in the octree is as in the text.
| N | k=1 | k=2 | k=5 | |||
|---|---|---|---|---|---|---|
| indiv | group | indiv | group | indiv | group | |
| 20000 | 2.98E-04 | 3.01E-04 | 2.99E-04 | 2.95E-04 | 2.93E-04 | 2.98E-04 |
| 40000 | 7.11E-04 | 8.10E-04 | 7.30E-04 | 7.71E-04 | 7.23E-04 | 7.46E-04 |
| 80000 | 7.63E-04 | 8.46E-04 | 7.48E-04 | 7.91E-04 | 7.40E-04 | 7.68E-04 |
| 160000 | 8.30E-04 | 9.21E-04 | 8.08E-04 | 8.48E-04 | 7.97E-04 | 8.20E-04 |
| 320000 | 1.51E-03 | 1.61E-03 | 1.41E-03 | 1.49E-03 | 1.39E-03 | 1.41E-03 |
| N | k=20 | k=50 | k=100 | |||
| indiv | group | indiv | group | indiv | group | |
| 20000 | 2.97E-04 | 2.97E-04 | 2.96E-04 | 2.98E-04 | 3.00E-04 | 2.97E-04 |
| 40000 | 7.27E-04 | 7.27E-04 | 7.28E-04 | 7.21E-04 | 7.30E-04 | 7.19E-04 |
| 80000 | 7.60E-04 | 7.52E-04 | 7.51E-04 | 7.55E-04 | 7.57E-04 | 7.53E-04 |
| 160000 | 8.00E-04 | 7.93E-04 | 8.01E-04 | 8.00E-04 | 7.79E-04 | 8.01E-04 |
| 320000 | 1.40E-03 | 1.38E-03 | 1.39E-03 | 1.39E-03 | 1.39E-03 | 1.38E-03 |
To demonstrate that errors do not accumulate over the course of repeated shifts, we report in Table 12 the relative error after 106 shifts with p = 3, 6, 9, 12, 15 and k = 1, 2, 5, 20, 50,100. We observe that errors in the multipole updating method do not accumulate even after many shifts.
Table 12.
Relative errors at the end of 1,000,000 shifts with N = 40,000 and L = 3, for individual (“ind”) and group (“grp”) shifts.
| p = 3 | 6 | 9 | 12 | 15 | ||
|---|---|---|---|---|---|---|
| k = 1 | ind | 6.6E-05 | 3.1E-08 | 7.8E-10 | 3.3E-11 | 2.4E-12 |
| grp | 6.5E-05 | 3.0E-08 | 9.2E-10 | 1.5E-11 | 3.6E-12 | |
| k = 2 | ind | 4.0E-05 | 1.2E-08 | 2.4E-10 | 3.0E-11 | 3.7E-12 |
| grp | 3.9E-05 | 1.8E-08 | 5.6E-10 | 1.4E-11 | 3.1E-12 | |
| k = 5 | ind | 1.8E-05 | 9.9E-10 | 2.7E-10 | 3.5E-11 | 1.2E-12 |
| grp | 1.8E-05 | 7.8E-09 | 2.9E-10 | 8.1E-12 | 1.7E-12 | |
| k = 20 | ind | 4.6E-06 | 1.9E-08 | 9.2E-11 | 2.7E-11 | 9.5E-12 |
| grp | 4.8E-06 | 1.2E-08 | 1.7E-09 | 7.4E-11 | 3.0E-12 | |
| k = 50 | ind | 2.2E-06 | 2.9E-09 | 1.4E-09 | 4.1E-11 | 9.0E-12 |
| grp | 1.3E-06 | 1.5E-08 | 1.9E-09 | 7.2E-11 | 7.3E-12 | |
| k = 100 | ind | 9.9E-07 | 4.8E-09 | 2.0E-10 | 3.1E-11 | 3.1E-12 |
| grp | 6.4E-07 | 5.6E-09 | 3.7E-09 | 3.3E-10 | 2.8E-11 | |
5. Conclusion.
In this paper we have introduced a new method for updating the Coulomb potential energy functional of a collection of point charges when a subset of those charges undergoes a shift in position. Compared to the direct method, our updating multipole method improves the asymptotic complexity as well as runtime for problems of practical size. Errors in the new method are bounded and do not accumulate as the number of shifts grows. This method may be extended to include periodic boundary conditions, which were not considered here. A natural application of the updating method is as a component of a design optimization. In such cases it would be useful to simultaneously compute the gradient of the potential energy functional with respect to the k positions that are changing. We expect that it is feasible to include this gradient calculation in our updating framework. Non-uniform particle distributions would benefit from an adaptive octree; this may be added to the method through modification of the data structures for the octree and associated bookkeeping. We expect the method presented here to find application in diverse fields of computational science.
Table 2.
Timings for direct and multipole updates for k = 1 and p = 6. The values tmple and tdir are time per shift of one particle, in seconds, for the multipole updating method and the direct method, respectively. The value ϵmax is the maximum relative error occurring during the 1000 shifts.
| N | L | tmple | tdir | ϵmax |
|---|---|---|---|---|
| 5000 | 2 | 7.5E-05 | 7.4E-05 | 3.0E-08 |
| 10000 | 2 | 9.6E-05 | 1.5E-04 | 1.3E-08 |
| 20000 | 2 | 1.3E-04 | 2.9E-04 | 2.5E-08 |
| 40000 | 2 | 2.3E-04 | 5.8E-04 | 3.1E-08 |
| 80000 | 3 | 2.4E-04 | 1.2E-03 | 2.4E-08 |
| 160000 | 3 | 3.0E-04 | 2.3E-03 | 3.2E-08 |
| 320000 | 4 | 4.3E-04 | 4.7E-03 | 2.7E-08 |
Table 3.
Timings for direct and multipole updates for k = 1 and p = 9. The values tmple and tdir are time per shift of one particle, in seconds, for the multipole updating method and the direct method, respectively. The value ϵmax is the maximum relative error occurring during the 1000 shifts.
| N | L | tmple | tdir | ϵmax |
|---|---|---|---|---|
| 5000 | 2 | 1.2E-04 | 7.4E-05 | 1.6E-10 |
| 10000 | 2 | 1.4E-04 | 1.5E-04 | 1.2E-10 |
| 20000 | 2 | 1.7E-04 | 2.9E-04 | 1.2E-09 |
| 40000 | 2 | 3.4E-04 | 5.9E-04 | 8.5E-10 |
| 80000 | 3 | 3.6E-04 | 1.2E-03 | 6.8E-10 |
| 160000 | 3 | 4.4E-04 | 2.3E-03 | 5.0E-10 |
| 320000 | 4 | 6.9E-04 | 4.7E-03 | 5.9E-10 |
Table 4.
Timings for direct and multipole updates for k = 1 and p = 12. The values tmple and tdir are time per shift of one particle, in seconds, for the multipole updating method and the direct method, respectively. The value ϵmax is the maximum relative error occurring during the 1000 shifts.
| N | L | tmple | tdir | ϵmax |
|---|---|---|---|---|
| 10000 | 2 | 1.9E-04 | 1.5E-04 | 1.2E-10 |
| 20000 | 2 | 2.3E-04 | 2.9E-04 | 1.1E-11 |
| 40000 | 2 | 5.1E-04 | 5.9E-04 | 2.6E-11 |
| 80000 | 3 | 5.5E-04 | 1.2E-03 | 5.3E-12 |
| 160000 | 3 | 6.2E-04 | 2.3E-03 | 5.2E-12 |
| 320000 | 4 | 1.0E-03 | 4.7E-03 | 4.8E-12 |
Table 8.
Comparison of timings for individual and group-wise shift for p = 6. Times are time per shift of one particle, in seconds; the median time of three runs of 1000 shifts is reported. Choice of s to determine the number of levels in the octree is as in the text.
| N | k=1 | k=2 | k=5 | |||
|---|---|---|---|---|---|---|
| indiv | group | indiv | group | indiv | group | |
| 10000 | 9.43E-05 | 9.68E-05 | 9.38E-05 | 9.39E-05 | 9.39E-05 | 9.30E-05 |
| 20000 | 1.31E-04 | 1.33E-04 | 1.29E-04 | 1.31E-04 | 1.29E-04 | 1.29E-04 |
| 40000 | 2.04E-04 | 2.16E-04 | 2.04E-04 | 2.13E-04 | 2.11E-04 | 1.99E-04 |
| 80000 | 2.37E-04 | 2.41E-04 | 2.52E-04 | 2.33E-04 | 2.48E-04 | 2.29E-04 |
| 160000 | 2.92E-04 | 3.08E-04 | 2.96E-04 | 2.83E-04 | 2.76E-04 | 2.77E-04 |
| 320000 | 4.23E-04 | 4.32E-04 | 3.82E-04 | 4.21E-04 | 3.96E-04 | 3.80E-04 |
| N | k=20 | k=50 | k=100 | |||
| indiv | group | indiv | group | indiv | group | |
| 10000 | 9.61E-05 | 9.45E-05 | 9.25E-05 | 9.28E-05 | 9.39E-05 | 9.34E-05 |
| 20000 | 1.31E-04 | 1.30E-04 | 1.31E-04 | 1.29E-04 | 1.31E-04 | 1.32E-04 |
| 40000 | 2.07E-04 | 2.00E-04 | 2.08E-04 | 2.03E-04 | 2.01E-04 | 2.00E-04 |
| 80000 | 2.40E-04 | 2.26E-04 | 2.32E-04 | 2.26E-04 | 2.24E-04 | 2.23E-04 |
| 160000 | 2.90E-04 | 2.84E-04 | 2.95E-04 | 2.79E-04 | 2.75E-04 | 2.76E-04 |
| 320000 | 3.87E-04 | 3.79E-04 | 4.09E-04 | 3.76E-04 | 3.65E-04 | 3.63E-04 |
Table 9.
Comparison of timings for individual and group-wise shift for p = 9. Times are time per shift of one particle, in seconds; the median time of three runs of 1000 shifts is reported. Choice of s to determine the number of levels in the octree is as in the text.
| N | k=1 | k=2 | k=5 | |||
|---|---|---|---|---|---|---|
| indiv | group | indiv | group | indiv | group | |
| 10000 | 1.36E-04 | 1.37E-04 | 1.33E-04 | 1.36E-04 | 1.33E-04 | 1.33E-04 |
| 20000 | 1.78E-04 | 1.74E-04 | 1.71E-04 | 1.78E-04 | 1.70E-04 | 1.72E-04 |
| 40000 | 3.42E-04 | 3.62E-04 | 3.32E-04 | 3.44E-04 | 3.28E-04 | 3.32E-04 |
| 80000 | 3.61E-04 | 3.81E-04 | 3.61E-04 | 3.74E-04 | 3.51E-04 | 3.61E-04 |
| 160000 | 4.21E-04 | 4.50E-04 | 4.02E-04 | 4.20E-04 | 4.08E-04 | 4.08E-04 |
| 320000 | 6.56E-04 | 7.21E-04 | 6.29E-04 | 6.60E-04 | 6.29E-04 | 6.33E-04 |
| N | k=20 | k=50 | k=100 | |||
| indiv | group | indiv | group | indiv | group | |
| 10000 | 1.33E-04 | 1.34E-04 | 1.37E-04 | 1.35E-04 | 1.35E-04 | 1.35E-04 |
| 20000 | 1.68E-04 | 1.69E-04 | 1.71E-04 | 1.74E-04 | 1.73E-04 | 1.75E-04 |
| 40000 | 3.29E-04 | 3.29E-04 | 3.38E-04 | 3.28E-04 | 3.29E-04 | 3.32E-04 |
| 80000 | 3.53E-04 | 3.52E-04 | 3.56E-04 | 3.50E-04 | 3.53E-04 | 3.53E-04 |
| 160000 | 4.24E-04 | 3.99E-04 | 4.04E-04 | 4.04E-04 | 4.02E-04 | 3.97E-04 |
| 320000 | 6.16E-04 | 6.12E-04 | 6.32E-04 | 6.19E-04 | 6.14E-04 | 6.12E-04 |
Table 10.
Comparison of timings for individual and group-wise shift for p = 12. Times are time per shift of one particle, in seconds; the median time of three runs of 1000 shifts is reported. Choice of s to determine the number of levels in the octree is as in the text.
| N | k=1 | k=2 | k=5 | |||
|---|---|---|---|---|---|---|
| indiv | group | indiv | group | indiv | group | |
| 20000 | 2.29E-04 | 2.30E-04 | 2.34E-04 | 2.27E-04 | 2.26E-04 | 2.32E-04 |
| 40000 | 5.03E-04 | 5.66E-04 | 5.08E-04 | 5.32E-04 | 5.03E-04 | 5.20E-04 |
| 80000 | 5.27E-04 | 5.88E-04 | 5.41E-04 | 5.74E-04 | 5.41E-04 | 5.47E-04 |
| 160000 | 6.02E-04 | 6.53E-04 | 6.05E-04 | 6.32E-04 | 5.76E-04 | 5.97E-04 |
| 320000 | 1.00E-03 | 1.12E-03 | 9.96E-04 | 1.02E-03 | 9.82E-04 | 9.95E-04 |
| N | k=20 | k=50 | k=100 | |||
| indiv | group | indiv | group | indiv | group | |
| 20000 | 2.25E-04 | 2.30E-04 | 2.27E-04 | 2.23E-04 | 2.27E-04 | 2.25E-04 |
| 40000 | 5.01E-04 | 5.22E-04 | 5.11E-04 | 4.99E-04 | 4.96E-04 | 5.00E-04 |
| 80000 | 5.38E-04 | 5.36E-04 | 5.35E-04 | 5.33E-04 | 5.36E-04 | 5.43E-04 |
| 160000 | 5.87E-04 | 5.80E-04 | 5.90E-04 | 5.79E-04 | 5.85E-04 | 5.84E-04 |
| 320000 | 9.74E-04 | 9.46E-04 | 9.46E-04 | 9.33E-04 | 9.59E-04 | 9.46E-04 |
Acknowledgements.
TH thanks the Applied and Computational Mathematics Division of the Information Technology Laboratory at the National Institute for Standards and Technology in Boulder, CO, which hosted him as a visitor during a portion of the work.
Footnotes
REFERENCES
- [1].Baker D and Sali A, Protein structure prediction and structural genomics, Science, 294 (2001), pp. 93–96, doi: 10.1126/science.1065659. [DOI] [PubMed] [Google Scholar]
- [2].Barnes J and Hut P, A hierarchical O(N log N) force-calculation algorithm, Nature, 323 (1986), pp. 446–449, doi: 10.1038/324446a0. [DOI] [Google Scholar]
- [3].Beatson R and Greengard L, A short course on fast multipole methods, in Wavelets, Multilevel Methods and Elliptic PDEs, Oxford University Press, 1997, pp. 1–37. [Google Scholar]
- [4].Carrier J, Greengard L, and Rokhlin V, A fast adaptive multipole algorithm for particle simulations, SIAM Journal on Scientific and Statistical Computing, 9 (1988), pp. 669–686, doi: 10.1137/0909044. [DOI] [Google Scholar]
- [5].Chandramowlishwarany A, Madduri K, and Vuduc R, Diagnosis, tuning, and redesign for multicore performance: A case study of the fast multipole method, in 2010 ACM/IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, November 2010, pp. 1–12, doi: 10.1109/SC.2010.19. [DOI] [Google Scholar]
- [6].Cheng H, Gimbutas Z, Martinsson PG, and Rokhlin V, On the compression of low rank matrices, SIAM Journal on Scientific Computing, 26 (2005), pp. 1389–1404, doi: 10.1137/030602678. [DOI] [Google Scholar]
- [7].Cheng H, Greengard L, and Rokhlin V, A fast adaptive multipole algorithm in three dimensions, Journal of Computational Physics, 155 (1999), pp. 468–498, doi: 10.1006/jcph.1999.6355. [DOI] [Google Scholar]
- [8].Cisneros G, Karttunen M, Ren P, and Sagui C, Classical electrostatics for biomolecular simulations, Chemical Reviews, 114 (2014), pp. 779–814, doi: 10.1021/cr300461d. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [9].Dehnen W, A fast multipole method for stellar dynamics, Computational Astrophysics and Cosmology, 1 (2014), pp. 1–23, doi: 10.1186/s40668-014-0001-7. [DOI] [Google Scholar]
- [10].Diky V, Chirico RD, Muzny CD, Kazakov AF, Kroenlein K, Magee JW, Abdulagatov I, Kang JW, Gani R, and Frenkel M, ThermoData Engine (TDE): Software implementation of the dynamic data evaluation concept. 8. properties of material streams and solvent design, Journal of Chemical Information and Modeling, 53 (2013), pp. 249–266, doi: 10.1021/ci300470t. [DOI] [PubMed] [Google Scholar]
- [11].Gillman A and Martinsson PG, A direct solver with O(N) complexity for variable coefficient elliptic pdes discretized via a high-order composite spectral collocation method, SIAM Journal on Scientific Computing, 36 (2014), pp. A2023–A2046, doi: 10.1137/130918988. [DOI] [Google Scholar]
- [12].Gimbutas Z and Greegard L, fmmlib3d, 2012, https://github.com/zgimbutas/fmmlib3d (accessed 2015/01/29). Version 1.2.
- [13].Greengard L, The Rapid Evaluation of Potential Fields in Particle Systems, MIT Press, Cambridge, MA, 1988. [Google Scholar]
- [14].Greengard L and Rokhlin V, A fast algorithm for particle simulations, Journal of Computational Physics, 135 (1987), pp. 280–292, doi: 10.1016/0021-9991(87)90140-9. [DOI] [Google Scholar]
- [15].Greengard L and Rokhlin V, The rapid evaluation of potential fields in three dimensions, in Vortex Methods: Proceedings of the U.C.L.A. Workshop held in Los Angeles, May 20–22, 1987, Anderson C and Greengard C, eds., Springer, Berlin, 1988, pp. 121–141, doi: 10.1007/BFb0089775. [DOI] [Google Scholar]
- [16].Greengard L and Rokhlin V, A new version of the fast multipole method for the Laplace equation in three dimensions, Acta Numerica, 6 (1997), pp. 229–269, doi: 10.1017/S0962492900002725. [DOI] [Google Scholar]
- [17].Hospital A, Goñi JR, Orozco M, and Gelpí JL, Molecular dynamics simulations: advances and applications, Advances and Applications in Bioinformatics and Chemistry, 8 (2015), pp. 37–47, doi: 10.2147/AABC.S70333. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [18].Karplus M and Kuriyan J, Molecular dynamics and protein function, Proceedings of the National Academy of Sciences, 102 (2005), pp. 6679–6685, doi: 10.1073/pnas.0408930102. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [19].Karplus M and McCammon JA, Molecular dynamics simulations of biomolecules, Nature Structural & Molecular Biology, 9 (2002), pp. 646–652, doi: 10.1038/nsb0902-646. [DOI] [PubMed] [Google Scholar]
- [20].Kurzak J and Pettitt BM, Fast multipole methods for particle dynamics, Molecular simulation, 32 (2006), pp. 775–790, doi: 10.1080/08927020600991161. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [21].Lashuk I, Chandramowlishwaran A, Langston H, Nguyen T-A, Sampath R, Shringarpure A, Vuduc R, Ying L, Zorin D, and Biros G, A massively parallel adaptive fast multipole method on heterogeneous architectures, Communications of the ACM, 55 (2012), pp. 101–109, doi: 10.1145/2160718.2160740. [DOI] [Google Scholar]
- [22].Liberty E, Woolfe F, Martinsson P-G, Rokhlin V, and Tygert M, Randomized algorithms for the low-rank approximation of matrices, Proceedings of the National Academy of Sciences, 104 (2007), pp. 20167–20172, doi: 10.1073/pnas.0709640104. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [23].Malhotra D, Gholami A, and Biros G, A volume integral equation Stokes solver for problems with variable coefficients, in Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’14, Piscataway, NJ, USA, 2014, IEEE Press, pp. 92–102, doi: 10.1109/SC.2014.13. [DOI] [Google Scholar]
- [24].March WB, Xiao B, Tharakan S, Yu CD, and Biros G, A kernel-independent fmm in general dimensions, in Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’15, New York, NY, USA, 2015, ACM, pp. 24:1–24:12, doi: 10.1145/2807591.2807647. [DOI] [Google Scholar]
- [25].Martinsson P-G, Fast multipole methods, in Encyclopedia of Applied and Computational Mathematics, Engquist B, ed., Springer, Berlin, 2015, pp. 498–508, doi: 10.1007/978-3-540-70529-1_448. [DOI] [Google Scholar]
- [26].Minden V, Damle A, Ho KL, and Ying L, A technique for updating hierarchical skeletonization-based factorizations of integral operators, Multiscale Modeling and Simulation, 14 (2016), pp. 42–64, doi: 10.1137/15M1024500. [DOI] [Google Scholar]
- [27].Minh DDL and Minh DLP, Understanding the Hastings algorithm, Communications in Statistics - Simulation and Computation, 44 (2015), pp. 332–349, doi: 10.1080/03610918.2013.777455. [DOI] [Google Scholar]
- [28].Nabors K, Korsmeyer F, Leighton F, and White J, Preconditioned, adaptive, multipole-accelerated iterative methods for three-dimensional first-kind integral equations of potential theory, SIAM Journal on Scientific Computing, 15 (1994), pp. 713–735, doi: 10.1137/0915046. [DOI] [Google Scholar]
- [29].Patra M, Karttunen M, Hyvönen MT, Falck E, Lindqvist P, and Vattulainen I, Molecular dynamics simulations of lipid bilayers: Major artifacts due to truncating electrostatic interactions, Biophysical Journal, 84 (2003), pp. 3636–3645, doi: 10.1016/S0006-3495(03)75094-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [30].Paulechka E, Kroenlein K, Kazakov A, and Frenkel M, A systematic approach for development of an OPLS-like force field and its application to hydrofluorocarbons, Journal of Physical Chemistry B, 116 (2012), pp. 14389–14397, doi: 10.1021/jp309119h. [DOI] [PubMed] [Google Scholar]
- [31].Rokhlin V, Rapid solution of integral-equations of classical potential theory, Journal of Computational Physics, 60 (1985), pp. 187–207, doi: 10.1016/0021-9991(85)90002-6. [DOI] [Google Scholar]
- [32].Sagui C and Darden TA, Molecular dynamics simulations of biomolecules: Long-range electrostatic effects, Annual Review of Biophysics and Biomolecular Structure, 28 (1999), pp. 155–179, doi: 10.1146/annurev.biophys.28.1.155. PMID: 10410799. [DOI] [PubMed] [Google Scholar]
- [33].Schlick T, Collepardo-Guevara R, Halvorsen LA, Jung S, and Xiao X, Biomolecular modeling and simulation: a field coming of age, Quarterly Reviews of Biophysics, 44 (2011), pp. 191–228, doi: 10.1017/S0033583510000284. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [34].Schwörer M, Lorenzen K, Mathias G, and Tavan P, Utilizing fast multipole expansions for efficient and accurate quantum-classical molecular dynamics simulations, Journal of Chemical Physics, 142 (2015), 104108, doi: 10.1063/1.4914329. [DOI] [PubMed] [Google Scholar]
- [35].Ying L, Biros G, and Zorin D, A kernel-independent adaptive fast multipole algorithm in two and three dimensions, Journal of Computational Physics, 196 (2004), pp. 591–626, doi: 10.1016/j.jcp.2003.11.021. [DOI] [Google Scholar]
- [36].Yokota R, Barba L, Narumi T, and Yasuoka K, Petascale turbulence simulation using a highly parallel fast multipole method on GPUs, Computer Physics Communications, 184 (2013), pp. 445–455, doi: 10.1016/j.cpc.2012.09.011. [DOI] [Google Scholar]
