#!/bin/tcsh -f # # # Mosflm integration script # # if (${0:h} == ${0}) then set cmd = "" else set cmd = "${0:h}/" endif # # source ${cmd}makesymbols # # source symbols # # # Define the usage specific to integ # # set input = '[[firstimagenumber] lastimagenumber]' # # set help = (title \ directory \ ident \ extension \ firstimagenumber \ lastimagenumber \ phi \ beamcenter \ backstopcenter \ backstopradius \ mosaic \ outputroot \ space \ highres \ lowres \ addinteg \ twotheta \ nullpix \ overload \ wavelength \ gain \ polarization \ divergence \ dispersion \ raster \ separation) # set addinteg = 'postref beam 1 usebeam' # source ${cmd}cmdargs # # # Interpret the unmatched arguments # # if (${#argv} >= 1) then set lastimagenumber = ${1} if (${#argv} >= 2) then set firstimagenumber = ${1} set lastimagenumber = ${2} endif endif # # # Save the symbols # # source ${cmd}savesymbols # # # Do any symbols have defaults? # # source ${cmd}defaults # # # Interrupt action # # onintr interrupt # # # Check for required input # # if (${?firstimagenumber} == 0) then echo " WARNING: first image number not specified, assumed to be 1. " set firstimagenumber = 1 endif # # if (${?lastimagenumber} == 0) then echo " " echo " ERROR: last image number not specified, program exit." echo " " echo " Usage:" ${0} " [firstimagenumber] lastimagenumber [...]" echo " " kill -9 $$ endif # # # Does the matrix file exist? # # set matrix = # # if (${?imagename}) then if (-e "${imagename:r}.mat") then set matrix = "${imagename:r}.mat" endif endif # # if (${matrix} == "") then if (-e "${outputroot}.mat") then set matrix = "${outputroot}.mat" endif endif # # if (${matrix} == "") then echo " " if (${?imagename}) then echo " ERROR: the matrix file does not exist (tried ${outputroot}.mat and ${imagename:r}.mat)," echo " program exit." else echo " ERROR: the matrix file ${outputroot}.mat does not exist, program exit." endif echo " " echo " To generate the matrix file, autoindex using "\""index"\""." echo " " kill -9 $$ endif # # if (${?space} == 0) then echo " " echo " ERROR: the the crystal symmetry is not defined, program exit." echo " " echo " define the symbol "\""space"\"" in the symbols file or use" echo " -space "\""space group symbol"\"" on the command line." echo " " echo " Usage:" ${0} " [[firstimagenumber] lastimagenumber] [-space spacegroup] [...]" echo " " kill -9 $$ endif # # # Make the mosflm input file # # echo > ${tmpfile}.mosflm # # if (${?title}) then echo "TITLE ${title}" >> ${tmpfile}.mosflm endif # # #echo "profile xlines 0 42 84 126 168 210 ylines 0 42 84 126 168 210" >> ${tmpfile}.mosflm #echo "profile rmsbg 20 xlines 0 22 44 66 88 110 ylines 0 22 44 66 88 110" >> ${tmpfile}.mosflm echo "GENFILE ${outputroot}.gen" >> ${tmpfile}.mosflm # # set templaten = `echo ${imagename:t:r} | sed "s/[^0-9]/ /g"` set num = 1 while (${num} <= ${#templaten}) if (${templaten[${num}]} > 0) then set templateext = `echo ${templaten[${num}]} | sed "s/[0-9]/#/g"` endif @ num = ${num} + 1 end echo $templateext set template = ${ident}_${templateext}.${extension} echo "TEMPLATE ${template}" >> ${tmpfile}.mosflm echo "SYMM ${space}" >> ${tmpfile}.mosflm echo "MATRIX ${matrix}" >> ${tmpfile}.mosflm # # if (${?mosaic}) then echo "MOSAIC ${mosaic}" >> ${tmpfile}.mosflm else echo "MOSAIC 0.5" >> ${tmpfile}.mosflm endif # # # CCD detector? # # if (${extension} == img) then if (${scanner[1]} == QUANTUM4) then echo "SITE SSRL ADSC" >> ${tmpfile}.mosflm echo "ADCOFFSET 20" >> ${tmpfile}.mosflm echo "FINDSPOTS YOFFSET 3.5" >> ${tmpfile}.mosflm endif # # if (${scanner[1]} == QUANTUM315) then echo "SCANNER ADSC" >> ${tmpfile}.mosflm echo "ADCOFFSET 20" >> ${tmpfile}.mosflm #echo "LIMITS XMIN 0 XMAX 315 YMIN 0 YMAX 315 XSCAN 157.5 YSCAN 157.5" >> ${tmpfile}.mosflm endif endif # #if (${extension} == mccd) then #if (${scanner[1]} == MAR325) then #echo "KEYWORD value" >> ${tmpfile}.mosflm #endif #endif # if (${?beamcenter}) then if (${?twotheta}) then echo "BEAM SWUNG_OUT ${beamcenter}" >> ${tmpfile}.mosflm else echo "BEAM ${beamcenter}" >> ${tmpfile}.mosflm endif endif # # if (${?twotheta}) then echo "TWOTHETA ${twotheta}" >> ${tmpfile}.mosflm endif # # if (${?backstopcenter}) then echo "BACKSTOP CENTRE ${backstopcenter}" >> ${tmpfile}.mosflm endif if (${?backstopradius}) then echo "BACKSTOP RADIUS ${backstopradius}" >> ${tmpfile}.mosflm endif # # if (${?gain}) then echo "GAIN ${gain}" >> ${tmpfile}.mosflm endif # # if (${?distance}) then echo "DISTANCE ${distance}" >> ${tmpfile}.mosflm endif # # # Image and Processing parameters # # if (${?directory}) then echo "DIRECTORY ${directory}" >> ${tmpfile}.mosflm endif # # #if (${?ident}) then #echo "IDENT ${ident}" >> ${tmpfile}.mosflm #endif # # if (${?extension}) then echo "EXTENSION ${extension}" >> ${tmpfile}.mosflm endif # # if (${?raster}) then if (${#raster} == 5) then echo "RASTER ${raster}" >> ${tmpfile}.mosflm endif endif # # if (${?separation}) then if (${#separation} == 2 || ${#separation} == 3) then echo "SEPARATION ${separation}" >> ${tmpfile}.mosflm endif endif # # # Limits # if (${?nullpix}) then echo "NULLPIX ${nullpix}" >> ${tmpfile}.mosflm endif # # if (${?overload}) then echo "OVERLOAD CUTOFF ${overload}" >> ${tmpfile}.mosflm echo "PROFILE CUTOFF ${overload}" >> ${tmpfile}.mosflm endif # # if (${?highres}) then if (${?lowres}) then echo "RESOLUTION ${lowres} ${highres}" >> ${tmpfile}.mosflm else echo "RESOLUTION ${highres}" >> ${tmpfile}.mosflm endif endif # # # Beam Line parameters # # if (${?polarization}) then echo "SYNCHROTRON POLARIZATION ${polarization}" >> ${tmpfile}.mosflm endif # # if (${?divergence}) then if (${#divergence} == 1) then echo "DIVERGENCE ${divergence}" >> ${tmpfile}.mosflm else echo "DIVERGENCE ${divergence[1]} ${divergence[2]}" >> ${tmpfile}.mosflm endif endif # # if (${?dispersion}) then echo "DISPERSION ${dispersion}" >> ${tmpfile}.mosflm endif # # if (${?wavelength}) then echo "WAVELENGTH ${wavelength}" >> ${tmpfile}.mosflm endif # # echo "POSTREF FIX ALL" >> ${tmpfile}.mosflm echo "REFINEMENT CYCLES 8" >> ${tmpfile}.mosflm # # if (${?addinteg}) then set num = 1 while (${num} <= ${#addinteg}) echo "${addinteg[${num}]}" >> ${tmpfile}.mosflm @ num = ${num} + 1 end endif # # if (${?phi}) then set angle = `echo ${phi[1]} ${phi[2]} | awk '{ printf ("%.3f", $2 - $1) }'` echo "PROCESS ${firstimagenumber} TO ${lastimagenumber} START ${phi[1]} ANGLE ${angle}" >> ${tmpfile}.mosflm else echo "PROCESS ${firstimagenumber} TO ${lastimagenumber}" >> ${tmpfile}.mosflm endif # # echo "RUN" >> ${tmpfile}.mosflm echo "END" >> ${tmpfile}.mosflm # # # Follow the progress of the integration # # sleep 2; tail -f ${outputroot}.mosflm_log | grep -E "(Integrating)|(Processing)" & # # # Run mosflm # # which ipmosflm # ipmosflm HKLOUT ${outputroot}.mtz \ SPOTOD ${outputroot}.spotod \ SUMMARY ${outputroot}.mosflm_sum \ COORDS ${outputroot}.coords < ${tmpfile}.mosflm \ > ${outputroot}.mosflm_log # # if (-e mosflm.lp) then rm -f mosflm.lp endif # # # # Stop following the progress of the integration # # cp symbols ${outputroot}.symbols # # interrupt: # kill %+ # # # Delete the GEN, SPOTOD, COORDS and MOSFLM files # # rm -f ${outputroot}.gen rm -f ${outputroot}.spotod rm -f ${outputroot}.coords rm -f ${tmpfile}.mosflm