Nbody6
 All Files Functions Variables
findj.f
Go to the documentation of this file.
1  SUBROUTINE findj(I,J,IMERGE)
2 *
3 *
4 * Find merger ghost.
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 *
12 *
13 * Check whether the search index is a c.m. body or KS component.
14  j = -1
15  imerge = 0
16  IF (i.GE.ifirst) THEN
17  icm = i
18  IF (i.LE.n.OR.name(icm).GE.0) THEN
19  WRITE (6,1) i, name(i), ifirst, n
20  1 FORMAT (' WARNING! FINDJ I NAM I* N ',4i6)
21  go to 30
22  END IF
23  ELSE
24 * Set KS pair and c.m. index (exit if no merger).
25  jp = kvec(i)
26  icm = n + jp
27  IF (name(icm).GE.0) go to 30
28  END IF
29 *
30 * Locate current position in the merger table.
31  imerge = 0
32  DO 5 k = 1,nmerge
33  IF (namem(k).EQ.name(icm)) THEN
34  imerge = k
35  END IF
36  5 CONTINUE
37  IF (imerge.EQ.0) go to 30
38 *
39 * Find index of ghost particle with specified name (search NTOT).
40  DO 10 k = 1,ntot
41  IF (name(k).EQ.nameg(imerge)) THEN
42  j = k
43  go to 20
44  END IF
45  10 CONTINUE
46 *
47  20 IF (j.GT.0.AND.body(j).GT.0.0d0) THEN
48  WRITE (6,25) i, jp, name(icm), j, body(j)
49  25 FORMAT (' WARNING! FINDJ I JP NAM J MJ',2i5,2i6,1p,e9.1)
50  j = -2
51  END IF
52 *
53 * Assign nominal value of merger index if not identified.
54  30 IF (imerge.EQ.0) imerge = 1
55 *
56  RETURN
57 *
58  END