diff options
author | Thomas White <taw@physics.org> | 2016-08-16 11:26:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-08-16 11:27:24 +0200 |
commit | f85961b8f9a52295c2d9140ee0099c992dfc04ed (patch) | |
tree | ecdca8a8453943462f91ae8a5f6ffad63623fca3 | |
parent | 53cb1d53d0b16e2fe99b1ddd19537c8da9764354 (diff) |
scripts/create-mtz: Update to handle unknown number of lines after end marker
-rwxr-xr-x | scripts/create-mtz | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/create-mtz b/scripts/create-mtz index 8a81cbad..556a87e7 100755 --- a/scripts/create-mtz +++ b/scripts/create-mtz @@ -5,15 +5,14 @@ echo "You need to edit this script first, to set the space group and cell parame exit 1 OUTFILE=`echo $1 | sed -e 's/\.hkl$/.mtz/'` -TMPHKL=`echo $1 | sed -e 's/\.hkl$/.temp.hkl/'` echo " Input: $1" echo "Output: $OUTFILE" -if [ -e $TMPHKL -o -e $OUTFILE ]; then +if [ -e create-mtz.temp.hkl -o -e $OUTFILE ]; then echo " I'm about to write to the following files, but one or more" echo " of them already exist:" echo " " $OUTFILE - echo " " $TMPHKL + echo " create-mtz.temp.hkl" echo " To confirm that you want to continue, which will DESTROY the" echo " current contents of these files, type 'y' and press enter." read conf @@ -22,13 +21,17 @@ if [ -e $TMPHKL -o -e $OUTFILE ]; then exit 1 else echo "Proceeding" + rm -f create-mtz.temp.hkl fi fi -grep -v "End of reflections" $1 > $TMPHKL +ex -c '/End of reflections/ +.,$d +w create-mtz.temp.hkl +q!' $1 echo "Running 'f2mtz'..." -f2mtz HKLIN $TMPHKL HKLOUT $OUTFILE > out.html << EOF +f2mtz HKLIN create-mtz.temp.hkl HKLOUT $OUTFILE > out.html << EOF TITLE Reflections from CrystFEL NAME PROJECT wibble CRYSTAL wibble DATASET wibble CELL 100 100 100 90 90 90 |