Nbody6
 All Files Functions Variables
mtrace.f
Go to the documentation of this file.
1  SUBROUTINE mtrace(J,DM)
2 *
3 *
4 * Orbit diagnostics for mass loss.
5 * --------------------------------
6 *
7  include 'common6.h'
8  LOGICAL first
9  SAVE first
10  DATA first /.true./
11 *
12 *
13 * Open unit #14 the first time.
14  IF (first) THEN
15  OPEN (unit=14,status='NEW',form='FORMATTED',file='MDOT')
16  first = .false.
17 *
18 * Print cluster scaling parameters at start of the run.
19  IF (nrg.EQ.0) THEN
20  WRITE (14,1) rbar, bodym*zmbar, body1*zmbar, tscale,
21  & nbin0, nzero
22  1 FORMAT (/,6x,'MODEL: RBAR =',f5.1,' <M> =',f6.2,
23  & ' M1 =',f6.1,' TSCALE =',f6.2,
24  & ' NB =',i4,' N0 =',i6,//)
25  END IF
26 *
27  WRITE (14,2)
28  2 FORMAT (' TIME NAME K* M DM r/Rc VR',
29  & ' EI N')
30  END IF
31 *
32 * Evaluate potential energy on GRAPE (#I: single star or binary c.m.).
33  IF (j.GE.ifirst) THEN
34  i = j
35  CALL poti(i,potj)
36  ELSE
37  ks = kvec(j)
38  i = n + ks
39  CALL poti(i,potj)
40  END IF
41 *
42 * Obtain central distance (scaled by core radius) and velocities.
43  ri2 = 0.0
44  vi2 = 0.0
45  vr = 0.0
46  DO 10 k = 1,3
47  ri2 = ri2 + (x(k,i) - rdens(k))**2
48  vi2 = vi2 + xdot(k,i)**2
49  vr = vr + (x(k,i) - rdens(k))*xdot(k,i)
50  10 CONTINUE
51  ri = sqrt(ri2)/rc
52  vr = vr/sqrt(ri2)
53 *
54 * Form binding energy per unit mass (note: POTJ < 0).
55  ei = 0.5*vi2 + potj
56 *
57 * Include optional external tidal field (note: HT includes mass).
58  IF (kz(14).GT.0) THEN
59  CALL xtrnlv(i,i)
60  ei = ei + ht/(body(i) + 1.0e-20)
61  END IF
62 *
63  WRITE (14,20) ttot, name(j), kstar(j), body(j)*zmbar, dm*zmbar,
64  & ri, vr, ei, n
65  20 FORMAT (1x,f8.1,i6,i4,f7.1,f6.2,f7.2,f7.2,f8.3,i6)
66  CALL flush(14)
67 *
68  RETURN
69 *
70  END