Nbody6
 All Files Functions Variables
nbrest.f
Go to the documentation of this file.
1  SUBROUTINE nbrest(ICM,NSYS,NP)
2 *
3 *
4 * Restore ghosts in neighbour lists.
5 * ----------------------------------
6 *
7  include 'common6.h'
8 *
9 *
10 * Examine all members inside neighbour radius of body #ICM.
11  DO 100 ll = 1,np
12  i = jpert(ll)
13  10 nnb1 = list(1,i) + 1
14  IF (nnb1.EQ.1) go to 100
15 *
16 * First see whether body #ICM is a neighbour.
17  DO 20 l = 2,nnb1
18  IF (list(l,i).EQ.icm) THEN
19  go to 30
20  ELSE
21  IF (list(l,i).GT.icm) go to 100
22  END IF
23  20 CONTINUE
24 *
25 * Add other members of the subsystem subject to limit.
26  30 DO 60 k = 1,nsys
27  j = jlist(k)
28  IF (j.EQ.icm) go to 60
29 *
30 * Skip addition if body #J is already a member.
31  DO 40 l = 2,nnb1
32  IF (list(l,i).EQ.j) go to 60
33  40 CONTINUE
34 *
35 * Move members down until correct location identified.
36  DO 50 l = nnb1,1,-1
37  IF (list(l,i).GT.j.AND.l.GT.1) THEN
38  list(l+1,i) = list(l,i)
39  ELSE
40 * Place body #J in vacated location and increase membership.
41  list(l+1,i) = j
42  list(1,i) = list(1,i) + 1
43  nnb1 = nnb1 + 1
44 * See whether neighbour list has reached maximum size.
45  IF (nnb1.GT.nnbmax) go to 70
46  go to 60
47  END IF
48  50 CONTINUE
49  60 CONTINUE
50 *
51 * Also check any KS perturber list.
52  70 IF (i.GT.n) THEN
53  i = 2*(i - n) - 1
54  IF (list(1,i).GT.0) go to 10
55  END IF
56  100 CONTINUE
57 *
58  RETURN
59 *
60  END