Nbody6
findm.f
Go to the documentation of this file.
1  SUBROUTINE findm(I,ITERM,MG)
2 *
3 *
4 * Find ghost mass.
5 * ----------------
6 *
7  include 'common6.h'
8  common/binary/ cm(4,mmax),xrel(3,mmax),vrel(3,mmax),
9  & hm(mmax),um(4,mmax),umdot(4,mmax),tmdis(mmax),
10  & namem(mmax),nameg(mmax),kstarm(mmax),iflag(mmax)
11  REAL*8 mg
12 *
13 *
14 * Distinguish between KS component and single particle or c.m.
15  iterm = 0
16  IF (i.LT.ifirst) THEN
17  ipair = kvec(i)
18  icm = n + ipair
19 * Consider standard binary, simple hierarchy or high-order system.
20  IF (name(icm).GT.0) THEN
21  im = 0
22 * Obtain merger index for later and identify component of CM.
23  DO 3 k = 1,nmerge
24  IF (nameg(k).EQ.name(icm)) im = k
25  3 CONTINUE
26  IF (im.EQ.0) THEN
27  iterm = -1
28  go to 50
29  END IF
30  j1 = 2*ipair - 1
31  IF (name(j1).EQ.name(i)) k1 = 3
32  IF (name(j1+1).EQ.name(i)) k1 = 4
33  ELSE IF (name(icm).GE.-2*nzero) THEN
34  im = 0
35  DO 5 k = 1,nmerge
36  IF (namem(k).EQ.name(icm)) im = k
37  5 CONTINUE
38  IF (im.EQ.0) THEN
39  iterm = -1
40  go to 50
41  END IF
42  j1 = 2*ipair - 1
43  k1 = 1
44  IF (name(j1+1).EQ.name(i)) THEN
45  k1 = 2
46  END IF
47  ELSE IF (name(icm).LT.-2*nzero) THEN
48  im = 0
49  DO 6 k = 1,nmerge
50  IF (namem(k).EQ.name(icm)) im = k
51  6 CONTINUE
52  IF (im.EQ.0) THEN
53  iterm = -1
54  go to 50
55  END IF
56  jh = 0
57 * Search c.m. ghost name to get KS pair index.
58  DO 8 j = n+1,ntot
59  IF (name(j).EQ.nameg(im)) jh = j
60  8 CONTINUE
61  IF (jh.EQ.0) THEN
62  iterm = -1
63  go to 50
64  END IF
65  jpair = jh - n
66  j1 = 2*jpair - 1
67 * Compare component names in order to decide appropriate CM index.
68  IF (name(j1).EQ.name(i)) THEN
69  k1 = 1
70  ELSE IF (name(j1+1).EQ.name(i)) THEN
71  k1 = 2
72  ELSE
73  k1 = 2
74  END IF
75  ELSE
76  iterm = -1
77  go to 50
78  END IF
79  ELSE
80 * Determine merger index of ghost particle.
81  im = 0
82  DO 10 k = 1,nmerge
83  IF (nameg(k).EQ.name(i)) im = k
84  10 CONTINUE
85  IF (im.EQ.0) THEN
86  iterm = -1
87  go to 50
88  END IF
89  IF (i.LE.n) THEN
90  j1 = 0
91 * Identify the location of the corresponding KS component.
92  DO 15 j = 1,ifirst
93  IF (name(j).EQ.-namem(im)) j1 = j
94  15 CONTINUE
95  IF (j1.EQ.0) THEN
96  iterm = -1
97  go to 50
98  END IF
99  ipair = kvec(j1)
100 * Decide the relevant component by comparing look-up times.
101  k1 = 1
102  IF (tev(2*ipair).LT.tev(i)) k1 = 2
103  ELSE
104  icm = 0
105  DO 20 k = n+1,ntot
106  IF (namem(im).EQ.name(k)) icm = k
107  20 CONTINUE
108  IF (icm.EQ.0) THEN
109  iterm = -1
110  go to 50
111  END IF
112  ipair = icm - n
113  j = i
114  k1 = 1
115  IF (tev(2*ipair).LT.tev(j)) k1 = 2
116  END IF
117  END IF
118 *
119 * Copy the desired mass from merger table.
120  mg = cm(k1,im)
121 *
122  50 RETURN
123 *
124  END