#!/bin/tcsh -f

rm -f *.mtz

foreach name (*.test)

sh $name > $name.log

$CCP4/umtz/umtzdiff $name.mtz $name.mtz.ref > $name.diff

awk 'BEGIN{getline <ARGV[1]; for (i=1;i<=NF;i++) {tol[i]=$i}; getline <ARGV[2]; j=0; for (i=1;i<=NF;i++) {if ($i > tol[i]) {j++}}; printf("%-40s [%s]\n",ARGV[2],(j==0?"OK":"FAIL")) }' $name.tol $name.diff

end
