Nbody6
 All Files Functions Variables
ksres.f
Go to the documentation of this file.
1  SUBROUTINE ksres(J,J1,J2,RIJ2)
2 *
3 *
4 * Coordinates of regularized pair.
5 * --------------------------------
6 *
7  include 'common6.h'
8  common/slow0/ range,islow(10)
9  REAL*8 ui(4)
10 *
11 *
12 * Resolve components of pair #J at curent time.
13  j2 = j + j
14  j1 = j2 - 1
15  a2 = 1.0/r(j)
16  a3 = a2*(time - t0(j1))
17  IF (kslow(j).GT.1) THEN
18  imod = kslow(j)
19  a3 = a3/float(islow(imod))
20  END IF
21 *
22 * Decide appropriate order for interpolation & prediction.
23  IF (rij2.GT.625.0*r(j)**2) THEN
24 * Convert physical interval to regularized time (second order only).
25  dtu = (1.0 - 0.5d0*tdot2(j)*a2*a3)*a3
26  IF (abs(dtu).GT.dtau(j)) dtu = dtau(j)
27 *
28 * Predict regularized coordinates of distant pair to second order.
29  DO 10 k = 1,4
30  ui(k) = (fu(k,j)*dtu + udot(k,j))*dtu + u0(k,j)
31  10 CONTINUE
32  ELSE
33 * Expand regularized time interval to third order.
34  a4 = 3.0d0*tdot2(j)**2*a2 - tdot3(j)
35  dtu = ((one6*a4*a3 - 0.5d0*tdot2(j))*a2*a3 + 1.0)*a3
36 * Apply safety test near small pericentre or for unperturbed motion.
37  IF (dtu.GT.dtau(j)) dtu = 0.8*dtau(j)
38 * Ignore the expansion for collision (already at pericentre).
39  IF (list(1,j1).EQ.0.OR.iphase.EQ.9) dtu = 0.0
40 *
41 * Predict regularized coordinates to fourth order.
42  dtu1 = dtu/24.0d0
43  DO 20 k = 1,4
44  ui(k) = (((fudot2(k,j)*dtu1 + fudot(k,j))*dtu +
45  & fu(k,j))*dtu + udot(k,j))*dtu + u0(k,j)
46  20 CONTINUE
47  END IF
48 *
49 * Employ KS transformation.
50  q1 = ui(1)**2 - ui(2)**2 - ui(3)**2 + ui(4)**2
51  q2 = ui(1)*ui(2) - ui(3)*ui(4)
52  q3 = ui(1)*ui(3) + ui(2)*ui(4)
53  q2 = q2 + q2
54  q3 = q3 + q3
55  j3 = n + j
56  a2 = body(j2)/body(j3)
57 *
58 * Set global coordinates of regularized components.
59  x(1,j1) = x(1,j3) + a2*q1
60  x(2,j1) = x(2,j3) + a2*q2
61  x(3,j1) = x(3,j3) + a2*q3
62  x(1,j2) = x(1,j1) - q1
63  x(2,j2) = x(2,j1) - q2
64  x(3,j2) = x(3,j1) - q3
65 *
66  RETURN
67 *
68  END