|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
force(p,B):
|
|
|
if (B contains just one particle) return
force due to that particle;
|
|
L = side-length of B;
|
|
|
c = B’s center-of-mass;
|
|
|
D = distance(p,c);
|
|
|
if (L < D/2)
|
|
|
Calculate force as if all particles in
B are located at c;
|
|
|
else
|
|
|
force = Combine(force(p,B1),
force(p,B2),...,force(p,B8));
|
|
|
/* B1 to B8 are
the 8 subboxes of B */
|
|
|
return force
|
|
|
|