9 REAL*8 xcm(3),vcm(3),work(10)
10 INTEGER iflag(kmax),iout(lmax)
13 zkt = -be(1)/float(nzero)
15 IF (level.EQ.0) go to 500
28 semi = -0.5*body(icm)/h(jpair)
29 zn = sqrt(body(icm)/abs(semi)**3)
30 rdot = (x(1,j1) - x(1,j2))*(xdot(1,j1) - xdot(1,j2))
31 & + (x(2,j1) - x(2,j2))*(xdot(2,j1) - xdot(2,j2))
32 & + (x(3,j1) - x(3,j2))*(xdot(3,j1) - xdot(3,j2))
33 ecc = (1.0 - r(jpair)/semi)**2 + rdot**2/(semi*body(icm))
35 apo = abs(semi)*(1.0 + ecc)
36 ri = sqrt((x(1,icm) - rdens(1))**2 + (x(2,icm) - rdens(2))**2 +
37 & (x(3,icm) - rdens(3))**2)
38 zk = 0.5*body(icm)*(xdot(1,icm)**2+xdot(2,icm)**2+xdot(3,icm)**2)
40 eb = body(j1)*body(j2)*h(jpair)/body(icm)
49 IF (time - tlastb(l).LT.dt) dt = time - tlastb(l)
53 IF (level.LT.0) dgam = 1.
54 gs = sign(gamma(jpair),dgam)
55 IF (name(icm).GT.0)
THEN
56 WRITE (4,50) level, time, name(j1), name(j2), eb, semi, ecc,
57 & nk, r(jpair), gs, list(1,j1), ri, zk, dt, tk, m
59 WRITE (4,50) level, time, nzero + name(j1), name(j2), eb,
60 & semi, ecc, nk, r(jpair), gs, list(1,j1), ri, zk,
61 & dt, tk, m, name(j1), -(name(icm) + nzero)
64 50
FORMAT (i3,f8.2,i6,i5,f7.1,f9.5,f6.2,i7,f9.5,f6.2,
65 & i5,f7.2,f6.1,2f10.6,5i5)
78 rij2 = (x(1,icm) - x(1,j))**2 + (x(2,icm) - x(2,j))**2
79 & + (x(3,icm) - x(3,j))**2
80 vij2 = (xdot(1,icm) - xdot(1,j))**2 +
81 & (xdot(2,icm) - xdot(2,j))**2 +
82 & (xdot(3,icm) - xdot(3,j))**2
83 bb = body(icm) + body(j)
86 eb = 0.5*vij2 - bb/rij
88 rdot = (x(1,icm) - x(1,j))*(xdot(1,icm) - xdot(1,j)) +
89 & (x(2,icm) - x(2,j))*(xdot(2,icm) - xdot(2,j)) +
90 & (x(3,icm) - x(3,j))*(xdot(3,icm) - xdot(3,j))
91 eccj = (1.0 - rij/semij)**2 + rdot**2/(semij*bb)
93 p = semij*(1.0 - eccj)
95 eb = -body(j)*body(icm)*eb*bbi/zkt
96 geff = 2.0*body(j)*(abs(semi)/rij)**3/body(icm)
97 IF (geff.GT.99.9) geff = 99.9
99 apo = min(apo,2.0d0/float(n))
102 IF (p.LT.3.*apo.AND.geff.GT.gprint(1))
THEN
103 WRITE (4,100) name(j), eb, semij, eccj, rij, geff, p,rdot
104 100
FORMAT (16x,i6,f7.1,f9.5,f6.2,f16.5,f6.2,f9.5,f7.2)
106 IF (j.GT.n.AND.iflag(j-n).EQ.0) iflag(j-n) = 1
110 IF (rij2.LT.rjmin2)
THEN
123 IF (iout(lmin-1).EQ.0)
THEN
125 WRITE (4,100) name(jmin), (work(k),k=1,7)
126 IF (jmin.GT.n.AND.iflag(jmin-n).EQ.0) iflag(jmin-n) = 1
130 IF(iflag(ip).GT.0)
THEN
133 IF (gamma(jpair).GT.gmax) go to 20
145 500 simax = 0.01*tcr0
154 IF (nam.GT.0) nam = name(nam)
156 DO 600 i = ilow,ihigh
157 IF (step(i).GT.simax) go to 600
164 IF (step(j).GT.simax) go to 250
165 rij2 = (x(1,i) - x(1,j))**2 + (x(2,i) - x(2,j))**2 +
166 & (x(3,i) - x(3,j))**2
167 IF (rij2.GT.rij) go to 250
172 IF (j2.LT.i.AND.ipair.EQ.0) go to 600
174 vij2 = (xdot(1,i) - xdot(1,j2))**2 +
175 & (xdot(2,i) - xdot(2,j2))**2 +
176 & (xdot(3,i) - xdot(3,j2))**2
177 bodyij = body(i) + body(j2)
179 erel = 0.5*vij2 - bodyij/rij
180 IF (
erel.GT.-0.1*eclose) go to 600
181 semi = -0.5*bodyij/
erel
182 zn = sqrt(bodyij/semi**3)
183 rdot = (x(1,i) - x(1,j2))*(xdot(1,i) - xdot(1,j2)) +
184 & (x(2,i) - x(2,j2))*(xdot(2,i) - xdot(2,j2)) +
185 & (x(3,i) - x(3,j2))*(xdot(3,i) - xdot(3,j2))
186 ecc = (1.0 - rij/semi)**2 + rdot**2/(semi*bodyij)
190 xcm(k) = (body(i)*x(k,i) + body(j2)*x(k,j2))*bbi
191 vcm(k) = (body(i)*xdot(k,i) + body(j2)*xdot(k,j2))*bbi
194 ri = sqrt((xcm(1) - rdens(1))**2 + (xcm(2) - rdens(2))**2 +
195 & (xcm(3) - rdens(3))**2)
196 zk = 0.5*bodyij*(vcm(1)**2 + vcm(2)**2 + vcm(3)**2)
198 eb = body(i)*body(j2)*
erel*bbi
207 gb = gb + (f(k,i) - (f(k,j2) + 3.0*fdot(k,j2)*dt))**2
209 gb = 2.0*sqrt(gb)*rij**2*bbi
210 gb = gb*(semi*(1.0 + ecc)/rij)**3
211 IF (gb.GT.99.9) gb = 99.9
217 IF (time - tlastb(l).LT.dt) dt = time - tlastb(l)
221 IF (eb.LT.1.0.AND.gb.GT.0.5) go to 600
223 IF (i.LE.n.AND.j2.LE.n)
THEN
224 WRITE (4,50) level, time, name(i), name(j2), eb, semi,
225 & ecc, nk, rij, gb, list(1,i), ri, zk, dt, tk,
227 ELSE IF (i.LE.n.AND.j2.GT.n)
THEN
230 WRITE (4,50) level, time, name(i), name(j2), eb, semi,
231 & ecc, nk, rij, gb, list(1,i), ri, zk, dt, tk,
232 & nam, name(jj1), name(jj2)
233 ELSE IF (i.GT.n.AND.j2.LE.n)
THEN
236 WRITE (4,50) level, time, name(i), name(j2), eb, semi,
237 & ecc, nk, rij, gb, list(1,i), ri, zk, dt, tk,
238 & nam, name(ii1), name(ii2)
244 WRITE (4,50) level, time, name(i), name(j2), eb, semi,
245 & ecc, nk, rij, gb, list(1,i), ri, zk, dt, tk,
246 & nam, name(ii1), name(ii2), name(jj1),