1 SUBROUTINE chmod(ISUB,KCASE)
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),ksch,y(nmx8)
13 common/chain1/ xch(nmx3),vch(nmx3),m(nmx),
14 & zz(nmx3),wc(nmx3),mc(nmx),
15 & xi(nmx3),pi(nmx3),mass,rinv(nmxm),rsum,mkk(nmx),
16 & mij(nmx,nmx),tkk(nmx),tk1(nmx),iname(nmx),nn
17 common/chainc/ xc(3,ncmax),uc(3,ncmax),bodyc(ncmax),ich,
19 common/slow1/ tk2(0:nmx),ejump,ksch(nmx),kslow2,kcoll
20 common/cpert/ rgrav,gpert,ipert,npert
21 common/chreg/ timec,tmax,rmaxc,cm(10),namec(6),nstep1,kz27,kz30
22 common/clump/ bodys(ncmax,5),t0s(5),ts(5),
steps(5),rmaxs(5),
23 & names(ncmax,5),isys(5)
24 common/ccoll2/ qk(nmx4),pk(nmx4),rik(nmx,nmx),
SIZE(nmx),vstar1,
25 & ecoll1,rcoll,qperi,istar(nmx),icoll,isync,ndiss1
26 common/slow3/ gcrit,kz26
27 common/incond/ x4(3,nmx),xdot4(3,nmx)
34 IF (nnb.EQ.0.OR.nn.GE.6) go to 10
38 rij2 = (x(1,j) - x(1,ich))**2 + (x(2,j) - x(2,ich))**2 +
39 & (x(3,j) - x(3,ich))**2
40 pij = body(j)/(rij2*sqrt(rij2))
49 rdot = (x(1,jclose) - x(1,ich))*(xdot(1,jclose) - xdot(1,ich)) +
50 & (x(2,jclose) - x(2,ich))*(xdot(2,jclose) - xdot(2,ich)) +
51 & (x(3,jclose) - x(3,ich))*(xdot(3,jclose) - xdot(3,ich))
57 IF (gpert.GT.0.05.AND.rdot.GT.0)
THEN
59 IF (gpert.GT.0.5) go to 5
67 rjx2 = rjx2 + (xc(k,l) - x(k,jclose))**2
68 rdi = rdi + (xc(k,l) - x(k,jclose))*
69 & (uc(k,l) - xdot(k,jclose))
72 IF (rdi.LT.0.0.AND.rjx2.LT.rjx**2)
THEN
78 IF (rdx.LT.0.0.AND.rjx.LT.2.0*rsum/float(nn-1))
THEN
79 WRITE (6,4) name(jclose), gpert, rij, rjx, rdx
80 4
FORMAT (
' TRY ABSORB NAM PERT RIJ RJX RDX ',
87 IF (rij.GT.3.0*min(rsum,rmin)) go to 10
88 IF (rdot.GT.0.0.AND.gpert.LT.0.05) go to 10
89 IF (rsum.GT.5.0*rmin.AND.gpert.LT.1.0) go to 10
91 5
IF (nn.GT.3.AND.name(jclose).LT.0) go to 10
92 IF (nn.GT.4.AND.jclose.GT.n) go to 10
95 vr2 = (xdot(1,ich) - xdot(1,jclose))**2 +
96 & (xdot(2,ich) - xdot(2,jclose))**2 +
97 & (xdot(3,ich) - xdot(3,jclose))**2
98 ainv = 2.0/rij - vr2/(mass + body(jclose))
99 ecc2 = (1.0 - rij*ainv)**2 + rdot**2*ainv/(mass + body(jclose))
102 pmin = semi1*(1.0 - ecc)
104 IF (pmin.GT.1.5*rsum.AND.gpert.LT.0.05) go to 10
107 IF (kz(16).GT.2)
THEN
108 IF (gpert.GT.0.05.AND.nch.LE.4.AND.ksmag.LE.5)
THEN
114 WRITE (77,700) time+toff, ksmag, gpert, rmin, rij
115 700
FORMAT (
' INCREASE T KSMAG GPERT RMIN RIJ ',
119 ELSE IF (gpert.LT.0.001.AND.ksmag.GT.1)
THEN
124 WRITE (77,705) time+toff, ksmag, gpert, rmin, rij
125 705
FORMAT (
' REDUCE T KSMAG GPERT RMIN RIJ ',
138 vc2 = (mass + body(jclose))/rij
139 IF ((rsum + rij.LT.rmin).OR.
140 & (rij.LT.2.0*rmin.AND.pmin.LT.rmin).OR.
141 & (rij.LT.rsum.AND.rdot**2.GT.0.5*vc2).OR.
142 & (jclose.GT.n.AND.rij.LT.rsum).OR.
143 & (gpert.GT.0.2.AND.rdot.LT.0.0))
THEN
146 IF (name(jclose).NE.names(nmx,5).AND.names(nmx,5).EQ.0)
THEN
147 names(nmx,5) = name(jclose)
149 ELSE IF (rdot.GT.0.0)
THEN
151 ELSE IF (nn.GT.4.AND.jclose.GT.n.AND.rsum.GT.2.0*rmin)
THEN
156 IF (kz(30).GT.1)
THEN
157 IF (jclose.GT.n)
THEN
158 semi = -0.5*body(jclose)/h(jclose-n)
162 WRITE (6,6) nstep1, jclose, name(jclose), gpert, rij,
164 6
FORMAT (
' ABSORB: # JCLOSE NMJ GPERT RIJ RSUM PMIN A ',
172 fac = max(ksch(k),fac)
184 IF (jclose.GT.n.AND.fac.GT.10.0)
THEN
185 semi = -0.5*body(jclose)/h(jclose-n)
188 rm = min(1.0/rinv(k),rm)
190 small = 0.01*(rsum - rij)
191 IF (rm.LT.small.AND.semi.LT.small)
THEN
192 WRITE (6,9) name(jclose), gpert, semi, rij,
193 & (1.0/rinv(k),k=1,nch-1)
194 9
FORMAT (
' ABSORB INERT NM G A RIJ R ',
212 tblock = min(time,tblock)
217 IF (itry.EQ.1) go to 1
221 10
IF (itry.GT.0) go to 50
224 CALL
hpsort(nn-1,rinv,isort)
230 IF (isort(1).EQ.1)
THEN
233 ELSE IF (isort(1).EQ.nn-1)
THEN
237 ELSE IF (isort(1).EQ.2)
THEN
242 IF (rinv(1).LT.rinv(nn-1)) ibin = nn - 1
244 ELSE IF (isort(1).EQ.nn-2)
THEN
252 IF (kcase.EQ.0.AND.nn.GE.5.AND.
253 & 1.0/rinv(isort(1)).GT.2.0*rmin)
THEN
271 IF (r3.GT.max(r1,r2))
THEN
281 IF (kcase.EQ.0) go to 60
283 IF (kz(30).GT.2)
THEN
284 WRITE (6,12) iesc, jesc, nstep1, isort(1),
285 & (1.0/rinv(k),k=1,nn-1)
286 12
FORMAT (
' CHMOD: IESC JESC # ISORT1 R ',2i3,i6,i3,1p,5e9.1)
303 IF (ibin.EQ.nn - 1) jbin = ibin - 1
306 IF (rb.GT.0.25*rjb)
THEN
308 IF (isort(1).EQ.2)
THEN
321 bcm = bodyc(iesc) + bodyc(jesc)
326 xcm(k) = (bodyc(iesc)*x4(k,iesc) + bodyc(jesc)*x4(k,jesc))/bcm
327 vcm(k) = (bodyc(iesc)*xdot4(k,iesc) +
328 & bodyc(jesc)*xdot4(k,jesc))/bcm
329 ri2 = ri2 + xcm(k)**2
330 rdot = rdot + xcm(k)*vcm(k)
331 vrel2 = vrel2 + (xdot4(k,iesc) - xdot4(k,jesc))**2
335 fac = body(ich)/(body(ich) - bcm)
340 desc = 0.5*sqrt(rsum*rmaxs(isub))
344 cx = rsum/(rsum - rm)
345 IF (cx.GT.25.0) desc = 25.0*rgrav
346 resc = max(3.0*rgrav,desc)
347 ainv = 2.0/rb - vrel2/bcm
348 eb = -0.5*bodyc(iesc)*bodyc(jesc)*ainv
349 hi = 0.5*rdot**2 - body(ich)/ri
352 IF ((ri.GT.resc.AND.rdot.GT.0.0.AND.rb*ainv.GT.0.99).OR.
353 & (hi.GT.0.0.AND.ri.GT.3.0*rmin))
THEN
355 IF (rdot**2.LT.2.0*body(ich)/ri)
THEN
357 gb = 2.0*bcm/(body(ich) - bcm)*((rsum - rjb - rb)/ri)**3
359 IF (nch.EQ.4.AND.gb.LT.0.001)
THEN
364 IF (ri.GT.min(0.5*rmaxs(isub),rmin).AND.nch.LE.4)
THEN
368 ELSE IF (gb.LT.0.01.AND.nch.GT.4.AND.
369 & (rdot**2.GT.body(ich)/ri.OR.ri.GT.rmin))
THEN
370 WRITE (6,28) iesc, jesc, namec(iesc), namec(jesc),
371 & ri, rdot**2, 2.0*body(ich)/ri, rb
377 r13 = 1.0/rinv(1) + 1.0/rinv(3)
378 vc2 = rdot**2*ri/body(ich)
380 IF (r13.LT.0.2/rinv(2).AND.vc2.GT.1.0.AND.
381 & rsum.GT.0.1*rmin)
THEN
391 vinf = sqrt(2.0*hi)*vstar
395 IF (kz(30).GT.1.OR.vinf.GT.1.0)
THEN
396 WRITE (6,28) iesc, jesc, namec(iesc), namec(jesc),
397 & ri, rdot**2, 2.0*body(ich)/ri, rb, vinf
398 28
FORMAT (
' CHAIN ESCAPE: IESC JESC NM RI RDOT2 ',
400 & 2i3,2i6,1p,4e9.1,0p,f6.1)
416 30 ri = sqrt(x4(1,iesc)**2 + x4(2,iesc)**2 + x4(3,iesc)**2)
417 rdot = x4(1,iesc)*xdot4(1,iesc) + x4(2,iesc)*xdot4(2,iesc) +
418 & x4(3,iesc)*xdot4(3,iesc)
419 fac = body(ich)/(body(ich) - bodyc(iesc))
424 rm = min(1.0/rinv(im),ri)
428 desc = 0.5*sqrt(rsum*rmaxs(isub))
430 cx = rsum/(rsum - rm)
431 IF (cx.GT.25.0) desc = 25.0*rgrav
433 resc = max(5.0*rgrav,desc)
434 resc = min(resc,3.0*rmin)
435 IF (nn.EQ.3.AND.resc.LT.0.001*rmin) resc = 5.0*resc
437 IF (nn.EQ.3.AND.gpert.GT.0.01.AND.ri.GT.2.0*rmin) resc = 2.0*rmin
438 IF (rm.GT.resc.AND.rdot.GT.0.0)
THEN
439 IF (rdot**2.LT.2.0*body(ich)/ri)
THEN
440 fac2 = 2.0*bodyc(iesc)/(body(ich) - bodyc(iesc))
441 gi = fac2*((rsum - 1.0/rinv(im))/ri)**3
443 IF (nn.EQ.4.AND.gi.LT.0.01)
THEN
446 IF (1.0/rinv(ib).GT.0.1*rgrav.OR.rsum.GT.rmin)
THEN
454 er = 0.5*rdot**2 - body(ich)/ri
457 IF ((er.LT.0.0.AND.rx.LT.min(2.0*rsum,2.0*rmin)).OR.
458 & (rsum.LT.5.0*rmin.AND.gpert.LT.0.01))
THEN
462 IF (ri.GT.min(0.5*rmaxs(isub),rmin))
THEN
470 zmu = bodyc(j1)*bodyc(j2)/(bodyc(j1) + bodyc(j2))
473 semi = 0.5*rgrav/(1.0 + zf*(1.0 + rgrav*er/mass))
475 IF (ry.LT.0.9*semi.AND.ri.LT.2.0*rmin)
THEN
476 WRITE (6,31) nstep1, ry/semi, ri, rdot**2,
477 & 2.0*body(ich)/ri, semi
491 ELSE IF (nn.GE.4)
THEN
494 IF (rbig.GT.rmin)
THEN
495 IF (im.EQ.1.OR.im.EQ.nn-1)
THEN
501 IF (rbig.GT.0.75*rsum.AND.nn.EQ.4.AND.
502 & rsum.GT.0.5*rmin)
THEN
510 IF (rbig.LT.0.66*rsum)
THEN
520 zmu = bodyc(j1)*bodyc(j2)/(bodyc(j1) + bodyc(j2))
522 er = 0.5*rdot**2 - body(ich)/ri
524 semi = 0.5*rgrav/(1.0 + zf*(1.0 + rgrav*er/mass))
527 IF (ry.LT.0.9*semi.AND.ri.LT.2.0*rmin.AND.
528 & ri.LT.50.0*semi)
THEN
529 WRITE (6,31) nstep1, ry/semi, ri, rdot**2,
530 & 2.0*body(ich)/ri, semi
531 31
FORMAT (
' CHAIN DELAY # R/A RI RD2 VP2 A ',
539 rr = rsum - 1.0/rinv(im)
540 ratio = 1.0/(rinv(im)*rr)
541 IF (ratio.LT.3.0.AND.rsum.LT.rmin)
THEN
546 32 hi = 0.5*rdot**2 - body(ich)/ri
548 vinf = sqrt(2.0*hi)*vstar
552 IF (kz(30).GT.1.OR.vinf.GT.2.0)
THEN
553 WRITE (6,35) iesc, namec(iesc), ri, rdot**2,
554 & 2.0*body(ich)/ri, vinf
555 35
FORMAT (
' CHAIN ESCAPE: IESC NM RI RDOT2 2*M/R VF ',
556 & i3,i6,1p,3e9.1,0p,f6.1)
566 40
IF (nch.GT.3)
THEN
569 rsum = rsum - 1.0/rinv(im) - rb
570 CALL
reduce(iesc,jesc,isub)