Nbody6
select.f
Go to the documentation of this file.
1  SUBROUTINE select
2 *
3 *
4 * Select chain indices.
5 * ---------------------
6 *
7  include 'commonc.h'
8  include 'common2.h'
9  REAL*8 rij2(nmxm)
10  INTEGER ic(nmx2),ij(nmxm,2),ind(nmxm)
11  LOGICAL used(nmxm),suc,loop
12  SAVE
13 *
14 *
15  l=0
16  DO i=1,n-1
17  DO j=i+1,n
18  l=l+1
19  rij2(l) = (x(3*i-2)-x(3*j-2))**2+(x(3*i-1)-x(3*j-1))**2+
20  & (x(3*i)-x(3*j))**2
21 * Include masses for defining dominant interaction (09/06).
22  rij2(l) = rij2(l)/(m(i) + m(j))
23  ij(l,1)=i
24  ij(l,2)=j
25  used(l)=.false.
26  END DO
27  END DO
28  CALL hpsort(l,rij2,ind)
29  lmin=1+nmx
30  lmax=2+nmx
31  ic(lmin)=ij(ind(1),1)
32  ic(lmax)=ij(ind(1),2)
33  used(ind(1))=.true.
34 1 DO i=2,l
35  li=ind(i)
36  IF(.NOT.used(li))THEN
37  CALL redraw(ic,lmin,lmax,ij,li,suc,loop)
38  IF(suc)THEN
39  used(li)=.true.
40  goto 2
41  ELSE
42  used(li)=loop
43  END IF
44  END IF
45  END DO
46 2 IF(lmax-lmin+1.LT.n)go to 1
47  l=0
48  DO i=lmin,lmax
49  l=l+1
50  iname(l)=ic(i)
51  END DO
52 *
53  RETURN
54  END