#!/bin/tcsh -f # # # Write out all observed reflections including anomalous information # # if (${0:h} == ${0}) then set cmd = "" else set cmd = "${0:h}/" endif # # source ${cmd}makesymbols # # source symbols # # # Define the usage specific to makedata # # set input = mtzfile # # set help = (ident \ firstimagenumber \ outputroot \ highres \ lowres \ merge) endif # # source ${cmd}cmdargs # # # Interpret the unmatched arguments # # set mtzfile = if (${#argv} >= 1) then if (-e ${1}) then set mtzfile = ${1} else echo " " echo " ERROR: The mtz file ${1} does not exist, program exit. " echo " " echo " Usage:" ${0} " mtzfile [...] " echo " " kill -9 $$ endif endif # # # Save the symbols # # source ${cmd}savesymbols # # # Do any symbols have defaults? # # source ${cmd}defaults # # # Interrupt action # # onintr interrupt # # # Get the mtz file name # # if (${mtzfile} == "") then if (-e "${outputroot}_F.mtz") then set mtzfile = "${outputroot}_F.mtz" else if (-e "${outputroot}.mtz") then set mtzfile = "${outputroot}.mtz" endif endif # # # Check for required input # # if (${mtzfile} == "") then if (${?outputroot} == 0) then echo " " echo " ERROR: mtz file not specified, program exit. " echo " " echo " Usage:" ${0} " mtzfile [...] " echo " " kill -9 $$ else echo " " echo " ERROR: Neither ${outputroot}_F.mtz nor ${outputroot}.mtz exists, program exit. " echo " " echo " Usage:" ${0} " mtzfile [...] " echo " " kill -9 $$ endif endif # # # Label the centric reflections # # (1) Write a file containing only the centric reflections and scale ISYM to 0 # # cad HKLIN1 ${mtzfile} \ HKLOUT ${tmpfile}_FC.tmp << eof > ${tmpfile}.cadout LABIN FILE 1 E1=ISYM CTYPIN FILE 1 E1=F SCALE FILE 1 0.0 CENTRIC_ONLY END eof # # # Does the output file contain any reflections? # # set reflections = `grep -Ei "^ *Total number from Sorting Routine *\= +[0-9]+" ${tmpfile}.cadout` # # if (${#reflections} > 6) then set reflections = ${reflections[7]} else set reflections = 0 endif # # if (${reflections} <= 0) then # # # Copy the original file # # if (${mtzfile} !~ [/\\]*) then set filewd = ${cwd}/ else set filewd = endif if (-l ${mtzfile}) then cp ${filewd}${mtzfile} ${tmpfile}_FM.tmp else ln -sf ${filewd}${mtzfile} ${tmpfile}_FM.tmp endif else # # # (2) Convert ISYM to Y # # cad HKLIN1 ${tmpfile}_FC.tmp \ HKLOUT ${tmpfile}_F0.tmp << eof LABIN FILE 1 E1=ISYM CTYPIN FILE 1 E1=Y END eof # # # (3) Merge it with the original # # mtzutils HKLIN1 ${tmpfile}_F0.tmp \ HKLIN2 ${mtzfile} \ HKLOUT ${tmpfile}_FM.tmp << eof UNIQUE RUN eof # # endif # # # Select reflections to be omitted in the free-R calculation # # uniqueify -p 0.05 ${tmpfile}_FM.tmp ${tmpfile}_FF.tmp # # # Write a file containing all the required data # # set resolution = if (${?highres}) then if (${?lowres}) then set resolution = "RESOLUTION ${highres} ${lowres}" else set resolution = "RESOLUTION ${highres}" endif endif # # mtz2various HKLIN ${tmpfile}_FF.tmp \ HKLOUT ${tmpfile}_F.tmp << EOF LABIN IDUM1=ISYM FP=F SIGFP=SIGF \ F(+)=F(+) SIGF(+)=SIGF(+) \ F(-)=F(-) SIGF(-)=SIGF(-) \ DUM1=IMEAN DUM2=SIGIMEAN \ I(+)=I(+) SIGI(+)=SIGI(+) \ I(-)=I(-) SIGI(-)=SIGI(-) \ FREE=FreeR_flag MISS 0 OUTPUT USER '(4I4,12F12.3,F5.0)' ${resolution} END EOF # # # Convert this to a XtalView style fin files # # ${cmd}makehkl -fin < ${tmpfile}_F.tmp > ${outputroot}.fin ${cmd}makehkl -fin -anomalous < ${tmpfile}_F.tmp > ${outputroot}anom.fin # # # xplor style fob files # # ${cmd}makehkl -fob < ${tmpfile}_F.tmp > ${outputroot}.fob ${cmd}makehkl -fob -anomalous < ${tmpfile}_F.tmp > ${outputroot}anom.fob # # # xplor style cv files # # ${cmd}makehkl -cns < ${tmpfile}_F.tmp > ${outputroot}.cv ${cmd}makehkl -cns -anomalous < ${tmpfile}_F.tmp > ${outputroot}anom.cv # # # shelx style hkl files # # ${cmd}makehkl -hkl < ${tmpfile}_F.tmp > ${outputroot}.hkl ${cmd}makehkl -hkl -anomalous < ${tmpfile}_F.tmp > ${outputroot}anom.hkl # # # And scalepack style sca files # # ${cmd}makehkl -sca < ${tmpfile}_F.tmp > ${outputroot}.sca ${cmd}makehkl -sca -anomalous < ${tmpfile}_F.tmp > ${outputroot}anom.sca # # interrupt: # # # Delete the scratch files # # rm -f ${tmpfile}.cadout rm -f ${tmpfile}_F.tmp rm -f ${tmpfile}_FC.tmp rm -f ${tmpfile}_F0.tmp rm -f ${tmpfile}_FM.tmp rm -f ${tmpfile}_FF.tmp