(* file  xtalrefine/luzatti.math  -- makes a luzatti plot      *)
            (* R-factor error curves are plotted for errors between        *)
            (* 0.5 and 0.2 A (in 0.05 intervals).                          *)

           (* The error table information is taken from Luzatti's paper.   *)

Off[General::spell1];
$DefaultFont={"Times-Roman",13};


                                       (* change the name of the list file *)
(*===>*) dd= <</Net/newton/u2/xplor/xplor_main/tutorial/xtalrefine/luzatti.list; 
 
  col1=Transpose[dd[[1]]][[1]];
  col2=Transpose[dd[[1]]][[2]];
  col4=Transpose[dd[[1]]][[4]];
  rfact=Transpose[{2/(col1+col2),col4}];
  min=Min[2/(col1+col2)];
  max=Max[2/(col1+col2)];
  Ltable={{0.,0.},{0.01,0.025},{0.02,0.050},{0.03,0.074},{0.04,0.098},
          {0.05,0.122},{0.06,0.145},{0.07,0.168},{0.08,0.191},
          {0.09,0.214},{0.1,0.237},{0.12,0.281},{0.14,0.319},
          {0.16,0.353},{0.18,0.385},{0.20,0.414},{0.22,0.44},
          {0.24,0.463},{0.26,0.483},{0.28,0.502},{0.30,0.518},
          {0.35,0.548},{0.40,0.564},{0.45,0.574},{0.50,0.580}};
  coll1=Transpose[Ltable][[1]];
  coll2=Transpose[Ltable][[2]];
  Show[Graphics[{ Line[rfact],
             GrayLevel[0.5], 
             Line[Transpose[{coll1/0.50,coll2}]],
             Line[Transpose[{coll1/0.45,coll2}]],
             Line[Transpose[{coll1/0.40,coll2}]],
             Line[Transpose[{coll1/0.35,coll2}]],
             Line[Transpose[{coll1/0.30,coll2}]],
             Line[Transpose[{coll1/0.25,coll2}]],
             Line[Transpose[{coll1/0.20,coll2}]]},
  Ticks->{Range[min ,
         max,0.08],Range[0.,0.6,0.05]},
  Axes->True,
  AxesOrigin->{min ,0.},AspectRatio->1,
  PlotRange->
    {{min  ,max +0.05 },{0.,0.7}},
  AxesLabel->{"1/d","R factor"},
  PlotLabel->"Luzatti Plot (0.5 to 0.2 )" ]];