8 common/binary/ cm(4,mmax),xrel(3,mmax),vrel(3,mmax),
9 & hm(mmax),um(4,mmax),umdot(4,mmax),tmdis(mmax),
10 & namem(mmax),nameg(mmax),kstarm(mmax),iflagm(mmax)
11 common/modes/ eb0(ntmax),zj0(ntmax),ecrit(ntmax),ar(ntmax),
12 & br(ntmax),eosc(4,ntmax),edec(ntmax),tosc(ntmax),
13 & zp(ntmax),es(ntmax),cz(2,ntmax),iosc(ntmax),
15 common/slow0/ range,islow(10)
17 REAL*8 ui(4),uidot(4),xi(6),vi(6),fp(6),fd(6)
32 IF (nnb0.EQ.0.AND.h(ipair).LT.0.0)
THEN
34 IF (name(i).LT.0)
THEN
37 IF (namem(k).EQ.name(i)) im = k
39 IF (im.GT.0.AND.time.GT.tmdis(im))
THEN
40 semi = -0.5*body(i)/h(ipair)
41 ecc2 = (1.0 - r(ipair)/semi)**2 +
42 & tdot2(ipair)**2/(body(i)*semi)
43 rp = semi*(1.0 - sqrt(ecc2))*(1.0 - 2.0*gamma(ipair))
44 IF (rp.LT.r0(ipair))
THEN
45 WRITE (77,4) name(i1), sqrt(ecc2), rp, r0(ipair)
46 4
FORMAT (
' TMDIS TERM NM E RP R0',i7,1p,3e10.2)
50 ELSE IF (kz(27).EQ.2)
THEN
60 IF (namec(k).EQ.nzero - namem(im))
THEN
62 IF ((time - tosc(k))*tstar.GT.10.0)
THEN
67 IF (namec(k).EQ.nameg(im))
THEN
68 IF ((time - tosc(k))*tstar.GT.10.0)
THEN
80 IF (kz(11).NE.0.AND.list(1,i1).EQ.0)
THEN
82 IF (iphase.LT.0) go to 100
86 IF (kz(11).NE.0.AND.nch.EQ.0.AND.list(1,i1).GT.0)
THEN
87 IF (min(kstar(i1),kstar(i2)).GE.10)
THEN
88 semi = -0.5*body(i)/h(ipair)
89 IF (semi.GT.10.0*rmin) go to 100
90 WRITE (6,222) time+toff, name(jclose), kstar(i1),
91 & kstar(i2), list(1,i1), gamma(ipair),
93 222
FORMAT (
' ACTIVATE CHAIN T NMJ K* NP G A R ',
94 & f9.1,i7,3i4,1p,3e10.2)
97 IF (gamma(ipair).LT.1.0d-10)
THEN
103 IF (jclose.GT.n)
THEN
105 IF (ks2.GT.kspair) ks2 = ks2 - 1
108 WRITE (6,223) kspair, ks2, jclose, gamma(jp)
109 223
FORMAT (
' BINARY PERT KSP KS2 JCLOSE GJP ',
125 CALL
kspred(ipair,i1,i,bodyin,ui,uidot,xi,vi)
128 CALL
kspert(i1,nnb0,xi,vi,fp,fd)
133 gi = sqrt(fp(1)**2 + fp(2)**2 + fp(3)**2)*r(ipair)**2*bodyin
137 CALL
kscorr(ipair,ui,uidot,fp,fd,td2,tdot4,tdot5,tdot6)
143 IF (iphase.NE.0) go to 100
151 IF (gi.GT.0.25) go to 2
157 IF (iterm.EQ.0.AND.kstar(i).LT.0)
THEN
162 IF (time + step(i1).GT.tblock)
THEN
164 IF (iphase.GT.0) go to 100
166 ELSE IF (iterm.EQ.2)
THEN
181 IF (step(j).GT.s) go to 10
184 rij2 = (x(1,j) - x(1,k))**2 + (x(2,j) - x(2,k))**2 +
185 & (x(3,j) - x(3,k))**2
186 IF (body(j) + body(k).GT.rij2*fmax) jcomp = j
191 IF (jcomp.GT.0.OR.gi.GT.1.0)
THEN
198 IF (jcomp.LE.n.OR.gi.GT.2.0) iq = .true.
202 20
IF (hi.GT.0.0d0.AND.name(i).GT.0)
THEN
203 IF ((ri.GT.r0(ipair).AND.gi.GT.gmax).OR.ri.GT.2.0*rmin.OR.
204 & (gi.GT.0.5.AND.td2.GT.0.0))
THEN
206 IF (hi.LT.100.0.OR.gi.GT.0.1.OR.ri.GT.5.0*rmin)
THEN
213 IF (abs(hi).GT.eclose)
THEN
216 w1 = r0(ipair)*bodyin
219 IF (ri.GT.r0(ipair)) w1 = w1*r0(ipair)/ri
221 IF (hi.LT.0.0d0)
THEN
224 IF (name(i).LT.0)
THEN
232 IF (gi.LT.0.0005)
THEN
235 w2 = sqrt(w1)/(1.0 + w3*(1.0 - w3))
238 w2 = sqrt(w1)/w3**0.3333
243 dtu = min(1.2*dtau(ipair),dtu)
246 IF (gi.GT.1.0d-04)
THEN
247 dh = 1.0e-03*max(abs(h(ipair)),eclose)
248 xf = 2.0*dh/abs(hdot2(ipair))
249 yf = hdot(ipair)/hdot2(ipair)
250 dtu1 = sqrt(xf + yf**2) - abs(yf)
255 IF (kstar(i).EQ.-2.AND.td2.LT.0.0)
THEN
256 semi = -0.5*body(i)/hi
259 rd = ((one3*tdot5*dtu + tdot4)*dtu +
260 & tdot3(ipair))*dtu + 2.0*td2
263 a2 = 0.5*tdot3(ipair)/tdot4
264 dtu1 = sqrt(a2**2 - 2.0*td2/tdot4) - a2
265 dtu1 = 1.01*max(dtu1,1.0d-10)
273 30 z = -0.5d0*h(ipair)*dtu**2
280 step(i1) = (((((tdot6*dt12 + tdot5*z5)*0.2*dtu + 0.5d0*tdot4)*dtu
281 & + tdot3(ipair))*one6*dtu + td2)*dtu + ri)*dtu
284 IF (step(i1).GT.step(i).AND.hi.LT.0)
THEN
293 zmod = float(islow(imod))
294 step(i1) = zmod*step(i1)
298 IF (kz(10).GE.3)
THEN
299 WRITE (6,40) ipair, time+toff, h(ipair), ri, dtau(ipair),
300 & gi, step(i1), list(1,i1), imod
301 40
FORMAT (3x,
'KS MOTION',i6,2f10.4,1p,4e10.2,2i4)
305 IF (name(i).LT.0)
THEN
308 semi = -0.5*body(i)/hi
314 IF (ga.GT.0.25.AND.ri.GT.semi) iq = .true.
315 IF (ri.GT.20*rmin.AND.nnb0.GT.0.8*list(1,i)) iq = .true.
316 IF (gi.GT.0.1.AND.ri.GT.rmin) iq = .true.
317 IF (gi.GT.0.25) iq = .true.
319 IF (min(body(i1),body(i2)).LT.0.05*bodym)
THEN
320 IF (gi.GT.2.0d-04) iq = .true.
323 IF (td2.GT.0.0.AND.(gi.GT.gmax.OR.ri.GT.rmin)) iq = .true.
325 IF (.NOT.iq) go to 60
334 IF (dtr.LT.step(i1)) go to 90
338 IF (ri.GT.r0(ipair).AND.ri.GT.2.0*rmin.AND..NOT.iq)
THEN
340 IF (kstar(i).LT.0.AND.ri.GT.5.0*rmin) go to 90
342 IF (ri.GT.8.0d-03*rs(i).AND.gi.GT.1.0d-04) go to 90
344 IF (nnb0.LT.0.80*list(1,i).AND.gi.LT.0.1) go to 60
346 IF (hi.LT.-eclose)
THEN
347 semi = -0.5*body(i)/hi
348 r0(ipair) = max(rmin,2.0d0*semi)
349 r0(ipair) = min(r0(ipair),5.0*rmin)
368 60
IF (hi.GE.0.0d0)
THEN
369 IF (rdot*td2.LT.0.0d0)
THEN
371 semi = -0.5d0*body(i)/hi
372 ecc2 = (1.0 - ri/semi)**2 + tdot2(ipair)**2/(body(i)*semi)
373 qperi = semi*(1.0d0 - sqrt(ecc2))
374 dmin2 = min(dmin2,qperi)
377 IF (kz(19).GE.3.AND.kstar(i).LT.10)
THEN
378 vinf = sqrt(2.0*hi)*vstar
381 rx = max(radius(i1),radius(i2))
383 IF (kz(27).LE.2)
THEN
384 rfac =
rpmax2(radius(i1),radius(i2),body(i1),
385 & body(i2),ks1,ks2,vinf)
390 rcap =
rpmax(body(i1),body(i2),vstar,dv,qperi)
392 IF (qperi.LT.5.0*rx)
THEN
393 WRITE (54,54) ttot, name(i1), name(i2), ks1,
394 & ks2, vinf, rcap*su, rx*su, qperi*su
395 54
FORMAT (
' CLOSE T NAM K* VINF RCAP RX QP ',
396 & f7.1,2i6,2i4,f6.2,3f6.1)
398 IF (qperi.LT.rcap)
THEN
400 IF (radius(i2).GT.radius(i1)) j1 = i2
401 fac = 0.5*body(i)/body(j1)
403 IF (kz(27).LE.2)
THEN
404 rcoll = 1.7*fac**0.3333*radius(j1)
406 rcoll = 6.0*body(i)/clight**2
408 WRITE (55,58) ttot, ipair, name(i1), name(i2),
409 & ks1, ks2, kstar(i), vinf
410 58
FORMAT (
' RPMAX: T KS NAM K* VINF ',
411 & f7.1,i5,2i6,3i4,f7.2)
412 WRITE (55,59) sqrt(ecc2), hi, r(ipair), semi,
413 & qperi, body(i1), body(i2),
415 59
FORMAT (
' E H R A QP BODY MT ',
416 & f9.5,1p,6e10.2,0p,f6.1)
420 ri2 = ri2 + (x(k,i) - cmr(k))**2
421 vi2 = vi2 + xdot(k,i)**2
423 WRITE (55,62) sqrt(ri2)/rc, sqrt(vi2)*vstar,
424 & rhod, radius(i1)*su, radius(i2)*su,
425 & rcap, radius(j1)/qperi, rcoll/qperi
426 62
FORMAT (
' r/RC V* <C> R* RCAP R1/QP RCOLL/QP ',
429 IF (qperi.LT.rcoll)
THEN
435 ELSE IF (kstar(i).GE.0.AND.kz(27).GT.0)
THEN
440 ELSE IF (kz(27).EQ.-1.AND.kz(13).LT.0)
THEN
442 IF (qperi.LT.rfac*max(radius(i1),radius(i2)))
THEN
444 IF (radius(i2).GT.radius(i1)) j1 = i2
445 fac = 0.5*body(i)/body(j1)
447 rcoll = 1.7*fac**0.3333*radius(j1)
448 IF (qperi.LT.rcoll)
THEN
449 CALL
touch(ipair,i1,i2,rcoll)
488 70
IF (rdot*td2.GE.0.0d0) go to 100
489 semi = -0.5d0*body(i)/hi
492 IF (rdot.LT.0.0d0)
THEN
494 IF (gi.LT.0.001)
THEN
495 CALL
peri(ui,uidot,ri,body(i1),body(i2),qperi)
499 dmin2 = min(dmin2,qperi)
502 IF (kz(19).GE.3.AND.kstar(i).LE.10.AND.name(i).GT.0)
THEN
504 IF (kz(27).LE.2)
THEN
505 IF (kz(27).EQ.1) rfac = 4.0
506 rx = rfac*max(radius(i1),radius(i2))
508 rx =
rpmin(body(i1),body(i2),vstar,hi,qperi)
510 IF (qperi.LT.rx)
THEN
512 IF (radius(i2).GT.radius(i1)) j1 = i2
513 fac = 0.5*body(i)/body(j1)
515 IF (kz(27).LE.2)
THEN
516 rcoll = 1.7*fac**0.3333*radius(j1)
518 rcoll = 6.0*body(i)/clight**2
520 IF (qperi.LT.rcoll)
THEN
526 ELSE IF (kstar(i).GE.0)
THEN
528 IF (kz(27).EQ.1)
THEN
531 ELSE IF (kz(27).EQ.2.AND.kstar(i).LT.10)
THEN
532 ecc2 = (1.0 - ri/semi)**2 +
533 & tdot2(ipair)**2/(body(i)*semi)
536 CALL
tcirc(qperi,ecc,i1,i2,icirc,tc)
541 IF (kstar(i).GE.10) icirc = 0
543 IF (icirc.GT.0.AND.kz(27).GT.0.AND.
550 IF (kstar(i).EQ.-2.AND.iphase.EQ.0)
THEN
552 ELSE IF (kstar(i).EQ.-1.AND.iphase.EQ.0)
THEN
556 ELSE IF (kz(27).EQ.-1.AND.kz(13).LT.0)
THEN
558 IF (qperi.LT.rfac*max(radius(i1),radius(i2)))
THEN
560 IF (radius(i2).GT.radius(i1)) j1 = i2
561 fac = 0.5*body(i)/body(j1)
563 rcoll = 1.7*fac**0.3333*radius(j1)
564 IF (qperi.LT.rcoll)
THEN
565 CALL
touch(ipair,i1,i2,rcoll)
576 IF (name(i).GT.0)
THEN
578 eb = body(i1)*body(i2)*hi*bodyin
579 IF (eb.LT.ebh) r0(ipair) = max(rmin,2.0*semi)
581 ecc2 = (1.0 - ri/semi)**2 + tdot2(ipair)**2/(body(i)*semi)
583 rp = semi*(1.0 - ecc)*(1.0 - 2.0*gi)
587 IF (namem(k).EQ.name(i)) im = k
590 IF (min(body(i1),body(i2)).LT.0.05*bodym)
THEN
591 IF (rp.LT.r0(ipair)) go to 90
594 IF (kz(42).GT.0)
THEN
595 CALL
kozai(ipair,im,ecc,semi,iterm)
601 IF (iterm.GT.1) CALL
circ
606 IF (rp.LT.1.04*r0(ipair))
THEN
608 CALL
assess(ipair,im,ecc,semi,iterm)
615 IF (im.GT.0.AND.(time.GT.tmdis(im).OR.
616 & tmdis(im).GT.1.0d+06))
THEN
617 IF (kz(27).EQ.2)
THEN
626 IF (namec(k).EQ.nzero - namem(im).AND.
627 & kstarm(im).EQ.-2)
THEN
629 IF ((time - tosc(k))*tstar.GT.10.0) go to 90
631 IF (namec(k).EQ.nameg(im).AND.
632 & kstarm(im).EQ.-2)
THEN
633 IF ((time - tosc(k))*tstar.GT.10.0) go to 90
642 IF (kstar(i).EQ.-2.AND.gi.GT.0.01)
THEN
644 qps = semi*(1.0 - ecc)/max(radius(i1),radius(i2))
645 zm = body(i1)/body(i2)
646 WRITE (21,80) ttot, name(i1), name(i2), kstar(i1), kstar(i2),
647 & list(1,i1), qps, zm, gi, ecc, semi
648 80
FORMAT (
' PERT SPIRAL T NAM K* NP QP/S M1/M2 G E A ',
649 & f11.4,2i6,3i3,2f5.1,2f8.4,1p,e10.2)
654 IF (kz(26).GT.0.AND.kstar(i).GE.0)
THEN
655 kmod = range*gmin/max(gi,1.0d-10)
656 IF (kmod.GT.1.OR.imod.GT.1)
THEN
657 CALL
ksmod(ipair,kmod)
658 IF (kmod.LT.0) go to 100
664 tk = twopi*semi*sqrt(semi*bodyin)*(1.0 + gi)
670 IF (time + tk.LT.t0(i) + step(i))
THEN
678 IF (kstar(i).EQ.-2.AND.list(1,i1).EQ.0)
THEN
681 IF (iphase.LT.0) go to 100
687 IF (kz(11).NE.0.AND.nch.EQ.0.AND.body(i).GT.10.0*bodym.AND.
688 & semi.LT.rmin.AND.list(1,i1).LE.5.AND.name(i).GT.0)
THEN
690 IF (semi.GT.0.1*rmin) go to 88
692 IF (kz(11).LE.-2)
THEN
693 IF (kstar(i1).NE.14.OR.kstar(i2).NE.14) go to 88
696 rcr2 = rmin2*body(i)/(10.0*bodym)
697 nnb1 = list(1,i1) + 1
702 rij2 = (x(1,i) - x(1,j))**2 + (x(2,i) - x(2,j))**2 +
703 & (x(3,i) - x(3,j))**2
704 rd = (x(1,i)-x(1,j))*(xdot(1,i)-xdot(1,j)) +
705 & (x(2,i)-x(2,j))*(xdot(2,i)-xdot(2,j)) +
706 & (x(3,i)-x(3,j))*(xdot(3,i)-xdot(3,j))
707 IF (rij2.LT.rcr2.AND.rd.LT.0.0.OR.
708 & (rij2.LT.4.0*semi**2))
THEN
709 IF (rij2.LT.rx2)
THEN
716 IF (jclose.GT.0)
THEN
717 IF (name(jclose).LE.0) go to 88
720 zmu = body(i)*body(jclose)/(body(i) + body(jclose))
721 ebt = eb + zmu*(0.5*(rrd/rx)**2-(body(i)+body(jclose)/rx))
722 IF (ebt.GT.50.0*ebh) go to 88
723 WRITE (6,86) ttot, name(jclose), list(1,i1), step(i),
724 & step(jclose), semi, rx, gi, ebt
725 86
FORMAT (
' NEW CHAIN T NMJ NP STEPI STEPJ A RIJ GI EBT ',
726 & f9.3,i6,i4,1p,6e10.2)
735 IF (jclose.LE.n)
THEN
740 IF (ks2.GT.ipair) jclose = jclose - 1
741 IF (ks2.GT.ipair) ks2 = ks2 - 1
750 88
IF (kz(15).GT.0.AND.step(i).LT.dtmin)
THEN
760 IF (name(i).LT.0) iphase = 7