Nbody6
 All Files Functions Variables
fpert.f
Go to the documentation of this file.
1  SUBROUTINE fpert(I,J,NP,PERT)
2 *
3 *
4 * Perturbing force on dominant two-body system.
5 * ---------------------------------------------
6 *
7  include 'common6.h'
8  REAL*8 fp(3)
9 *
10 *
11  DO 1 k = 1,3
12  fp(k) = 0.0d0
13  1 CONTINUE
14 *
15 * Obtain perturbation on body #I & J due to NP members of JLIST.
16  rcrit2 = 1.0d+04*rmin2
17  iter = 0
18  2 DO 10 kk = 1,np
19  k = jlist(kk)
20  IF (k.EQ.i.OR.k.EQ.j) go to 10
21  l = i
22  5 a1 = x(1,k) - x(1,l)
23  a2 = x(2,k) - x(2,l)
24  a3 = x(3,k) - x(3,l)
25  rij2 = a1**2 + a2**2 + a3**2
26 * Restrict evaluation RCRIT2 (neighbour list may be used).
27  IF (l.EQ.i.AND.rij2.GT.rcrit2) go to 10
28  a4 = body(k)/(rij2*sqrt(rij2))
29  IF (l.EQ.j) a4 = -a4
30  fp(1) = fp(1) + a1*a4
31  fp(2) = fp(2) + a2*a4
32  fp(3) = fp(3) + a3*a4
33  IF (l.EQ.i) THEN
34  l = j
35  go to 5
36  END IF
37  10 CONTINUE
38 *
39 * Increase search distance on zero contributions (< 10 times).
40  IF (fp(1).EQ.0.0d0) THEN
41  rcrit2 = 4.0*rcrit2
42  iter = iter + 1
43  IF (iter.LT.10) go to 2
44  END IF
45 *
46  pert = sqrt(fp(1)**2 + fp(2)**2 + fp(3)**2)
47 *
48  RETURN
49 *
50  END