C                                                                       FTOU0100
C     ROUTINE BINARY - FILE TAPE FORMATTED TO BINARY                    FTOU0110
C  THIS PROGRAM READS IN THE 6 SOURCE TAPES FOR POWD10 AND WRITES
C  THEM OUT AS BINARY FILES
C  INPUT: POWD10FL1.DAT THROUGH POWD10FL6.DAT
C  OUTPUT: POWD10FL1.BIN THROUGH POWD10FL6.DAT
C                                                                       FTOU0120
      DIMENSION FX(32),URHO(7),PFX(9),AFX(14),ILP(30),IEXT(13),IS(5,3)  FTOU0130
      DIMENSION A(19),URHOB(7)                                                  
      NFILEF=30                                                                 
      NFILE=40                                                                  
      NOUT=6                                                            FTOU0170
C                                                                       FTOU0180
C     READ ORFLS FORMAT SCATTERING FACTOR TABLES                        FTOU0190
C                                                                       FTOU0200
	OPEN(UNIT=NFILEF, FILE='POWD10FL1.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL1.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,95)                                                           
  100 READ (NFILEF,110,END=170) ICODE,NTAG,IDENT                        FTOU0210
C      WRITE (NOUT,120) ICODE,NTAG,IDENT                                 FTOU0230
      READ (NFILEF,130) FX                                              FTOU0250
C      WRITE (NOUT,140) FX                                               FTOU0270
      READ (NFILEF,150) NAME,URHO,ATWT,URHOB                                    
C      WRITE (NOUT,160) NAME,URHO,ATWT,URHOB                                     
      WRITE (NFILE) ICODE,NTAG,IDENT,FX,NAME,URHO,ATWT,URHOB                    
      GO TO 100                                                         FTOU0340
  170 ENDFILE NFILE                                                     FTOU0350
C                                                                       FTOU0360
C     POLYNOMIAL SCATTERING FACTORS                                     FTOU0370
C                                                                       FTOU0380
	OPEN(UNIT=NFILEF, FILE='POWD10FL2.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL2.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,175)                                                          
  180 READ (NFILEF,110,END=190) NUM,INAME,IDENT                         FTOU0390
C     NUM=NUM+20    DELETED 2/83  M.Z.                                          
C      WRITE (NOUT,120) NUM,INAME,IDENT                                  FTOU0400
      READ (NFILEF,130) PFX                                             FTOU0410
C      WRITE (NOUT,140) PFX                                              FTOU0420
      READ (NFILEF,150) NAMES,URHO,ATWT,URHOB                                   
C      WRITE (NOUT,160) NAMES,URHO,ATWT,URHOB                                    
      WRITE (NFILE) NUM,INAME,IDENT,PFX,NAMES,URHO,ATWT,URHOB                   
      GO TO 180                                                         FTOU0460
  190 ENDFILE NFILE                                                     FTOU0470
C                                                                       FTOU0480
C     ANOMALOUS SCATTERING FACTORS                                      FTOU0490
C                                                                       FTOU0500
	OPEN(UNIT=NFILEF, FILE='POWD10FL3.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL3.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,195)                                                          
  200 READ (NFILEF,110,END=210) INUM,NAME                               FTOU0510
C     INUM=INUM+38         DELETED 2/83  M.Z.                                   
C      WRITE (NOUT,120) INUM,NAME                                        FTOU0520
      READ (NFILEF,130) AFX                                             FTOU0530
C      WRITE (NOUT,140) AFX                                              FTOU0540
      WRITE (NFILE) INUM,NAME,AFX                                       FTOU0550
      GO TO 200                                                         FTOU0560
  210 ENDFILE NFILE                                                     FTOU0570
C                                                                       FTOU0580
C     ELECTRON SCATTERING FACTORS                                       FTOU0590
C                                                                       FTOU0600
	OPEN(UNIT=NFILEF, FILE='POWD10FL4.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL4.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,215)                                                          
220   CONTINUE                                                                  
      READ(NFILEF,110,END=230) ICODE,NTAG,IDENT                                 
  225 CONTINUE                                                                  
      READ (NFILEF,130) FX                                                      
      READ (NFILEF,150) NAME,URHO,ATWT,URHOB                                    
C      WRITE (NOUT,120) ICODE,NTAG,IDENT                                         
C      WRITE (NOUT,140) FX                                                       
C      WRITE (NOUT,160) NAME,URHO,ATWT,URHOB                                     
      WRITE (NFILE) ICODE,NTAG,IDENT,FX,NAME,URHO,ATWT,URHOB                    
      GO TO 220                                                                 
  230 ENDFILE NFILE                                                             
C                                                                       FTOU0660
C     SYMMETRY POSITIONS                                                FTOU0670
C                                                                       FTOU0680
	OPEN(UNIT=NFILEF, FILE='POWD10FL5.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL5.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,235)                                                          
  240 READ (NFILEF,250,END=320) NSG,LAUE,INC,ICENT,ILAT,ILP             FTOU0690
C      WRITE (NOUT,260) NSG,LAUE,INC,ICENT,ILAT,ILP                      FTOU0710
      READ (NFILEF,270) IEXT                                            FTOU0730
C      WRITE (NOUT,280) IEXT                                             FTOU0750
      WRITE (NFILE) NSG,LAUE,INC,ICENT,ILAT,ILP,IEXT                    FTOU0770
      DO 310  I=1,INC                                                   FTOU0780
      READ (NFILEF,290) ((IS(II,J),II=1,5),J=1,3),ITTI                  FTOU0790
C      WRITE (NOUT,300) ((IS(II,J),II=1,5),J=1,3),ITTI                   FTOU0810
      WRITE (NFILE) ((IS(II,J),II=1,5),J=1,3),ITTI                      FTOU0830
  310 CONTINUE                                                          FTOU0840
      GO TO 240                                                         FTOU0850
  320 ENDFILE NFILE                                                     FTOU0860
C                                                                       FTOU0870
C     ABSORPTION TABLES                                                 FTOU0880
C                                                                       FTOU0890
	OPEN(UNIT=NFILEF, FILE='POWD10FL6.DAT', STATUS='OLD',
     1 READONLY, FORM='FORMATTED')
	OPEN(UNIT=NFILE, FILE='POWD10FL6.BIN', STATUS='NEW',
     1 ACCESS='SEQUENTIAL', FORM='UNFORMATTED')
      WRITE (NOUT,325)                                                          
  330 READ (NFILEF,130,END=360) XMU                                     FTOU0900
C      WRITE (NOUT,140) XMU                                              FTOU0910
      READ (NFILEF,340) A                                               FTOU0920
C      WRITE (NOUT,350) A                                                FTOU0940
      WRITE (NFILE) XMU,A                                               FTOU0960
      GO TO 330                                                         FTOU0970
  360 ENDFILE NFILE                                                     FTOU0980
      STOP                                                              FTOU0990
   95 FORMAT ('1ORFLS FORMAT SCATTERING FACTOR TABLES'/)                        
  110 FORMAT (I4,2A4)                                                   FTOU0220
  120 FORMAT ('0',I4,2A4)                                               FTOU0240
  130 FORMAT (8F10.5)                                                   FTOU0260
  140 FORMAT (1X,8F10.5)                                                FTOU0280
  150 FORMAT (A4,8F9.4/4X,7F9.4)                                                
  160 FORMAT (1X,A4,8F9.4,/5X,7F9.4)                                            
  175 FORMAT ('1POLYNOMIAL SCATTERING FACTORS'/)                                
  195 FORMAT ('1ANOMALOUS SCATTERING FACTORS'/)                                 
  215 FORMAT ('1ELECTRON SCATTERING FACTORS'/)                                  
  235 FORMAT ('1SYMMETRY POSITIONS'/)                                           
  250 FORMAT (5I4,5X,30I1)                                              FTOU0700
  260 FORMAT (25X,5I4,5X,30I1)                                          FTOU0720
  270 FORMAT (13I2)                                                     FTOU0740
  280 FORMAT (27X,13I2)                                                 FTOU0760
  290 FORMAT (16I3)                                                     FTOU0800
  300 FORMAT (25X,3(5I3,2X),I3)                                         FTOU0820
  325 FORMAT ('1ABSORPTION TABLES'/)                                            
  340 FORMAT (8F10.4)                                                   FTOU0930
  350 FORMAT (1X,8F10.4)                                                FTOU0950
      END                                                               FTOU1000
