1 SUBROUTINE checkl(I,NNB,XI,XIDOT,RS2,FIRR,FREG,FD,FDR)
8 REAL*8 xi(3),xidot(3),dx(3),dv(3),firr(3),freg(3),fd(3),fdr(3)
13 IF (kz(37).EQ.1) go to 350
23 IF (step(j).LT.smin) lj = l
25 IF (lj.EQ.0) go to 320
29 308
IF (k.GT.list(1,jcomp)) go to 320
32 IF (step(j).GT.smin) go to 308
34 IF (j.LT.ifirst.OR.j.EQ.i) go to 308
35 a1 = x(1,j) - x(1,jcomp)
36 a2 = x(2,j) - x(2,jcomp)
37 a3 = x(3,j) - x(3,jcomp)
38 rij2 = a1**2 + a2**2 + a3**2
40 IF (rij2.GT.rmin22) go to 308
44 IF (cmsep2*r(j-n)**2.GT.rs2) go to 308
48 IF (j.EQ.ilist(l+1)) go to 308
52 312
IF (j.GT.ilist(l)) go to 314
67 dx(k) = x(k,j) - xi(k)
68 dv(k) = xdot(k,j) - xidot(k)
70 drdv = drdv + dx(k)*dv(k)
74 dr3i = body(j)*dr2i*sqrt(dr2i)
78 firr(k) = firr(k) + dx(k)*dr3i
79 freg(k) = freg(k) - dx(k)*dr3i
80 fd(k) = fd(k) + (dv(k) - dx(k)*drdv)*dr3i
81 fdr(k) = fdr(k) - (dv(k) - dx(k)*drdv)*dr3i
85 320
IF (nnb.GE.nnbmax) go to 330
90 IF (ilist(l).GT.ifirst + 3.OR.l.GT.nnb + 1) go to 330
98 IF (jpair.EQ.ipair) go to 321
101 IF (j.EQ.ilist(l)) j = j - 1
103 IF (j.EQ.i) go to 323
105 a1 = x(1,jcomp) - x(1,j)
106 a2 = x(2,jcomp) - x(2,j)
107 a3 = x(3,jcomp) - x(3,j)
108 rij2 = a1*a1 + a2*a2 + a3*a3
110 IF (rij2.LT.rmin22) go to 324
119 dx(k) = x(k,j) - xi(k)
120 dv(k) = xdot(k,j) - xidot(k)
122 drdv = drdv + dx(k)*dv(k)
126 dr3i = body(j)*dr2i*sqrt(dr2i)
130 firr(k) = firr(k) + dx(k)*dr3i
131 freg(k) = freg(k) - dx(k)*dr3i
132 fd(k) = fd(k) + (dv(k) - dx(k)*drdv)*dr3i
133 fdr(k) = fdr(k) - (dv(k) - dx(k)*drdv)*dr3i
137 327
IF (j.GT.ilist(lj)) go to 328
139 ilist(lj+1) = ilist(lj)
141 IF (lj.GT.1) go to 327
147 IF (nnb.LT.nnbmax) go to 321
150 330
IF (listr(1).EQ.0.OR.nnb.GE.nnbmax) go to 350
153 IF (listr(1).EQ.2.AND.listr(2).LE.ifirst + 3) go to 350
155 lj = 1 + 0.2*float(nnb)
160 334 ktime = ktime + 1
161 335
IF (l.GT.nnb1) go to 350
165 IF (jbody.LE.ifirst + 3) go to 335
169 IF (lg.GT.nnb + 1) lg = nnb + 1
170 IF (ilist(lg).LT.jbody.AND.lg.LT.nnb + 1) go to 336
174 IF (ilist(lg).GT.jbody.AND.lg.GT.2) go to 338
175 IF (ilist(lg).EQ.jbody) icase = icase + ktime
176 IF (ktime.EQ.1) go to 334
179 IF (icase.EQ.0.OR.icase.EQ.3) go to 332
183 jcomp = listr(l+icase-2)
185 a1 = x(1,jcomp) - x(1,j)
186 a2 = x(2,jcomp) - x(2,j)
187 a3 = x(3,jcomp) - x(3,j)
188 rij2 = a1*a1 + a2*a2 + a3*a3
190 IF (rij2.GT.rmin22.OR.j.EQ.i) go to 332
196 dx(k) = x(k,j) - xi(k)
197 dv(k) = xdot(k,j) - xidot(k)
199 drdv = drdv + dx(k)*dv(k)
203 dr3i = body(j)*dr2i*sqrt(dr2i)
207 firr(k) = firr(k) + dx(k)*dr3i
208 freg(k) = freg(k) - dx(k)*dr3i
209 fd(k) = fd(k) + (dv(k) - dx(k)*drdv)*dr3i
210 fdr(k) = fdr(k) - (dv(k) - dx(k)*drdv)*dr3i
215 346
IF (j.GT.ilist(k)) go to 348
217 ilist(k+1) = ilist(k)
219 IF (k.GT.1) go to 346
226 350
IF (listv(1).EQ.0.OR.icm.EQ.-1) go to 355
229 IF (j.EQ.i) go to 354
233 rij2 = a1**2 + a2**2 + a3**2
236 IF (rij2.GT.4.0*rs2) go to 354
237 a4 = xdot(1,j) - xdot(1,i)
238 a5 = xdot(2,j) - xdot(2,i)
239 a6 = xdot(3,j) - xdot(3,i)
240 a7 = a1*a4 + a2*a5 + a3*a6
241 IF (a7.GT.0.0) go to 354
242 p2 = rij2 - a7**2/(a4**2 + a5**2 + a6**2)
244 IF (p2.GT.rs2) go to 354
247 IF (j.EQ.ilist(k+1)) go to 354
255 IF (nnb.LE.nnbmax)
THEN
256 IF (i.LE.n) go to 342
257 rij2 = (xi(1) - x(1,j))**2 + (xi(2) - x(2,j))**2 +
258 & (xi(3) - x(3,j))**2
260 IF (rij2.GT.cmsep2*r(i-n)**2.AND.j.LE.n) go to 342
271 IF (rij2.LT.cmsep2*r(j-n)**2)
THEN
280 362 a1 = x(1,k) - x(1,l)
283 rij2 = a1*a1 + a2*a2 + a3*a3
284 dv(1) = xdot(1,k) - xdot(1,l)
285 dv(2) = xdot(2,k) - xdot(2,l)
286 dv(3) = xdot(3,k) - xdot(3,l)
290 dr3i = body(k)*body(l)*dr2i*sqrt(dr2i)/body(i)
291 drdv = 3.0*(a1*dv(1) + a2*dv(2) + a3*dv(3))*dr2i
294 firr(1) = firr(1) + a1*dr3i
295 firr(2) = firr(2) + a2*dr3i
296 firr(3) = firr(3) + a3*dr3i
297 fd(1) = fd(1) + (dv(1) - a1*drdv)*dr3i
298 fd(2) = fd(2) + (dv(2) - a2*drdv)*dr3i
299 fd(3) = fd(3) + (dv(3) - a3*drdv)*dr3i
300 freg(1) = freg(1) - a1*dr3i
301 freg(2) = freg(2) - a2*dr3i
302 freg(3) = freg(3) - a3*dr3i
303 fdr(1) = fdr(1) - (dv(1) - a1*drdv)*dr3i
304 fdr(2) = fdr(2) - (dv(2) - a2*drdv)*dr3i
305 fdr(3) = fdr(3) - (dv(3) - a3*drdv)*dr3i
309 IF (l.EQ.i2) go to 362
311 IF (k.EQ.j2) go to 360
317 IF (l.LE.listv(1) + 1) go to 351