1 SUBROUTINE reduce(IESC,JESC,ISUB)
8 parameter(nmx=10,nmx2=2*nmx,nmx3=3*nmx,nmx4=4*nmx,
9 & nmx8=8*nmx,nmxm=nmx*(nmx-1)/2)
10 REAL*8 m,mass,mc,mij,mkk,xcm(3),vcm(3),dxc(3),dvc(3),cg(6)
11 common/chain1/ xch(nmx3),vch(nmx3),m(nmx),
12 & zz(nmx3),wc(nmx3),mc(nmx),
13 & xi(nmx3),pi(nmx3),mass,rinv(nmxm),rsum,mkk(nmx),
14 & mij(nmx,nmx),tkk(nmx),tk1(nmx),iname(nmx),nn
15 common/chainc/ xc(3,ncmax),uc(3,ncmax),bodyc(ncmax),ich,
17 common/chreg/ timec,tmax,rmaxc,cm(10),namec(6),nstep1,kz27,kz30
18 common/clump/ bodys(ncmax,5),t0s(5),ts(5),
steps(5),rmaxs(5),
19 & names(ncmax,5),isys(5)
20 common/ccoll2/ qk(nmx4),pk(nmx4),rik(nmx,nmx),
SIZE(nmx),vstar1,
21 & ecoll1,rcoll,qperi,istar(nmx),icoll,isync,ndiss1
22 common/incond/ x4(3,nmx),xdot4(3,nmx)
28 dt2 = t0s(isub) + timec - tprev
29 dt8 = (tblock - tprev)/8.0d0
30 time = tprev + nint(dt2/dt8)*dt8
31 time = min(tblock,time)
33 t0s(isub) = time - timec
36 WRITE (6,1) time0+toff, time+toff, dt2, dt8
37 1
FORMAT (
' REDUCE: TIME0 TIME DT2 DT8 ',2f12.6,1p,2e10.2)
43 IF (l.EQ.iesc) go to 10
68 dxc(k) = -bodyc(iesc)*x4(k,iesc)/(body(ich) - bodyc(iesc))
69 dvc(k) = -bodyc(iesc)*xdot4(k,iesc)/(body(ich) - bodyc(iesc))
70 xcm(k) = x(k,ich) + dxc(k)
71 vcm(k) = xdot(k,ich) + dvc(k)
81 xch(lk) = xch(lk) - dxc(k)
82 vch(lk) = vch(lk) - dvc(k)
92 IF (name(j).EQ.namec(iesc))
THEN
94 IF (body(j).GT.0.0d0)
WRITE (6,35) i, iesc, namec(iesc)
95 35
FORMAT (
' WARNING! NON-ZERO GHOST I IESC NAMEC ',3i5)
109 DO 45 j = ifirst,ntot
110 IF (name(j).EQ.namec(new))
THEN
117 WRITE (6,48) iesc, namec(new)
118 48
FORMAT (
' REDUCE: DANGER! NO REFERENCE BODY IESC NAME',2i5)
121 mass = mass + m(iesc)
127 jpert(l-1) = list(l,i)
134 IF (kz(30).GT.1)
THEN
135 WRITE (6,53) name0, name(ich), ich
136 53
FORMAT (
' REDUCE: SWITCH C.M. NAME0 NAMECH ICH ',3i5)
145 55 body(ich) = bodych - bodyc(iesc)
152 x0dot(k,ich) = vcm(k)
156 body(i) = bodyc(iesc)
159 x(k,i) = x4(k,iesc) + cm(k)
160 xdot(k,i) = xdot4(k,iesc) + cm(k+3)
162 x0dot(k,i) = xdot(k,i)
168 bodyc(l) = bodyc(l+1)
169 namec(l) = namec(l+1)
171 istar(l) = istar(l+1)
172 bodys(l,isub) = bodys(l+1,isub)
173 names(l,isub) = names(l+1,isub)
186 IF (jclose.EQ.0) np = 1
205 jpert(l-1) = list(l,ich)
224 CALL
fchain(i,0,x(1,i),xdot(1,i),firr,fd)
229 f(k,i) = f(k,i) + firr(k)
230 fdot(k,i) = fdot(k,i) + fd(k)
231 rij2 = rij2 + (x(k,i) - x(k,ich))**2
232 vij2 = vij2 + (xdot(k,i) - xdot(k,ich))**2
233 rdot = rdot + (x(k,i) - x(k,ich))*(xdot(k,i)-xdot(k,ich))
239 vi2 = xdot(1,j)**2 + xdot(2,j)**2 + xdot(3,j)**2
240 IF (vi2.GT.2.0.AND.stepr(j).GE.8.0*step(j))
THEN
241 stepr(j) = stepr(j)/8.0d0
246 hi = 0.5*vij2 - (body(i) + body(ich))/sqrt(rij2)
247 IF (hi.GT.0.0.AND.rdot.GT.0.0)
THEN
252 ELSE IF (jesc.GT.0)
THEN
254 IF (jesc.GT.iesc) jesc = jesc - 1
260 icomp = min(iclose,i)
261 jcomp = max(iclose,i)
266 IF (i.GT.n.AND.jesc.EQ.0)
THEN
279 cg(k) = cg(k) + bodyc(l)*xch(lk)
280 cg(k+3) = cg(k+3) + bodyc(l)*vch(lk)
285 cg(k) = cg(k)/body(ich)
288 IF (kz(30).GT.2)
THEN
289 WRITE (6,97) time+toff, (cg(k),k=1,6)
290 97
FORMAT (
' REDUCE: T CG ',f12.5,1p,6e9.1)