8 REAL*8 xorb(2),vorb(2),xrel(3),vrel(3),px(3),qx(3),bs(nmax)
10 DATA eta1,eta2 /2.5,45.0/
13 READ (5,*) semi0, ecc0, ratio, range, nskip, idorm, icirc
16 WRITE (6,1) nbin, semi0, ecc0, ratio, range, nskip, idorm, icirc
17 1
FORMAT (/,12x,
'BINARIES: NBIN =',i5,
' A =',f9.6,
' E =',f6.2,
18 &
' RATIO =',f4.1,
' RANGE =',f6.1,
' NSKIP =',i3,
19 &
' IDORM =',i2,
' ICIRC =',i2,/)
22 IF (nskip.EQ.0.OR.kz(20).GE.2) go to 10
23 IF (ratio.EQ.1.0) go to 20
26 ilast = (1 + nskip)*nbin
35 IF (jskip.GT.nskip)
THEN
54 10
DO 15 i = n,nbin1,-1
64 20
DO 30 i = nbin,2,-1
77 pi = twopi*
ran2(idum1)
78 omega = twopi*
ran2(idum1)
79 zi = 0.5*twopi*
ran2(idum1)
82 px(1) = cos(pi)*cos(omega) - sin(pi)*sin(omega)*cos(zi)
83 qx(1) =-sin(pi)*cos(omega) - cos(pi)*sin(omega)*cos(zi)
84 px(2) = cos(pi)*sin(omega) + sin(pi)*cos(omega)*cos(zi)
85 qx(2) =-sin(pi)*sin(omega) + cos(pi)*cos(omega)*cos(zi)
86 px(3) = sin(pi)*sin(zi)
87 qx(3) = cos(pi)*sin(zi)
95 ELSE IF (ratio.EQ.1.0)
THEN
98 body(i1) = ratio*body(i1)
99 body(i2) = body(i1)*(1.0 - ratio)/ratio
103 IF (ecc0.LT.0.0)
THEN
106 IF (kz(18).GT.1) ecc = min(ecc,0.9d0)
114 exp1 = exp(2.d0*
ran2(idum1)/2.5d0) - 1.d0
115 exp1 = sqrt(exp1*45.d0) + 1.d0
117 exp1 = 10**exp1 /365.25d0
119 semi = (body(i1)+body(i2))*zmbar*exp1*exp1
120 semi = semi**(1.d0/3.d0)
122 semi = semi/206259.591d0
125 ELSE IF (range.GT.0.0)
THEN
126 exp1 =
ran2(idum1)*log10(range)
127 semi = semi0/10.0**exp1
139 zmb = (body(i1) + body(i2))*zmbar
141 pmin = max(range,1.0d0)
145 p0 = log10(pmin) + sqrt(eta2*(exp(2.0*
xr/eta1) - 1.0))
151 rp0 = (1.0 - es0)*((tk/365.0)**2*zmb)**0.3333
157 IF (a0*rau.GT.1000.0) go to 35
161 IF (body(i1)*zmbar.LT.0.7) kstar(i1) = 0
162 IF (body(i2)*zmbar.LT.0.7) kstar(i2) = 0
163 radius(i1) = 5.0*sqrt(body(i1)*zmbar)/su
164 radius(i2) = 5.0*sqrt(body(i2)*zmbar)/su
165 IF (rp0.LT.max(radius(i1),radius(i2)))
THEN
166 WRITE (6,38) i1, zmb, es0, a0, rp0
167 38
FORMAT (12x,
'COLLISION: I1 MB E A RP ',
168 & i6,f6.1,f7.3,1p,2e10.2)
174 CALL
tcirc(rp0,es0,i1,i2,icirc,tc)
177 semi = rp0/(1.0 - ecc)
179 IF (semi.GT.semi0.AND.it.LT.25) go to 35
180 tk = 365.0*sqrt((semi*rau)**3/zmb)
181 IF (ecc.LE.0.002) ic0 = ic0 + 1
182 IF (tk.LT.pmin) ic1 = ic1 + 1
183 IF (tk.LT.2.0*pmin) ic2 = ic2 + 1
184 IF (tk.LT.5.0*pmin) ic3 = ic3 + 1
185 WRITE (23,40) it, i1, zmb, e0, ecc, a0, semi, tk
186 40
FORMAT (12x,
'BINARY: IT I1 MB E0 E A0 A P ',
187 & i2,i5,f5.1,2f7.3,1p,3e10.2)
189 ELSE IF (kz(27).EQ.1.OR.kz(19).GE.3)
THEN
192 zm = max(body(i1),body(i2))*zmbar
193 rt = 4.0*rsun*sqrt(zm)
194 IF (kstar(i1).GT.1.OR.kstar(i2).GT.1) rt = 0.d0
196 42
IF (semi*(1.0 - ecc).LT.2.0*rt)
THEN
198 44
IF (semi.LT.2.0*rt)
THEN
204 WRITE (51,46) i1, i2, ecc, semi, semi*(1.0-ecc), rt
205 46
FORMAT (12x,
'REDUCE ECC: I1 I2 E A PM RT ',
206 & 2i5,f7.3,1p,3e10.2)
214 CALL
proto_star(zmbar,rbar,body(i1),body(i2),ecc,semi)
218 xorb(1) = semi*(1.0 + ecc)
220 xorb(1) = semi*(1.0 + ecc)
223 zmbin = body(i1) + body(i2)
224 vorb(2) = sqrt(zmbin*(1.0d0 - ecc)/(semi*(1.0d0 + ecc)))
225 ebin0 = ebin0 - 0.5*body(i1)*body(i2)/semi
229 xrel(k) = px(k)*xorb(1) + qx(k)*xorb(2)
230 vrel(k) = px(k)*vorb(1) + qx(k)*vorb(2)
235 x(k,i1) = x(k,i1) + body(i2)*xrel(k)/zmbin
236 x(k,i2) = x(k,i1) - xrel(k)
237 xdot(k,i1) = xdot(k,i1) + body(i2)*vrel(k)/zmbin
238 xdot(k,i2) = xdot(k,i1) - vrel(k)
243 IF (ratio.LT.1.0.OR.kz(20).GE.2)
THEN
247 bodym = zmass/float(n)
249 WRITE (6,62) (body(j),j=1,10)
250 WRITE (6,64) (body(j),j=2*nbin+1,2*nbin+10)
251 62
FORMAT (/,12x,
'BINARY MASSES (1-10): ',10f9.5)
252 64
FORMAT (/,12x,
'SINGLE MASSES (1-10): ',10f9.5,/)
261 zmbin = body(i1) + body(i2)
263 x(k,i) = (body(i1)*x(k,i1) + body(i2)*x(k,i2))/zmbin
264 xdot(k,i) = (body(i1)*xdot(k,i1) +
265 & body(i2)*xdot(k,i2))/zmbin
278 xdot(k,i2) = xdot(k,i)
288 IF (kz(8).EQ.1) kz(8) = 0
299 cmr(k) = cmr(k) + body(i)*x(k,i)
300 cmrdot(k) = cmrdot(k) + body(i)*xdot(k,i)
306 x(k,i) = x(k,i) - cmr(k)/zmass
307 xdot(k,i) = xdot(k,i) - cmrdot(k)/zmass