PROGRAM limitsdiam c Give limits of Diamond file CHARACTER*65 filnam REAL xmin /1.e9/, xmax /-1.e9/, ymin /1.e9/, 1 ymax /-1.e9/, zmin /1.e9/, zmax /-1.e9/, 2 rmin /1.e9/, rmax /0./ WRITE (6, 1000) 'Enter input file name:' 1000 FORMAT (a) READ (5, 1000) filnam OPEN (unit=1, form='FORMATTED', status='OLD', readonly, 1 file=filnam) c Skip header records READ (1, 1001) READ (1, 1001) READ (1, 1001) c Main loop sb = 0. sx = 0. sy = 0. sz = 0. sr = 0. num = 0 DO WHILE (.TRUE.) READ (1, 1001, end=9) x, y, z, b 1001 FORMAT (4f10.4) num = num + 1 r = x*x + y*y + z*z xmin = MIN(xmin,x) xmax = MAX(xmax,x) ymin = MIN(ymin,y) ymax = MAX(ymax,y) zmin = MIN(zmin,z) zmax = MAX(zmax,z) rmin = MIN(rmin,r) rmax = MAX(rmax,r) sb = sb + b sx = sx + x sy = sy + y sz = sz + z sr = sr + x*x + y*y + z*z endDO 9 CLOSE (unit=1) c Write limits sx = sx/num sy = sy/num sz = sz/num sr = sr/num sb = sb/num WRITE (6, 1002) 'CRYS', xmin, xmax, ymin, ymax, zmin, zmax 1002 FORMAT (1x, a4, 4x, 3(2f10.5, 3x)) WRITE (6, 1002) 'CM ', sx, sy, sz WRITE (6, 1002) 'Rad ', SQRT(rmin), SQRT(rmax), SQRT(sr), 1 SQRT(sr - sx*sx - sy*sy - sz*sz) WRITE (6, 1002) ' ', sb end