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),xrel(3),vcm(3),vrel(3)
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/ccoll2/ qk(nmx4),pk(nmx4),rik(nmx,nmx),
SIZE(nmx),vstar1,
19 & ecoll1,rcoll,qperi,istar(nmx),icoll,isync,ndiss1
22 REAL*8 lums(10),tscls(20),gb(10),m01,m1,tm,tn,lum1,lum2,aj1,r1,
23 & m02,m2,aj2,r2,sep,mi(2),mc1,mc2,rcc
24 REAL*8 jspin1,jspin2,menv,renv,k2
29 IF(kstar(j1).GE.2.AND.kstar(j1).LE.9.AND.kstar(j1).NE.7)
THEN
38 zmb0 = body(i1) + body(i2)
39 zmu0 = body(i1)*body(i2)/zmb0
47 xrel(k) = x(k,i1) - x(k,i2)
48 vrel(k) = xdot(k,i1) - xdot(k,i2)
49 rij2 = rij2 + xrel(k)**2
50 vij2 = vij2 + vrel(k)**2
51 rdot = rdot + xrel(k)*vrel(k)
52 xcm(k) = (body(i1)*x(k,i1) + body(i2)*x(k,i2))/zmb0
53 vcm(k) = (body(i1)*xdot(k,i1) + body(i2)*xdot(k,i2))/zmb0
54 vcm2 = vcm2 + vcm(k)**2
60 hi = 0.5d0*vij2 - zmb0/rij0
61 semi0 = 2.d0/rij0 - vij2/zmb0
65 ecc2 = (1.d0 - rij0/semi0)**2 + rdot**2/(semi0*zmb0)
69 semi0 = -0.5d0*m(k10)*m(k20)/ebs
70 hi = -0.5d0*(m(k10) + m(k20))/semi0
85 tev1 = max(tev0(i1),tev0(i2))
89 aj1 = tev1*tstar - epoch(i1)
90 jspin1 = spin(i1)*spnfac
95 aj2 = tev1*tstar - epoch(i2)
96 jspin2 = spin(i2)*spnfac
103 1 CALL
comenv(m01,m1,mc1,aj1,jspin1,kw1,
104 & m02,m2,mc2,aj2,jspin2,kw2,ecc,sep,coals)
107 CALL
star(kw1,m01,m1,tm,tn,tscls,lums,gb,zpars)
108 CALL
hrdiag(m01,aj1,m1,tm,tn,tscls,lums,gb,zpars,
109 & r1,lum1,kw1,mc1,rcc,menv,renv,k2)
110 if(kw1.ne.kstar(i1))
then
111 write(38,*)
' EXPEL2 TYPE CHANGE1 ',kstar(i1),kw1
112 write(38,*)
' EXPEL2 TYPE CHANGE1 ',i1,name(i1),time
120 CALL
star(kw2,m02,m2,tm,tn,tscls,lums,gb,zpars)
121 CALL
hrdiag(m02,aj2,m2,tm,tn,tscls,lums,gb,zpars,
122 & r2,lum2,kw2,mc2,rcc,menv,renv,k2)
123 if(kw2.ne.kstar(i2))
then
124 write(38,*)
' EXPEL2 TYPE CHANGE2 ',kstar(i2),kw2
128 dmsun = m1 + m2 - zmb0*smu
129 IF (abs(dmsun).LT.1.0d-12.AND..NOT.coals)
THEN
139 IF (ecc0.GT.0.001d0.AND.ecc.LE.0.001d0)
THEN
144 IF (r1.GT.rl1*sep.OR.r2.GT.rl2*sep)
THEN
147 WRITE (6,8) rl1*sep, rl2*sep
148 8
FORMAT (
' ENFORCED CHAIN CE RL*SEP ',1p,2e10.2)
161 spin(i1) = jspin1/spnfac
162 spin(i2) = jspin2/spnfac
165 body0(i1) = m01/zmbar
166 body0(i2) = m02/zmbar
169 ecoll = ecoll + zmu0*hi
170 chcoll = chcoll + zmu0*hi
171 egrav = egrav + zmu0*hi
174 epoch(i1) = tev1*tstar - aj1
180 IF(kstar(i2).GE.13.AND.kw1.GE.13)
THEN
183 10
FORMAT (
' NEW TZ M1 M2 ',2f7.2)
186 CALL
coal(ipair,kw1,kw2,mi)
192 epoch(i2) = tev1*tstar - aj2
197 tmdot = min(tmdot,tev1)
203 zmb = body(i1) + body(i2)
204 zmu = body(i1)*body(i2)/zmb
220 efac = sqrt((1.0 - ecc)/(1.0 + ecc))
224 xrel(k) = xrel(k)*semi/rij0
225 xrel(k) = (1.0 + ecc)*xrel(k)
226 x(k,i1) = xcm(k) + body(i2)*xrel(k)/zmb
227 x(k,i2) = xcm(k) - body(i1)*xrel(k)/zmb
228 vrel(k) = sqrt(zmb/(semi*vij2))*vrel(k)
229 vrel(k) = efac*vrel(k)
230 xdot(k,i1) = vcm(k) + body(i2)*vrel(k)/zmb
231 xdot(k,i2) = vcm(k) - body(i1)*vrel(k)/zmb
236 v2 = zmb*(2.0/rij0 - 1.0/semi)
237 v20 = vrel(1)**2 + vrel(2)**2 + vrel(3)**2
239 vrel(k) = sqrt(v2/v20)*vrel(k)
240 xdot(k,i1) = vcm(k) + body(i2)*vrel(k)/zmb
241 xdot(k,i2) = vcm(k) - body(i1)*vrel(k)/zmb
242 x(k,i1) = xcm(k) + body(i2)*xrel(k)/zmb
243 x(k,i2) = xcm(k) - body(i1)*xrel(k)/zmb
255 ecoll = ecoll - zmu*hf
256 chcoll = chcoll - zmu*hf
257 ecdot = ecdot + 0.5*dm*vcm2
258 egrav = egrav - zmu*hf
264 DO 50 j = ifirst,ntot
265 IF (j.NE.i1.AND.j.NE.i2.AND.j.NE.i3.AND.j.NE.i4)
THEN
266 rij2 = (x(1,j) - xcm(1))**2 +
267 & (x(2,j) - xcm(2))**2 +
268 & (x(3,j) - xcm(3))**2
269 potj = potj - body(j)/sqrt(rij2)
275 CALL
nbpot(2,np,pot2)
278 IF (kz(14).EQ.1)
THEN
279 ecdot = ecdot - 0.5d0*dm*(tidal(1)*xcm(1)**2 +
280 & tidal(3)*xcm(3)**2)
284 ecdot = ecdot + dm*potj + (pot2 - pot1)
286 WRITE (6,55) dm*potj, sqrt(rx), semi00*su, semi0*su, ebs
287 55
FORMAT (
' EXPEL2 DM*POTJ RX A00 A0 EBS ',1p,6e10.2)
288 WRITE (6,60) (name(jlist(k)),k=1,4), kstar(i1), kstar(i2),
289 & kw1, kw2, m1, m2, dm*zmbar, ecc, r1, r2,
290 & semi0*su, semi*su, ebs, pot2-pot1
291 60
FORMAT (
' CHAIN CE NAM K0* K* M1 M2 DM E R1 R2 A0 A EB DP',
292 & 4i6,4i3,3f5.1,f8.4,2f6.1,2f8.1,1p,2e9.1)
294 IF (semi0.LT.0.0)
THEN
295 WRITE (6,61) time+toff
296 61
FORMAT (
' HYPERB CHAIN CE T ',f7.1)
302 IF (ecc.LE.0.001d0) nce = nce + 1
304 IF (kw1.GE.10.AND.kw1.LE.14)
THEN
309 CALL
kick(i1,1,kw1,dm)
319 vrel(k) = xdot(k,ich)
331 xcm(k) = xcm(k) + body(j)*x(k,j)
332 vcm(k) = vcm(k) + body(j)*xdot(k,j)
338 xdot(k,ich) = vcm(k)/zm
345 IF (i4.GT.0) b4 = body(i4)
349 IF (i4.GT.0) body(i4) = b4
353 IF (dmsun.LT.0.2)
THEN
356 nnb1 = list(1,ich) + 1
359 IF (dmsun.LT.0.2)
THEN
364 CALL
dtchck(time,step(j),dtk(40))
366 x0dot(kk,j) = xdot(kk,j)
372 IF (sjr.GT.1.0d-04) stepr(j) = sjr
379 IF (i4.GT.0) body(i4) = b4
382 xdot(k,ich) = vrel(k)