C***********************************************************************
C
	SUBROUTINE SMTH13
C
C	PEAK SMOOTHING ROUTINE
C
C		THIS ROUTINE PERFORMS A 13 POINT SAVITSKY-GOLAY
C	   SMOOTH ON 50 DATA POINTS.  THIS SIZE GROUP IS WHAT IS
C	   COLLECTED BY SUBROUTINE PKFIND AROUND THE APPROXIMATE
C	   PEAK POSITION.
C	## This was taken from the old version.
C
C  CONVOLUTING INTEGERS ARE -11,0,9,16,21,24,25
C  NORMALIZING FACTOR IS    143	(= (N-1)**2 - 1  WHERE N=13 HERE)
C
C  FLOATING POINT ARITHMETIC IS USED TO AVOID THE OVERFLOW
C  THAT OCCURS USING 16 BIT INTEGERS (I*2).
C
C======================================================================
C
      INCLUDE 'COMMON.FTN'
C Uses CNT of /CNTCMN/ as the array of intensity values to be smoothed.
C The smoothed values are to be returned in the same array.
C
	DIMENSION SAVE(6)
C  SAVE = a scratch array for saving data values so that the
C         smoothed values can be placed back into the CNT array.
C
C======================================================================
C
C  MOVE THE FIRST SIX RAW DATA POINTS INTO THE SCRATCH ARRAY
C
	DO 10 I=1,6
10	SAVE(I) = CNT(I)
C
C  TOP OF THE SMOOTHING LOOP
C
	DO 30 I=1,38
C
C======================================================================
C
C	CALCULATE THE SMOOTHED POINT
C
	SUM =     - 11.0 * (SAVE(1) + CNT(I+12))
	SUM = SUM +  9.0 * (SAVE(3) + CNT(I+10))
	SUM = SUM + 16.0 * (SAVE(4) + CNT(I+ 9))
	SUM = SUM + 21.0 * (SAVE(5) + CNT(I+ 8))
	SUM = SUM + 24.0 * (SAVE(6) + CNT(I+ 7))
	SUM = SUM + 25.0 *  CNT(I+6)
C
C
C  SHIFT VALUES IN THE SCRATCH DATA ARRAY
C
	DO 20 J=1,4
20	SAVE(J) = SAVE(J+1)
C
C  GET THE NEXT VALUE FROM THE DATA
C
	SAVE(6) = CNT(I+6)
C
C  STORE THE SMOOTHED DATA POINT BACK IN THE DATA ARRAY
C
	CNT(I+6) = SUM/143.0
C
C======================================================================
C
C  BOTTOM OF THE SMOOTHING LOOP
C
30	CONTINUE
C
	RETURN
	END
