	IMPLICIT REAL*4(A-H,O-Z)
C
C 	PROGRAM TO TRANSALATE FORM BROOKHAVEN'S PROTEIN DATA 
C   BANK FORMAT TO MS FORMAT.  WRITTEN BY MASON 1/31/85
C
	character*6 TAG
 	CHARACTER*4 A,B,C, COLD
	CHARACTER*80 FILE1,FILE2
	character*100 BUFFER
	WRITE (6,100)
100	FORMAT(1H ,'INPUT FILE NAME? ')
	READ (5,110) FILE1
110	FORMAT(A80)
	OPEN (UNIT=1,NAME=FILE1,STATUS='OLD')
	WRITE (6,120)
120	FORMAT(1H ,'OUTPUT FILE NAME? ')
	READ (5,130) FILE2
130	FORMAT(A80)
	OPEN (UNIT=2,NAME=FILE2,STATUS='NEW')
	WRITE (6,135)
135	FORMAT(1H ,'OUTPUT SEQUENCE FILE NAME? ')
	READ(5,130) FILE1
	OPEN (UNIT=4,NAME=FILE1,STATUS='NEW')
C
C
C	READ ATOMS FROM DATA FILE
	NOLD=-1
	IJ=0

	write (2,*)
10	do while (.TRUE.)
	    read (1, '(a100)', end=999) BUFFER
	    if (BUFFER(1:4).eq.'ATOM') then
	 	READ (BUFFER,140) A,M,B,C,N,X,Y,Z
140		FORMAT(A4,2x,I5,2X,A4,A4,1X,I4,4X,3F8.3)
		if (B(1:1).eq.'H'.or.B(1:1).eq.'D') goto 10
		II = II + 1		    
		IF (N.NE.NOLD.or.C.ne.COLD) THEN
			IJ=IJ+1
			NOLD=N
			COLD=C
			WRITE (4,145) IJ,N,C
145			FORMAT(I4,1X,I4,1X,A4)
		ENDIF
	 	WRITE(2,1100)X,Y,Z,IJ,C,B
 1100   	FORMAT(3F10.5,15X,I5,15X,A4,6X,A4)
	    end if
	end do
999	STOP
	END

