     	SUBROUTINE RLSXRR
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   MAY-1987
C
C	THIS ROUTINE READS THE PEAK LIST SECTION FROM AN X-RAY
C	RIETVELD OUTPUT FILE AND STORES IN THE COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER TEXT*95
     	DIMENSION RP(11), KP(11)

     	CLOSE( UNIT=IINP )
     	OPEN( UNIT=IINP, FILE=FILINP, STATUS='OLD',
     	1 FORM='FORMATTED', READONLY, ERR=888 )
C
C  SEARCH FOR THE BEGINNING OF PEAK LIST SECTION...
C
     	TEXT = ' '
100	READ(IINP,1000,ERR=777,END=666) TEXT(1:40)
1000	FORMAT(A)
     	IF( TEXT.EQ.' ' ) GOTO 100
     	NCH = INDEX( TEXT(1:40), 'H   K   L     HW     POSN' )
     	IF( NCH.EQ.0 ) GOTO 100
C
C  READ THE PEAK LIST...
C
     	NPKS = 0
200	READ(IINP,1000,ERR=777,END=999) TEXT
     	IF( TEXT.EQ.' ' ) GOTO 200
     	NCH = NALPHA( TEXT, 95 )
     	CALL COMMAS( TEXT, NCH, 11, RP, KP, IDUM )
     	IF( NCH.EQ.0 ) GOTO 200
     	IF( NPKS.GT.0 .AND. F2TH(NPKS).EQ.RP(7) ) GOTO 200
     	IF( RP(2).EQ.2.0 ) GOTO 200	!SKIP KA2 PEAK
     	NPKS = NPKS + 1
     	PEAK(NPKS) = 'KA1'
     	PHKL(1,NPKS) = RP(3)
     	PHKL(2,NPKS) = RP(4)
     	PHKL(3,NPKS) = RP(5)
     	FWHM(NPKS) = RP(6)
     	F2TH(NPKS) = RP(7)
     	C2TH(NPKS) = RP(7)
     	FDSP(NPKS) = RP(10)
     	CDSP(NPKS) = RP(10)
     	RELA(NPKS) = RP(11)
     	AREA(NPKS,JRES) = RP(11)
     	IF( NPKS.EQ.MNK ) GOTO 999
     	GOTO 200

666	CALL COLORS(-1)
     	CALL PUTEXT('ERROR: no peak list found in the input file.',
     	1 44, 24, 1 )
     	CALL PAUSES( 1 )
     	IERR = 3
     	GOTO 999
777	IERR = 1
     	GOTO 999
888	IERR = 2
     	GOTO 999
999	RETURN
     	END
