Nbody6
 All Files Functions Variables
erel.f
Go to the documentation of this file.
1  SUBROUTINE erel(IM,EB,SEMI)
2 *
3 *
4 * Dominant two-body energy in chain system.
5 * -----------------------------------------
6 *
7  include 'commonc.h'
8  include 'common2.h'
9  common/ksave/ k1,k2
10 *
11 *
12 * Obtain physical momenta & separations of pericentre configuration.
13  CALL transk
14 *
15 * Form kinetic energy terms of dominant c.m. (K1 + K2) and the rest.
16  zk = 0.0d0
17  p0 = 0.0d0
18  DO 10 k = 1,3
19  ps = 0.0
20 * Exclude dominant bodies using names of chain members set in DERQP.
21  DO 5 i = 1,n
22  IF (iname(i).NE.k1.AND.iname(i).NE.k2) THEN
23  j = 3*(i - 1)
24  ps = ps + pi(j+k)
25  zk = zk + pi(j+k)**2/mc(i)
26  END IF
27  5 CONTINUE
28  p0 = p0 + ps**2
29  10 CONTINUE
30 *
31 * Evaluate potential energy due to non-dominant chain distances.
32  pot = 0.0d0
33  DO 20 i = 1,n-1
34  IF (i.EQ.im) go to 20
35  l = i + 1
36  pot = pot + mij(i,l)*rinv(i)
37  20 CONTINUE
38 *
39 * Add non-chained contributions to the potential energy.
40  ij = n - 1
41  DO 30 i = 1,n-2
42  DO 25 j = i+2,n
43  ij = ij + 1
44  pot = pot + mij(i,j)*rinv(ij)
45  25 CONTINUE
46  30 CONTINUE
47 *
48 * Obtain binding energy from total energy and perturbing function.
49  mb = m(k1) + m(k2)
50  vp = 0.5d0*(p0/mb + zk) - pot
51  eb = energy - vp
52 *
53 * Set semi-major axis.
54  semi = -m(k1)*m(k2)/(2.0d0*eb)
55 *
56  RETURN
57 *
58  END