Exclude data range from XDS ASCII.HKL
This is a jiffy (binaries for Linux and Mac) that removes reflections of a given frame range. The first and last frame of the range must be input. The program reads XDS_ASCII.HKL and writes XDS_ASCII.HKL.exclude_data_range . If several frame ranges should be removed, the program can be run repeatedly - but of course then the files must be renamed.
Bad frames may e.g. be identified by xdscc12.
! purpose: remove data on bad frames from XDS_ASCII.HKL
! Kay Diederichs July 3, 2019
PROGRAM main
CHARACTER line*512
INTEGER inunit,outunit,first,last,ier,ih,ik,il
REAL :: intensity,sigma,xd,yd,zd=0
OPEN(NEWUNIT=inunit,FILE='XDS_ASCII.HKL',STATUS='old',ACTION='READ')
PRINT*,'first and last frame of range that should be excluded?'
READ*,first,last
OPEN(NEWUNIT=outunit,FILE='XDS_ASCII.HKL.exclude_data_range',STATUS='unknown',ACTION='WRITE')
! copy only lines that either cannot be read, or where ZD < first-1 or ZD > last
! (keep in mind that reflections of frame i have a ZD between i-1 and i)
DO
READ(inunit,'(a)',end=99) line
READ(line,*,iostat=ier) ih,ik,il,intensity,sigma,xd,yd,zd
IF (ier==0 .AND. zd > first-1 .AND. zd < last) CYCLE
WRITE(outunit,'(a)') TRIM(line)
END DO
99 STOP
END PROGRAM main