	program rms
c
	open(10,file = 'grading.wsi8',status = 'UNKNOWN')
	open(11,file = 'grading.wsi.rms',status = 'UNKNOWN')
c
	en0 = 0.
	en1 = 0.
	en2 = 0.
	en3 = 0.
	en4 = 0.
	en5 = 0.
	en6 = 0.
	t0 = 0.
	t1 = 0.
	t2 = 0.
	t3 = 0.
	t4 = 0.
	t5 = 0.
	t6 = 0.
	r0 = 0.
	r1 = 0.
	r2 = 0.
	r3 = 0.
	r4 = 0.
	r5 = 0.
	r6 = 0.
c
c	tbar0 = 0.
c	tbar1 = 0.
c	tbar2 = 0.
c	tbar3 = 0.
c	tbar4 = 0.
c	tbar5 = 0.
c	tbar6 = 0.
c
	t0a = 2.5 * .7780
	t1a = 2.5 * 1.0425
	t2a = 2.5 * 1.1488
	t3a = 2.5 * 0.7042
	t4a = 2.5 * 0.8449
	t5a = 2.5 * 0.6613
	t6a = 2.5 * .9086
	r0a = 2.5 * .0300
	r1a = 2.5 * 0.0283
	r2a = 2.5 * 0.0209
	r3a = 2.5 * 0.0262
	r4a = 2.5 * 0.0452
	r5a = 2.5 * 0.0546
	r6a = 2.5 * .0273
c
c	t0a = 999.
c	t1a = 999.
c	t2a = 999.
c	t3a = 999.
c	t4a = 999.
c	t5a = 999.
c	t6a = 999.
c	r0a = 999.
c	r1a = 999.
c	r2a = 999.
c	r3a = 999.
c	r4a = 999.
c	r5a = 999.
c	r6a = 999.
c
  100	read(10,901,end = 200) date,ennt,npaper,theta,rho,sep
  901	format(t2,f9.4,t24,f1.0,t29,i1,t76,f6.2,f8.4,t65,f7.2)
c	sep = 1.
	sep=sep*ennt
c
c  	first detemine rms values for all measurements,
c	then for individual papers
c
  	if (abs(theta) .gt. t0a) go to 110
  	if (abs(rho) .gt. r0a) go to 110
  	en0 = en0+sep*ennt
  	t0 = t0+(theta-tbar0)*(theta-tbar0)*sep
  	r0 = r0+rho*rho*sep
c  	t0 = t0+theta
c  	r0 = r0+rho
c
  110  	if (npaper .eq. 1) go to 120
  	if (npaper .eq. 2) go to 130
  	if (npaper .eq. 3) go to 140
  	if (npaper .eq. 4) go to 150
  	if (npaper .eq. 5) go to 160
  	if (npaper .eq. 6) go to 170
	go to 100
  120	if (abs(theta) .gt. t1a) go to 100
  	if (abs(rho) .gt. r1a) go to 100
  	en1 = en1+sep
  	t1 = t1+(theta-tbar1)*(theta-tbar1)*sep
  	r1 = r1+rho*rho*sep
c  	t1 = t1+theta
c  	r1 = r1+rho
  	go to 100
  130	if (abs(theta) .gt. t2a) go to 100
  	if (abs(rho) .gt. r2a) go to 100
  	en2 = en2+sep
  	t2 = t2+(theta-tbar2)*theta-(tbar2)*sep
  	r2 = r2+rho*rho*sep
c  	t2 = t2+theta
c  	r2 = r2+rho
  	go to 100
  140	if (abs(theta) .gt. t3a) go to 100
  	if (abs(rho) .gt. r3a) go to 100
  	en3 = en3+sep
  	t3 = t3+(theta-tbar3)*(theta-tbar3)*sep
  	r3 = r3+rho*rho*sep
c  	t3 = t3+theta
c  	r3 = r3+rho
  	go to 100
  150	if (abs(theta) .gt. t4a) go to 100
  	if (abs(rho) .gt. r4a) go to 100
  	en4 = en4+sep
  	t4 = t4+(theta-tbar4)*(theta-tbar4)*sep
  	r4 = r4+rho*rho*sep
c  	t4 = t4+theta
c  	r4 = r4+rho
  	go to 100
  160	if (abs(theta) .gt. t5a) go to 100
  	if (abs(rho) .gt. r5a) go to 100
  	en5 = en5+sep
  	t5 = t5+(theta-tbar5)*(theta-tbar5)*sep
  	r5 = r5+rho*rho*sep
c  	t5 = t5+theta
c  	r5 = r5+rho
  	go to 100
  170	if (abs(theta) .gt. t6a) go to 100
  	if (abs(rho) .gt. r6a) go to 100
  	en6 = en6+sep
  	t6 = t6+(theta-tbar6)*(theta-tbar6)*sep
  	r6 = r6+rho*rho*sep
c  	t6 = t6+theta
c  	r6 = r6+rho
  	go to 100
c
  200	t0 = sqrt(t0/en0)
  	t1 = sqrt(t1/en1)
  	t2 = sqrt(t2/en2)
  	t3 = sqrt(t3/en3)
  	t4 = sqrt(t4/en4)
  	t5 = sqrt(t5/en5)
  	t6 = sqrt(t6/en6)
  	r0 = sqrt(r0/en0)
  	r1 = sqrt(r1/en1)
  	r2 = sqrt(r2/en2)
  	r3 = sqrt(r3/en3)
  	r4 = sqrt(r4/en4)
  	r5 = sqrt(r5/en5)
  	r6 = sqrt(r6/en6)
c
c  200	t0 = (t0/en0)
c   	t1 = (t1/en1)
c  	t2 = (t2/en2)
c  	t3 = (t3/en3)
c  	t4 = (t4/en4)
c  	t5 = (t5/en5)
c  	t6 = (t6/en6)
c  	r0 = (r0/en0)
c  	r1 = (r1/en1)
c  	r2 = (r2/en2)
c  	r3 = (r3/en3)
c  	r4 = (r4/en4)
c  	r5 = (r5/en5)
c  	r6 = (r6/en6)
c
	write(11,902) en0,t0,r0
	write(11,902) en1,t1,r1
  	write(11,902) en2,t2,r2
  	write(11,902) en3,t3,r3
  	write(11,902) en4,t4,r4
  	write(11,902) en5,t5,r5
  	write(11,902) en6,t6,r6
  902	format(3f12.4)
  	stop
  	end
