ks_local_loops.cc

Go to the documentation of this file.
00001 /* + */
00002 /* $Id: ks_local_loops.cc,v 3.5 2008/02/24 11:29:36 mcneile Exp $ ($Date: 2008/02/24 11:29:36 $) */
00003 
00004 
00005 #include "fermact.h"
00006 #include "meas/hadron/ks_local_loops.h"
00007 #include "meas/hadron/hadron_s.h"
00008 #include "meas/sources/z2_src.h"
00009 #include "meas/sources/srcfil.h"
00010 
00011 #include "meas/smear/fuzz_smear.h"
00012 #include "meas/sources/dilute_gauss_src_s.h"
00013 
00014 namespace Chroma {
00015 
00016 
00017 
00018   void write_out_source_type(XMLWriter & xml_out, VolSrc_type volume_source){
00019 
00020 
00021     if( volume_source == Z2NOISE  ){
00022       write(xml_out, "Random_volume_source" , "Z2NOISE");
00023 
00024     }else if( volume_source == GAUSSIAN ){
00025       write(xml_out, "Random_volume_source" , "GAUSSIAN");
00026 
00027     }else if( volume_source == T_DILUTE_GAUSS ){
00028       write(xml_out, "Random_volume_source" , "T_DILUTE_GAUSS");
00029 
00030     }else if( volume_source == C_DILUTE_GAUSS ){ 
00031       write(xml_out, "Random_volume_source" , "C_DILUTE_GAUSS");
00032 
00033     }else if( volume_source == P_DILUTE_GAUSS ){ 
00034       write(xml_out, "Random_volume_source" , "P_DILUTE_GAUSS");
00035 
00036     }else if( volume_source == CT_DILUTE_GAUSS ){
00037       write(xml_out, "Random_volume_source" , "CT_DILUTE_GAUSS");
00038 
00039     }else if( volume_source == CP_DILUTE_GAUSS ){
00040       write(xml_out, "Random_volume_source" , "CP_DILUTE_GAUSS");
00041 
00042     }else if( volume_source == PT_DILUTE_GAUSS ){
00043       write(xml_out, "Random_volume_source" , "PT_DILUTE_GAUSS");
00044 
00045     }else if( volume_source == MOD_T_DILUTE_GAUSS ){
00046      write(xml_out, "Random_volume_source" , "MOD_T_DILUTE_GAUSS");
00047 
00048     }else if( volume_source == CORNER_DILUTE_GAUSS ){
00049      write(xml_out, "Random_volume_source" , "CORNER_DILUTE_GAUSS");
00050 
00051     }else if( volume_source == COR_DBL_T_DILUTE_GAUSS ){
00052      write(xml_out, "Random_volume_source" , "COR_DBL_T_DILUTE_GAUSS");
00053 
00054     }else if( volume_source ==   COR_MOD_DBL_T_DILUTE_GAUSS ){
00055      write(xml_out, "Random_volume_source" , "COR_MOD_DBL_T_DILUTE_GAUSS");
00056 
00057     }else if( volume_source == C_MOD_T_DILUTE_GAUSS ){
00058      write(xml_out, "Random_volume_source" , "C_MOD_T_DILUTE_GAUSS");
00059     }
00060 
00061 
00062   }
00063 
00064 
00065   /**************************************************************************/
00066 
00067   Real fill_volume_source(LatticeStaggeredFermion & q_source, 
00068                           VolSrc_type volume_source, int t_length, 
00069                           int *p_src_tslice, int *p_src_color_ind, 
00070                           int *p_src_parity_ind, int *p_src_corner_ind, 
00071                           int src_seperation, int j_decay){
00072  
00073   // Fill the volume with random noise 
00074  
00075     Real coverage_fraction;
00076 
00077    if( volume_source == GAUSSIAN  ){
00078       gaussian(q_source);
00079     }else if( volume_source == Z2NOISE ){
00080        z2_src(q_source); 
00081 
00082     }else if( volume_source == T_DILUTE_GAUSS ){
00083       gaussian_on_timeslice(q_source,(*p_src_tslice),j_decay);
00084       (*p_src_tslice)++;
00085       if((*p_src_tslice)>=t_length){
00086         (*p_src_tslice)=0;
00087       }
00088       coverage_fraction=1.0/t_length;
00089 
00090     }else if( volume_source == C_DILUTE_GAUSS ){ 
00091       gaussian_color_src(q_source,(*p_src_color_ind));
00092       (*p_src_color_ind)++;
00093       if((*p_src_color_ind) >= Nc){
00094         (*p_src_color_ind)=0;
00095       }
00096       coverage_fraction=1.0/Nc;
00097 
00098     }else if( volume_source == P_DILUTE_GAUSS ){ 
00099       gaussian_on_parity(q_source,(*p_src_parity_ind));
00100       (*p_src_parity_ind)++;
00101       if((*p_src_parity_ind) > 1){
00102         (*p_src_parity_ind) = 0;
00103       }
00104       coverage_fraction=1.0/2;
00105 
00106     }else if( volume_source == CT_DILUTE_GAUSS ){
00107       gaussian_color_src_on_slice(q_source,(*p_src_color_ind),
00108                                   (*p_src_tslice), j_decay);
00109       (*p_src_tslice)++;
00110       if((*p_src_tslice)>=t_length){
00111         (*p_src_tslice)=0;
00112         (*p_src_color_ind)++;
00113         if((*p_src_color_ind) >=Nc){
00114           (*p_src_color_ind)=0;
00115         }
00116       }
00117       coverage_fraction=1.0/(Nc*t_length);
00118 
00119     }else if( volume_source == CP_DILUTE_GAUSS ){
00120       gaussian_color_src_on_parity(q_source, (*p_src_color_ind), 
00121                                    (*p_src_parity_ind));
00122       (*p_src_parity_ind)++;
00123       if((*p_src_parity_ind) > 1){
00124         (*p_src_parity_ind)=0;
00125         (*p_src_color_ind)++;
00126         if((*p_src_color_ind)>=Nc){
00127           (*p_src_color_ind)=0;
00128         }
00129       }
00130       coverage_fraction=1.0/(2*Nc);
00131 
00132     }else if( volume_source == PT_DILUTE_GAUSS ){
00133       gaussian_parity_src_on_slice(q_source, (*p_src_parity_ind), 
00134                                    (*p_src_tslice), j_decay);
00135       (*p_src_parity_ind)++;
00136       if((*p_src_parity_ind) > 1){
00137         (*p_src_parity_ind)=0;
00138         (*p_src_tslice)++;
00139         if((*p_src_tslice) >= t_length){
00140           (*p_src_tslice) = 0;
00141         }
00142       }
00143       coverage_fraction=1.0/(2*t_length);
00144 
00145     }else if( volume_source == MOD_T_DILUTE_GAUSS ){
00146       gaussian_on_mod_timeslice(q_source, (*p_src_tslice), j_decay,
00147                                 src_seperation);
00148       (*p_src_tslice)++;
00149       if((*p_src_tslice)>=t_length){
00150         (*p_src_tslice)=0;
00151       }
00152       if(t_length%src_seperation==0){
00153         coverage_fraction=(1.0/(src_seperation));
00154       }else{
00155         coverage_fraction=9999999;
00156       }
00157 
00158     }else if( volume_source == CORNER_DILUTE_GAUSS ){
00159       gaussian_on_corner(q_source, (*p_src_corner_ind));
00160       (*p_src_corner_ind)++;
00161       if((*p_src_corner_ind)>=16){
00162         (*p_src_corner_ind)=0;
00163       }
00164       coverage_fraction=1.0/16;
00165 
00166     }else if( volume_source == COR_DBL_T_DILUTE_GAUSS ){
00167        gaussian_corner_on_dbl_slice(q_source, (*p_src_corner_ind), 
00168                                    (*p_src_tslice), j_decay);
00169       (*p_src_corner_ind)++;
00170       if((*p_src_corner_ind) >= 16){
00171         (*p_src_corner_ind) = 0;
00172         (*p_src_tslice)++;
00173         if((*p_src_tslice)>=t_length){
00174           (*p_src_tslice) = 0;
00175         }
00176       }
00177       coverage_fraction=1.0/(16*t_length);
00178  
00179     }else if( volume_source ==   COR_MOD_DBL_T_DILUTE_GAUSS ){
00180        gaussian_corner_on_mod_dbl_slice(q_source,(*p_src_corner_ind), 
00181                                         (*p_src_tslice), j_decay, 
00182                                         src_seperation);
00183       (*p_src_corner_ind)++;
00184       if((*p_src_corner_ind) >= 16){
00185         (*p_src_corner_ind)=0;
00186         (*p_src_tslice)++;
00187         if((*p_src_tslice)>=t_length){
00188           (*p_src_tslice)=0;
00189         }
00190       }
00191       if(t_length%src_seperation==0){
00192         coverage_fraction=1.0/(2*Nc);
00193       }else{
00194         coverage_fraction=9999999;
00195       }
00196 
00197     }else if( volume_source == C_MOD_T_DILUTE_GAUSS ){
00198       gaussian_color_src_on_mod_slice(q_source,(*p_src_color_ind),
00199                                   (*p_src_tslice), j_decay, src_seperation);
00200       (*p_src_tslice)++;
00201       if((*p_src_tslice)>=t_length){
00202         (*p_src_tslice)=0;
00203         (*p_src_color_ind)++;
00204         if((*p_src_color_ind)>=Nc){
00205           (*p_src_color_ind) = 0;
00206         }
00207       }
00208 
00209       coverage_fraction=1.0/(Nc*t_length);
00210 
00211     }else{
00212       QDP_error_exit("Wrong type of volume source");
00213     }
00214 
00215    /**********************************************/
00216    /* local src for testing */
00217 
00218    //    q_source=zero;
00219    //   multi1d<int> coord(Nd);
00220    //   coord[0]=0; coord[1] = 0; coord[2] = 0; coord[3] = 0;
00221    //   srcfil(q_source, coord,0 ) ;
00222    //   srcfil(q_source, coord,1 ) ;
00223    //   srcfil(q_source, coord,2 ) ;
00224 
00225 
00226 
00227 
00228 
00229    /***********************************************/
00230 
00231 
00232 
00233    return coverage_fraction;
00234 
00235 
00236   }
00237 
00238 
00239   /**************************************************************************/
00240 
00241 
00242 
00243 void ks_local_loops(
00244                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00245                  LatticeStaggeredFermion & q_source, 
00246                  LatticeStaggeredFermion & psi ,
00247                  const multi1d<LatticeColorMatrix> & u,
00248                  XMLWriter & xml_out, 
00249                  bool gauge_shift,
00250                  bool sym_shift,
00251                  bool loop_checkpoint,
00252                  int t_length,
00253                  Real Mass,
00254                  int Nsamp,
00255                  Real RsdCG,
00256                  int CFGNO,
00257                  VolSrc_type volume_source,
00258                  int src_seperation,
00259                  int j_decay){
00260 
00261 
00262     push(xml_out,"local_loops_s");
00263 
00264    // write common parameters
00265     write(xml_out, "Mass" , Mass);
00266 
00267     write_out_source_type(xml_out, volume_source);
00268 
00269     write(xml_out, "Number_of_samples" , Nsamp);
00270 
00271 
00272     Stag_shift_option type_of_shift ; 
00273     if( gauge_shift ){
00274       if(sym_shift){
00275         type_of_shift = SYM_GAUGE_INVAR ;
00276       }else{
00277         type_of_shift = GAUGE_INVAR ;
00278       }
00279     }else{
00280       if(sym_shift){
00281         type_of_shift = SYM_NON_GAUGE_INVAR ;
00282       }else{
00283         type_of_shift = NON_GAUGE_INVAR ;
00284       }
00285     }
00286 
00287 
00288     // set up the loop code
00289     local_scalar_loop                 scalar_one_loop(t_length,Nsamp,
00290                                                       u,type_of_shift) ;
00291     non_local_scalar_loop             scalar_two_loop(t_length,Nsamp,
00292                                                       u,type_of_shift) ;
00293     threelink_pseudoscalar_loop       eta3_loop(t_length,Nsamp,
00294                                                 u,type_of_shift) ;
00295     fourlink_pseudoscalar_loop        eta4_loop(t_length,Nsamp,
00296                                                 u,type_of_shift) ;
00297 
00298     fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length,Nsamp,
00299                                                 u,type_of_shift) ;
00300 
00301     zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp, 
00302                                                 u,type_of_shift) ;
00303 
00304 
00305     // Seed the RNG with the cfg number for now
00306     QDP::Seed seed;
00307     seed = CFGNO;
00308     RNG::setrn(seed);
00309 
00310   int src_tslice=0;
00311   int src_color_ind = 0;
00312   int src_parity_ind = 0;
00313   int src_corner_ind =0;
00314 
00315   Real coverage_fraction;
00316 
00317   for(int i = 0; i < Nsamp; ++i){
00318     psi = zero;   // note this is ``zero'' and not 0
00319     RNG::savern(seed);
00320     QDPIO::cout << "SEED = " << seed << endl;
00321 
00322     QDPIO::cout << "Noise sample: " << i << endl;
00323 
00324     // Fill the volume with random noise 
00325     coverage_fraction = fill_volume_source(q_source, volume_source, 
00326                                            t_length, &src_tslice, 
00327                                            &src_color_ind, &src_parity_ind, 
00328                                            &src_corner_ind, src_seperation, 
00329                                            j_decay);
00330 
00331 
00332     // Compute the solution vector for the particular source
00333     SystemSolverResults_t res = (*qprop)(psi, q_source);
00334       
00335     push(xml_out,"Qprop_noise");
00336     write(xml_out, "Noise_number" , i);
00337     write(xml_out, "RsdCG" , RsdCG);
00338     write(xml_out, "n_count", res.n_count);
00339     write(xml_out, "Seed" , seed);
00340     pop(xml_out);
00341 
00342 
00343     scalar_one_loop.compute(q_source,psi,i) ;
00344     scalar_two_loop.compute(q_source,psi,i) ;
00345     eta3_loop.compute(q_source,psi,i) ;
00346     eta4_loop.compute(q_source,psi,i) ;
00347     eta4_kilcup_loop.compute(psi,i, Mass);
00348     eta0_loop.compute(q_source,psi,i) ;
00349 
00350      if(loop_checkpoint){
00351       //write each measurement to the XML file
00352 
00353       scalar_one_loop.dump(xml_out,i) ;
00354       scalar_two_loop.dump(xml_out,i) ;
00355       eta3_loop.dump(xml_out,i) ;
00356       eta4_loop.dump(xml_out,i) ;
00357       eta4_kilcup_loop.dump(xml_out,i) ;
00358       eta0_loop.dump(xml_out,i) ;
00359     }
00360 
00361  } // Nsamples
00362 
00363 
00364   // write output from the loop calc
00365   scalar_one_loop.dump(xml_out) ;
00366   scalar_two_loop.dump(xml_out) ;
00367   eta3_loop.dump(xml_out) ;
00368   eta4_loop.dump(xml_out) ;
00369   eta4_kilcup_loop.dump(xml_out) ;
00370   eta0_loop.dump(xml_out) ;
00371 
00372   // end of this section
00373   pop(xml_out);
00374 
00375 }
00376 
00377   /**********************************************************************/
00378 
00379 
00380   //
00381   //  version used in test code.
00382   //
00383 
00384   void ks_local_loops(
00385                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00386                  LatticeStaggeredFermion & q_source, 
00387                  LatticeStaggeredFermion & psi ,
00388                  multi1d<LatticeColorMatrix> & u,
00389                  XMLFileWriter & xml_out, 
00390                  XMLReader & xml_in ,
00391                  int t_length,
00392                  Real Mass,
00393                  int Nsamp,
00394                  Real RsdCG,
00395                  int CFGNO,
00396                  VolSrc_type volume_source,
00397                  int src_seperation,
00398                  int j_decay){
00399 
00400   int src_tslice=0;
00401   int src_color_ind = 0;
00402   int src_parity_ind = 0;
00403   int src_corner_ind =0;
00404   Real coverage_fraction;
00405 
00406   push(xml_out,"ks_local_loops");
00407 
00408   // write common parameters
00409   write(xml_out, "Mass" , Mass);
00410 
00411   write_out_source_type(xml_out, volume_source);
00412 
00413   write(xml_out, "Number_of_samples" , Nsamp);
00414 
00415 
00416   //  parse input files
00417 
00418 
00419   // the wrapped disconnected loops
00420   bool gauge_shift ;
00421   bool sym_shift ;
00422   bool loop_checkpoint;
00423 
00424   try{
00425     read(xml_in, "/propagator/param/use_gauge_invar_oper", gauge_shift ) ;
00426   }catch (const string& e){
00427     QDPIO::cerr << "Error reading data: " << e << endl;
00428     throw;
00429   }
00430   try{
00431     read(xml_in, "/propagator/param/use_sym_shift_oper", sym_shift ) ;
00432   }catch (const string& e){
00433     QDPIO::cerr << "Error reading data: " << e << endl;
00434     throw;
00435   }
00436   try{
00437     read(xml_in, "/propagator/param/loop_checkpoint", loop_checkpoint ) ;
00438   }catch (const string& e){
00439     QDPIO::cerr << "Error reading data: " << e << endl;
00440     throw;
00441   }
00442 
00443 
00444   Stag_shift_option type_of_shift ;
00445   if( gauge_shift ){
00446     if(sym_shift){
00447       type_of_shift = SYM_GAUGE_INVAR ;
00448     }else{
00449       type_of_shift = GAUGE_INVAR ;
00450     }
00451   }else{
00452     if(sym_shift){
00453       type_of_shift = SYM_NON_GAUGE_INVAR ;
00454     }else{
00455       type_of_shift = NON_GAUGE_INVAR ;
00456     }
00457   }
00458 
00459   // set up the loop code
00460   local_scalar_loop                 scalar_one_loop(t_length,Nsamp,
00461                                                     u,type_of_shift) ;
00462   non_local_scalar_loop             scalar_two_loop(t_length,Nsamp,
00463                                                     u,type_of_shift) ;
00464   threelink_pseudoscalar_loop       eta3_loop(t_length,Nsamp,
00465                                               u,type_of_shift) ;
00466   fourlink_pseudoscalar_loop        eta4_loop(t_length,Nsamp,
00467                                               u,type_of_shift) ;
00468   fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length, Nsamp,
00469                                                      u,type_of_shift) ;
00470 
00471   // for test purposes
00472   zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp,
00473                                               u,type_of_shift) ;
00474 
00475     // Seed the RNG with the cfg number for now
00476   QDP::Seed seed;
00477   seed = CFGNO;
00478   RNG::setrn(seed);
00479 
00480   for(int i = 0; i < Nsamp; ++i){
00481     psi = zero;   // note this is ``zero'' and not 0
00482     RNG::savern(seed);
00483     QDPIO::cout << "SEED = " << seed << endl;
00484 
00485     QDPIO::cout << "Noise sample: " << i << endl;
00486 
00487     // Fill the volume with random noise 
00488  
00489     coverage_fraction = fill_volume_source(q_source, volume_source, 
00490                                            t_length, &src_tslice, 
00491                                            &src_color_ind, &src_parity_ind, 
00492                                            &src_corner_ind, src_seperation, 
00493                                            j_decay);
00494 
00495     // Compute the solution vector for the particular source
00496     SystemSolverResults_t res = (*qprop)(psi, q_source);
00497       
00498     push(xml_out,"Qprop_noise");
00499     write(xml_out, "Noise_number" , i);
00500     write(xml_out, "RsdCG" , RsdCG);
00501     write(xml_out, "n_count", res.n_count);
00502     write(xml_out, "Seed" , seed);
00503     pop(xml_out);
00504 
00505 
00506     scalar_one_loop.compute(q_source,psi,i) ;
00507     scalar_two_loop.compute(q_source,psi,i) ;
00508     eta3_loop.compute(q_source,psi,i) ;
00509     eta4_loop.compute(q_source,psi,i) ;
00510     eta4_kilcup_loop.compute(psi,i, Mass);
00511     eta0_loop.compute(q_source,psi,i) ;
00512 
00513     if(loop_checkpoint){
00514       //write each measurement to the XML file
00515 
00516       scalar_one_loop.dump(xml_out,i) ;
00517       scalar_two_loop.dump(xml_out,i) ;
00518       eta3_loop.dump(xml_out,i) ;
00519       eta4_loop.dump(xml_out,i) ;
00520       eta4_kilcup_loop.dump(xml_out,i) ;
00521       eta0_loop.dump(xml_out,i) ;
00522     }
00523 
00524   } // Nsamples
00525 
00526 
00527   // write output from the loop calc
00528   scalar_one_loop.dump(xml_out) ;
00529   scalar_two_loop.dump(xml_out) ;
00530   eta3_loop.dump(xml_out) ;
00531   eta4_loop.dump(xml_out) ;
00532   eta4_kilcup_loop.dump(xml_out) ;
00533   eta0_loop.dump(xml_out) ;
00534 
00535   // end of this section
00536   pop(xml_out);
00537 
00538 }
00539 
00540   /**********************************************************************/
00541 
00542 //  fuzz the loops
00543 
00544 void ks_fuzz_loops_X(
00545                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00546                  LatticeStaggeredFermion & q_source, 
00547                  LatticeStaggeredFermion & psi ,
00548                  LatticeStaggeredFermion & psi_fuzz ,
00549                  const multi1d<LatticeColorMatrix> & u,
00550                  const multi1d<LatticeColorMatrix> & u_smr,
00551                  XMLWriter & xml_out, 
00552                  bool gauge_shift,
00553                  bool sym_shift,
00554                  bool loop_checkpoint,
00555                  int t_length,
00556                  Real Mass,
00557                  int Nsamp,
00558                  Real RsdCG,
00559                  int CFGNO,
00560                  VolSrc_type volume_source,
00561                  int fuzz_width, 
00562                  int src_seperation,
00563                  int j_decay){
00564 
00565   int src_tslice=0;
00566   int src_color_ind = 0;
00567   int src_parity_ind = 0;
00568   int src_corner_ind =0;
00569   Real coverage_fraction;
00570 
00571     push(xml_out,"fuzz_loops_s");
00572 
00573     // write common parameters
00574     write(xml_out, "Mass" , Mass);
00575 
00576 
00577     write_out_source_type(xml_out, volume_source);
00578 
00579 
00580     write(xml_out, "Number_of_samples" , Nsamp);
00581     write(xml_out, "fuzz_width" , fuzz_width);
00582 
00583 
00584     Stag_shift_option type_of_shift ; 
00585     if( gauge_shift ){
00586       if(sym_shift){
00587         type_of_shift = SYM_GAUGE_INVAR ;
00588       }else{
00589         type_of_shift = GAUGE_INVAR ;
00590       }
00591     }else{
00592       if(sym_shift){
00593         type_of_shift = SYM_NON_GAUGE_INVAR ;
00594       }else{
00595         type_of_shift = NON_GAUGE_INVAR ;
00596       }
00597     }
00598 
00599 
00600 
00601    // set up the loop code
00602     local_scalar_loop               scalar_one_loop(t_length,Nsamp,
00603                                                     u,type_of_shift) ;
00604     non_local_scalar_loop           scalar_two_loop(t_length,Nsamp,
00605                                                     u,type_of_shift) ;
00606     threelink_pseudoscalar_loop     eta3_loop(t_length,Nsamp,
00607                                               u,type_of_shift) ;
00608     fourlink_pseudoscalar_loop      eta4_loop(t_length,Nsamp,
00609                                               u,type_of_shift) ;
00610 
00611   fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length, Nsamp,
00612                                                      u,type_of_shift) ;
00613 
00614   // for test purposes
00615   zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp,
00616                                               u,type_of_shift) ;
00617 
00618     // Seed the RNG with the cfg number for now
00619     QDP::Seed seed;
00620     seed = CFGNO;
00621     RNG::setrn(seed);
00622 
00623 
00624   for(int i = 0; i < Nsamp; ++i){
00625     psi = zero;   // note this is ``zero'' and not 0
00626     RNG::savern(seed);
00627     QDPIO::cout << "SEED = " << seed << endl;
00628 
00629     QDPIO::cout << "Noise sample: " << i << endl;
00630 
00631     // Fill the volume with random noise 
00632     coverage_fraction = fill_volume_source(q_source, volume_source, 
00633                                            t_length, &src_tslice, 
00634                                            &src_color_ind, &src_parity_ind, 
00635                                            &src_corner_ind, src_seperation, 
00636                                            j_decay);
00637 
00638     // Compute the solution vector for the particular source
00639     SystemSolverResults_t res = (*qprop)(psi, q_source);
00640       
00641     push(xml_out,"Qprop_noise");
00642     write(xml_out, "Noise_number" , i);
00643     write(xml_out, "RsdCG" , RsdCG);
00644     write(xml_out, "n_count", res.n_count);
00645     write(xml_out, "Seed" , seed);
00646     pop(xml_out);
00647 
00648 
00649     fuzz_smear(u_smr, psi,psi_fuzz,
00650                fuzz_width, j_decay) ;
00651 
00652 
00653     scalar_one_loop.compute(q_source,psi_fuzz,i) ;
00654     scalar_two_loop.compute(q_source,psi_fuzz,i) ;
00655     eta3_loop.compute(q_source,psi_fuzz,i) ;
00656     eta4_loop.compute(q_source,psi_fuzz,i) ;
00657     eta4_kilcup_loop.compute(psi,i, Mass);
00658     eta0_loop.compute(q_source,psi,i) ;
00659 
00660 
00661     if(loop_checkpoint){
00662       //write each measurement to the XML file
00663 
00664       scalar_one_loop.dump(xml_out,i) ;
00665       scalar_two_loop.dump(xml_out,i) ;
00666       eta3_loop.dump(xml_out,i) ;
00667       eta4_loop.dump(xml_out,i) ;
00668       eta4_kilcup_loop.dump(xml_out,i) ;
00669       eta0_loop.dump(xml_out,i) ;
00670     }
00671 
00672   } // Nsamples
00673 
00674 
00675   // write output from the loop calc
00676   scalar_one_loop.dump(xml_out) ;
00677   scalar_two_loop.dump(xml_out) ;
00678   eta3_loop.dump(xml_out) ;
00679   eta4_loop.dump(xml_out) ;
00680   eta4_kilcup_loop.dump(xml_out) ;
00681   eta0_loop.dump(xml_out) ;
00682 
00683   // end of this section
00684   pop(xml_out);
00685 
00686 }
00687 
00688   /**********************************************************************/
00689 
00690 //  fuzz the loops
00691 //  HACK
00692 
00693 
00694 void ks_fuzz_loops(
00695                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00696                  LatticeStaggeredFermion & q_source, 
00697                  LatticeStaggeredFermion & psi ,
00698                  LatticeStaggeredFermion & psi_fuzz ,
00699                  const multi1d<LatticeColorMatrix> & u,
00700                  const multi1d<LatticeColorMatrix> & u_smr,
00701                  XMLWriter & xml_out, 
00702                  bool gauge_shift,
00703                  bool sym_shift,
00704                  bool loop_checkpoint,
00705                  int t_length,
00706                  Real Mass,
00707                  int Nsamp,
00708                  Real RsdCG,
00709                  int CFGNO,
00710                  VolSrc_type volume_source,
00711                  int fuzz_width, 
00712                  int src_seperation,
00713                  int j_decay, bool binary_loop_checkpoint,
00714                  std::string binary_name){
00715 
00716   int src_tslice=0;
00717   int src_color_ind = 0;
00718   int src_parity_ind = 0;
00719   int src_corner_ind =0;
00720   Real coverage_fraction;
00721   int j;
00722   int fuzz_index;
00723 
00724     push(xml_out,"fuzz_loops_s");
00725 
00726     // write common parameters
00727     write(xml_out, "Mass" , Mass);
00728 
00729 
00730     write_out_source_type(xml_out, volume_source);
00731 
00732 
00733     write(xml_out, "Number_of_samples" , Nsamp);
00734     write(xml_out, "fuzz_width" , fuzz_width);
00735 
00736 
00737     Stag_shift_option type_of_shift ; 
00738     if( gauge_shift ){
00739       if(sym_shift){
00740         type_of_shift = SYM_GAUGE_INVAR ;
00741       }else{
00742         type_of_shift = GAUGE_INVAR ;
00743       }
00744     }else{
00745       if(sym_shift){
00746         type_of_shift = SYM_NON_GAUGE_INVAR ;
00747       }else{
00748         type_of_shift = NON_GAUGE_INVAR ;
00749       }
00750     }
00751 
00752    // set up the loop code
00753     local_scalar_loop               scalar_one_loop(t_length,Nsamp,
00754                                                     u,type_of_shift) ;
00755     non_local_scalar_loop           scalar_two_loop(t_length,Nsamp,
00756                                                     u,type_of_shift) ;
00757     threelink_pseudoscalar_loop     eta3_loop(t_length,Nsamp,
00758                                               u,type_of_shift) ;
00759     fourlink_pseudoscalar_loop      eta4_loop(t_length,Nsamp,
00760                                               u,type_of_shift) ;
00761 
00762     fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length, Nsamp,
00763                                                        u,type_of_shift) ;
00764 
00765     // for test purposes
00766     zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp,
00767                                                 u,type_of_shift);
00768 
00769 
00770 
00771     // fuzzed loops here
00772     local_scalar_loop_fuzz       scalar_one_loop_fuzz(t_length, Nsamp, u,
00773                                                       type_of_shift);
00774     non_local_scalar_loop_fuzz   scalar_two_loop_fuzz(t_length,Nsamp, u,
00775                                                       type_of_shift);
00776     threelink_pseudoscalar_loop_fuzz     eta3_loop_fuzz(t_length,Nsamp,
00777                                                         u,type_of_shift);
00778     fourlink_pseudoscalar_loop_fuzz      eta4_loop_fuzz(t_length,Nsamp,
00779                                                         u,type_of_shift);
00780 
00781     fourlink_pseudoscalar_kilcup_loop_fuzz eta4_kilcup_loop_fuzz(t_length,
00782                                                                  Nsamp, u,
00783                                                                 type_of_shift);
00784 
00785 
00786 
00787     // set up the loop code
00788 
00789     // Seed the RNG with the cfg number for now
00790     QDP::Seed seed;
00791     seed = CFGNO;
00792     RNG::setrn(seed);
00793 
00794 
00795     for(int i = 0; i < Nsamp; ++i){
00796       psi = zero;                // note this is ``zero'' and not 0
00797       RNG::savern(seed);
00798       QDPIO::cout << "SEED = " << seed << endl;
00799 
00800       QDPIO::cout << "Noise sample: " << i << endl;
00801 
00802       // Fill the volume with random noise 
00803       coverage_fraction = fill_volume_source(q_source, volume_source,
00804                                              t_length, &src_tslice,
00805                                              &src_color_ind, &src_parity_ind,
00806                                              &src_corner_ind, src_seperation,
00807                                              j_decay);
00808       SystemSolverResults_t res  ;
00809       {
00810         StopWatch swatch;
00811         swatch.start();
00812 
00813       // Compute the solution vector for the particular source
00814       res = (*qprop)(psi, q_source);
00815       
00816         swatch.stop();
00817         double time_in_sec  = swatch.getTimeInSeconds();
00818         QDPIO::cout << "ks_fuzz_loops::PROF INVERTER  [" << i << "] " << time_in_sec << " sec" << endl;
00819 
00820 
00821 
00822       }
00823 
00824 
00825       push(xml_out,"Qprop_noise");
00826       write(xml_out, "Noise_number" , i);
00827       write(xml_out, "RsdCG" , RsdCG);
00828       write(xml_out, "n_count", res.n_count);
00829       write(xml_out, "Seed" , seed);
00830       pop(xml_out);
00831 
00832       {
00833         StopWatch swatch;
00834         swatch.start();
00835 
00836       fuzz_smear(u_smr, psi,psi_fuzz, fuzz_width, j_decay) ;
00837 
00838         swatch.stop();
00839         double time_in_sec  = swatch.getTimeInSeconds();
00840         QDPIO::cout << "ks_fuzz_loops::PROF fuzz_smear  [" << i << "] " << time_in_sec << " sec" << endl;
00841 
00842 
00843       }
00844 
00845       {
00846         StopWatch swatch;
00847         swatch.start();
00848 
00849 
00850       // compute the un-fuzzed operators
00851       scalar_one_loop.compute(q_source,psi,i);
00852       scalar_two_loop.compute(q_source,psi,i);
00853       eta3_loop.compute(q_source,psi,i);
00854       eta4_loop.compute(q_source,psi,i);
00855       eta4_kilcup_loop.compute(psi,i, Mass);
00856       eta0_loop.compute(q_source,psi,i);
00857 
00858       // now compute the fuzzed operators
00859       scalar_one_loop_fuzz.compute(q_source,psi_fuzz,i);
00860       scalar_two_loop_fuzz.compute(q_source,psi_fuzz,i) ;
00861       eta3_loop_fuzz.compute(q_source,psi_fuzz,i) ;
00862       eta4_loop_fuzz.compute(q_source,psi_fuzz,i) ;
00863       eta4_kilcup_loop_fuzz.compute(psi_fuzz,psi,i, Mass);
00864 
00865 
00866         swatch.stop();
00867         double time_in_sec  = swatch.getTimeInSeconds();
00868         QDPIO::cout << "ks_fuzz_loops::PROF compute  [" << i << "] " << time_in_sec << " sec" << endl;
00869 
00870 
00871       }
00872 
00873 
00874       if(loop_checkpoint){
00875         StopWatch swatch;
00876         swatch.start();
00877 
00878         //write each measurement to the XML file
00879 
00880         scalar_one_loop.dump(xml_out,i) ;
00881         scalar_two_loop.dump(xml_out,i) ;
00882         eta3_loop.dump(xml_out,i) ;
00883         eta4_loop.dump(xml_out,i) ;
00884         eta4_kilcup_loop.dump(xml_out,i) ;
00885         eta0_loop.dump(xml_out,i) ;
00886 
00887         scalar_one_loop_fuzz.dump(xml_out,i) ;
00888         scalar_two_loop_fuzz.dump(xml_out,i) ;
00889         eta3_loop_fuzz.dump(xml_out,i) ;
00890         eta4_loop_fuzz.dump(xml_out,i) ;
00891         eta4_kilcup_loop_fuzz.dump(xml_out,i) ;
00892 
00893         swatch.stop();
00894         double time_in_sec  = swatch.getTimeInSeconds();
00895         QDPIO::cout << "ks_fuzz_loops::PROF CHECKPOINT  [" << i << "] " << time_in_sec << " sec" << endl;
00896 
00897 
00898       }
00899     
00900     
00901     } // Nsamples
00902 
00903     // write output from the loop calc
00904     {
00905       StopWatch swatch;
00906       swatch.start();
00907 
00908   scalar_one_loop.dump(xml_out) ;
00909   scalar_two_loop.dump(xml_out) ;
00910   eta3_loop.dump(xml_out) ;
00911   eta4_loop.dump(xml_out) ;
00912   eta4_kilcup_loop.dump(xml_out) ;
00913 
00914   eta0_loop.dump(xml_out) ;
00915 
00916   scalar_one_loop_fuzz.dump(xml_out) ;
00917   scalar_two_loop_fuzz.dump(xml_out) ;
00918   eta3_loop_fuzz.dump(xml_out) ;
00919   eta4_loop_fuzz.dump(xml_out) ;
00920   eta4_kilcup_loop_fuzz.dump(xml_out) ;
00921 
00922 
00923   swatch.stop();
00924   double time_in_sec  = swatch.getTimeInSeconds();
00925   QDPIO::cout << "ks_fuzz_loops::FINAL IO  " << time_in_sec << " sec" << endl;
00926 
00927     }
00928 
00929     if(binary_loop_checkpoint )
00930     {
00931       // BINARY DUMP 
00932       StopWatch swatch;
00933       swatch.start();
00934 
00935       scalar_one_loop.binary_dump(binary_name) ;
00936       scalar_two_loop.binary_dump(binary_name) ;
00937       eta3_loop.binary_dump(binary_name) ;
00938       eta4_loop.binary_dump(binary_name) ;
00939       eta4_kilcup_loop.binary_dump(binary_name) ;
00940       eta0_loop.binary_dump(binary_name) ;
00941 
00942       scalar_one_loop_fuzz.binary_dump(binary_name) ;
00943       scalar_two_loop_fuzz.binary_dump(binary_name) ;
00944       eta3_loop_fuzz.binary_dump(binary_name) ;
00945       eta4_loop_fuzz.binary_dump(binary_name) ;
00946       eta4_kilcup_loop_fuzz.binary_dump(binary_name) ;
00947 
00948       swatch.stop();
00949       double time_in_sec  = swatch.getTimeInSeconds();
00950       QDPIO::cout << "ks_fuzz_loops::BINARY IO  " << time_in_sec << " sec" << endl;
00951 
00952     }
00953 
00954 
00955   // end of this section
00956   pop(xml_out);
00957 
00958 }
00959 
00960 
00961 /**********************************************************************/
00962 
00963 
00964 void ks_local_loops_and_stoch_conn(
00965                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00966                  LatticeStaggeredFermion & q_source1, 
00967                  LatticeStaggeredFermion & psi1 ,
00968                  const multi1d<LatticeColorMatrix> & u,
00969                  XMLWriter & xml_out, 
00970                  bool gauge_shift,
00971                  bool sym_shift,
00972                  bool loop_checkpoint,
00973                  int t_length,
00974                  Real Mass,
00975                  int Nsamp,
00976                  Real RsdCG,
00977                  int CFGNO,
00978                  VolSrc_type volume_source,
00979                  int src_seperation,
00980                  int j_decay){
00981 
00982 
00983   LatticeStaggeredFermion psi2 ;
00984   LatticeStaggeredFermion q_source2 ;
00985 
00986 
00987   push(xml_out,"local_loops_s");
00988 
00989   // write common parameters
00990   write(xml_out, "Mass" , Mass);
00991 
00992   write_out_source_type(xml_out, volume_source);
00993 
00994   write(xml_out, "Number_of_samples" , Nsamp);
00995 
00996   Stag_shift_option type_of_shift ;
00997   if( gauge_shift ){
00998     if(sym_shift){
00999       type_of_shift = SYM_GAUGE_INVAR ;
01000     }else{
01001       type_of_shift = GAUGE_INVAR ;
01002     }
01003   }else{
01004     if(sym_shift){
01005       type_of_shift = SYM_NON_GAUGE_INVAR ;
01006     }else{
01007       type_of_shift = NON_GAUGE_INVAR ;
01008     }
01009   }
01010 
01011   // set up the loop code
01012   local_scalar_loop                 scalar_one_loop(t_length,Nsamp,
01013                                                     u,type_of_shift) ;
01014   non_local_scalar_loop             scalar_two_loop(t_length,Nsamp,
01015                                                     u,type_of_shift) ;
01016   threelink_pseudoscalar_loop       eta3_loop(t_length,Nsamp,
01017                                               u,type_of_shift) ;
01018   fourlink_pseudoscalar_loop        eta4_loop(t_length,Nsamp,
01019                                               u,type_of_shift) ;
01020 
01021   fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length,Nsamp,
01022                                                      u,type_of_shift) ;
01023 
01024   zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp,
01025                                               u,type_of_shift) ;
01026 
01027   fourlink_pseudoscalar_stoch_conn   eta4_conn(t_length,Nsamp,
01028                                                u,type_of_shift) ;
01029 
01030   // Seed the RNG with the cfg number for now
01031   QDP::Seed seed;
01032   seed = CFGNO;
01033   RNG::setrn(seed);
01034 
01035   int src_tslice=0;
01036   int src_color_ind = 0;
01037   int src_parity_ind = 0;
01038   int src_corner_ind =0;
01039 
01040   int src_tslice2=0;
01041   int src_color_ind2 = 0;
01042   int src_parity_ind2 = 0;
01043   int src_corner_ind2 =0;
01044 
01045   Real coverage_fraction;
01046 
01047   for(int i = 0; i < Nsamp; ++i){
01048     psi1 = zero;   // note this is ``zero'' and not 0
01049     psi2 = zero;   // note this is ``zero'' and not 0
01050     RNG::savern(seed);
01051     QDPIO::cout << "SEED = " << seed << endl;
01052 
01053     QDPIO::cout << "Noise sample: " << i << endl;
01054 
01055     // Fill the volume with random noise 
01056     coverage_fraction = fill_volume_source(q_source1, volume_source, 
01057                                            t_length, &src_tslice, 
01058                                            &src_color_ind, &src_parity_ind, 
01059                                            &src_corner_ind, src_seperation, 
01060                                            j_decay);
01061 
01062     //fill 2nd source for stochastic connected correlators
01063     coverage_fraction = fill_volume_source(q_source2, volume_source, 
01064                                            t_length, &src_tslice2, 
01065                                            &src_color_ind2, &src_parity_ind2, 
01066                                            &src_corner_ind2, src_seperation, 
01067                                            j_decay);
01068 
01069     // Compute the solution vector for the particular source
01070     SystemSolverResults_t res1 = (*qprop)(psi1, q_source1);
01071     SystemSolverResults_t res2 = (*qprop)(psi2, q_source2);
01072       
01073     push(xml_out,"Qprop_noise");
01074     write(xml_out, "Noise_number" , i);
01075     write(xml_out, "RsdCG" , RsdCG);
01076     write(xml_out, "n_count1", res1.n_count);
01077     write(xml_out, "n_count2", res2.n_count);
01078     write(xml_out, "Seed" , seed);
01079     pop(xml_out);
01080 
01081 
01082     scalar_one_loop.compute(q_source1,psi1,i) ;
01083     scalar_two_loop.compute(q_source1,psi1,i) ;
01084     eta3_loop.compute(q_source1,psi1,i) ;
01085     eta4_loop.compute(q_source1,psi1,i) ;
01086     eta4_kilcup_loop.compute(psi1,i, Mass);
01087     eta0_loop.compute(q_source1,psi1,i) ;
01088 
01089     eta4_conn.compute(q_source1, q_source2, psi1, psi2, i) ;
01090 
01091     if(loop_checkpoint){
01092       //write each measurement to the XML file
01093 
01094       scalar_one_loop.dump(xml_out,i) ;
01095       scalar_two_loop.dump(xml_out,i) ;
01096       eta3_loop.dump(xml_out,i) ;
01097       eta4_loop.dump(xml_out,i) ;
01098       eta4_kilcup_loop.dump(xml_out,i) ;
01099       eta0_loop.dump(xml_out,i) ;
01100     }
01101 
01102     // MUST checkpoint stochastic connected correlator measurements!
01103     eta4_conn.dump(xml_out,i) ;
01104     printf("OUTNOW!!!!\n");fflush(stdout);
01105  } // Nsamples
01106 
01107 
01108   // write output from the loop calc
01109   scalar_one_loop.dump(xml_out) ;
01110   scalar_two_loop.dump(xml_out) ;
01111   eta3_loop.dump(xml_out) ;
01112   eta4_loop.dump(xml_out) ;
01113   eta4_kilcup_loop.dump(xml_out) ;
01114   eta0_loop.dump(xml_out) ;
01115 
01116   // no point in dumping connected correlator measurements, 
01117   // since corrs must be formed with each noise source, but what the hell, 
01118   // maybe there is a diagnostic use for it.
01119     printf("OUTNOW1!!!!\n");fflush(stdout);
01120   eta4_conn.dump(xml_out) ;
01121 
01122     printf("OUTNOW2!!!!\n");fflush(stdout);
01123   // end of this section
01124   pop(xml_out);
01125 
01126 }
01127 
01128   /**********************************************************************/
01129 
01130   /**********************************************************************/
01131 
01132 //  fuzz the loops
01133 
01134 void ks_fuzz_loops_stoch_conn(
01135                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
01136                  LatticeStaggeredFermion & q_source, 
01137                  LatticeStaggeredFermion & psi ,
01138                  LatticeStaggeredFermion & psi_fuzz ,
01139                  const multi1d<LatticeColorMatrix> & u,
01140                  const multi1d<LatticeColorMatrix> & u_smr,
01141                  XMLWriter & xml_out, 
01142                  bool gauge_shift,
01143                  bool sym_shift,
01144                  bool loop_checkpoint,
01145                  int t_length,
01146                  Real Mass,
01147                  int Nsamp,
01148                  Real RsdCG,
01149                  int CFGNO,
01150                  VolSrc_type volume_source,
01151                  int fuzz_width, 
01152                  int src_seperation,
01153                  int j_decay){
01154 
01155   int src_tslice=0;
01156   int src_color_ind = 0;
01157   int src_parity_ind = 0;
01158   int src_corner_ind =0;
01159 
01160   int src_tslice2=0;
01161   int src_color_ind2 = 0;
01162   int src_parity_ind2 = 0;
01163   int src_corner_ind2 =0;
01164 
01165   Real coverage_fraction;
01166   int j;
01167   int fuzz_index;
01168 
01169   LatticeStaggeredFermion psi2 ;
01170   LatticeStaggeredFermion q_source2 ;
01171 
01172   bool fuzz_sink=false;
01173   bool fuzz_src=false;
01174 
01175     push(xml_out,"fuzz_loops_s");
01176 
01177     // write common parameters
01178     write(xml_out, "Mass" , Mass);
01179 
01180 
01181     write_out_source_type(xml_out, volume_source);
01182 
01183 
01184     write(xml_out, "Number_of_samples" , Nsamp);
01185     write(xml_out, "fuzz_width" , fuzz_width);
01186 
01187 
01188     Stag_shift_option type_of_shift ; 
01189     if( gauge_shift ){
01190       if(sym_shift){
01191         type_of_shift = SYM_GAUGE_INVAR ;
01192       }else{
01193         type_of_shift = GAUGE_INVAR ;
01194       }
01195     }else{
01196       if(sym_shift){
01197         type_of_shift = SYM_NON_GAUGE_INVAR ;
01198       }else{
01199         type_of_shift = NON_GAUGE_INVAR ;
01200       }
01201     }
01202 
01203    // set up the loop code
01204     local_scalar_loop               scalar_one_loop(t_length,Nsamp,
01205                                                     u,type_of_shift) ;
01206     non_local_scalar_loop           scalar_two_loop(t_length,Nsamp,
01207                                                     u,type_of_shift) ;
01208     threelink_pseudoscalar_loop     eta3_loop(t_length,Nsamp,
01209                                               u,type_of_shift) ;
01210     fourlink_pseudoscalar_loop      eta4_loop(t_length,Nsamp,
01211                                               u,type_of_shift) ;
01212 
01213     fourlink_pseudoscalar_kilcup_loop eta4_kilcup_loop(t_length, Nsamp,
01214                                                        u,type_of_shift) ;
01215 
01216     // for test purposes
01217     zerolink_pseudoscalar_loop        eta0_loop(t_length, Nsamp,
01218                                                 u,type_of_shift);
01219 
01220 
01221 
01222     // fuzzed loops here
01223     local_scalar_loop_fuzz       scalar_one_loop_fuzz(t_length, Nsamp, u,
01224                                                       type_of_shift);
01225     non_local_scalar_loop_fuzz   scalar_two_loop_fuzz(t_length,Nsamp, u,
01226                                                       type_of_shift);
01227     threelink_pseudoscalar_loop_fuzz     eta3_loop_fuzz(t_length,Nsamp,
01228                                                         u,type_of_shift);
01229     fourlink_pseudoscalar_loop_fuzz      eta4_loop_fuzz(t_length,Nsamp,
01230                                                         u,type_of_shift);
01231 
01232     fourlink_pseudoscalar_kilcup_loop_fuzz eta4_kilcup_loop_fuzz(t_length,
01233                                                                  Nsamp, u,
01234                                                                 type_of_shift);
01235 
01236 
01237     //  fourlink_pseudoscalar_stoch_conn   eta4_conn(t_length,Nsamp,
01238     //                                         u,type_of_shift) ;
01239 
01240 
01241   fourlink_pseudoscalar_stoch_conn   eta4_conn(t_length,Nsamp,
01242                                                u,type_of_shift,
01243                                                false,false) ;
01244 
01245   fourlink_pseudoscalar_stoch_conn   eta4_conn_FsrcLsink(t_length,Nsamp,
01246                                                          u,type_of_shift,
01247                                                          true,false) ;
01248 
01249   fourlink_pseudoscalar_stoch_conn   eta4_conn_LsrcFsink(t_length,Nsamp,
01250                                                          u,type_of_shift, 
01251                                                          false,true) ;
01252 
01253     // set up the loop code
01254 
01255     // Seed the RNG with the cfg number for now
01256     QDP::Seed seed;
01257     seed = CFGNO;
01258     RNG::setrn(seed);
01259 
01260 
01261     for(int i = 0; i < Nsamp; ++i){
01262       psi = zero;                // note this is ``zero'' and not 0
01263       psi2 = zero;   // note this is ``zero'' and not 0
01264 
01265       RNG::savern(seed);
01266       QDPIO::cout << "SEED = " << seed << endl;
01267 
01268       QDPIO::cout << "Noise sample: " << i << endl;
01269 
01270       // Fill the volume with random noise 
01271       coverage_fraction = fill_volume_source(q_source, volume_source,
01272                                              t_length, &src_tslice,
01273                                              &src_color_ind, &src_parity_ind,
01274                                              &src_corner_ind, src_seperation,
01275                                              j_decay);
01276 
01277       //fill 2nd source for stochastic connected correlators
01278       coverage_fraction = fill_volume_source(q_source2, volume_source, 
01279                                              t_length, &src_tslice2,
01280                                              &src_color_ind2, &src_parity_ind2,
01281                                              &src_corner_ind2, src_seperation,
01282                                              j_decay);
01283 
01284 
01285       // Compute the solution vector for the particular source
01286       SystemSolverResults_t res = (*qprop)(psi, q_source);
01287       SystemSolverResults_t res2 = (*qprop)(psi2, q_source2);
01288 
01289       push(xml_out,"Qprop_noise");
01290       write(xml_out, "Noise_number" , i);
01291       write(xml_out, "RsdCG" , RsdCG);
01292       write(xml_out, "n_count", res.n_count);
01293       write(xml_out, "Seed" , seed);
01294       pop(xml_out);
01295 
01296       fuzz_smear(u_smr, psi,psi_fuzz, fuzz_width, j_decay) ;
01297 
01298 
01299       // compute the un-fuzzed operators
01300       scalar_one_loop.compute(q_source,psi,i);
01301       scalar_two_loop.compute(q_source,psi,i);
01302       eta3_loop.compute(q_source,psi,i);
01303       eta4_loop.compute(q_source,psi,i);
01304       eta4_kilcup_loop.compute(psi,i, Mass);
01305       eta0_loop.compute(q_source,psi,i);
01306 
01307       //      eta4_conn.compute(q_source, q_source2, psi, psi2, i) ;
01308 
01309       eta4_conn.compute(q_source, q_source2,
01310                         psi, psi2,
01311                         u_smr, fuzz_width, j_decay, i);
01312 
01313       eta4_conn_FsrcLsink.compute(q_source, q_source2,
01314                                   psi, psi2,
01315                                   u_smr, fuzz_width, j_decay, i);
01316       eta4_conn_LsrcFsink.compute(q_source, q_source2,
01317                                   psi, psi2,
01318                                   u_smr, fuzz_width, j_decay, i);
01319 
01320       // now compute the fuzzed operators
01321       scalar_one_loop_fuzz.compute(q_source,psi_fuzz,i);
01322       scalar_two_loop_fuzz.compute(q_source,psi_fuzz,i) ;
01323       eta3_loop_fuzz.compute(q_source,psi_fuzz,i) ;
01324       eta4_loop_fuzz.compute(q_source,psi_fuzz,i) ;
01325       eta4_kilcup_loop_fuzz.compute(psi_fuzz,psi,i, Mass);
01326 
01327 
01328 
01329 
01330       if(loop_checkpoint){
01331         //write each measurement to the XML file
01332 
01333         scalar_one_loop.dump(xml_out,i) ;
01334         scalar_two_loop.dump(xml_out,i) ;
01335         eta3_loop.dump(xml_out,i) ;
01336         eta4_loop.dump(xml_out,i) ;
01337         eta4_kilcup_loop.dump(xml_out,i) ;
01338         eta0_loop.dump(xml_out,i) ;
01339 
01340         scalar_one_loop_fuzz.dump(xml_out,i) ;
01341         scalar_two_loop_fuzz.dump(xml_out,i) ;
01342         eta3_loop_fuzz.dump(xml_out,i) ;
01343         eta4_loop_fuzz.dump(xml_out,i) ;
01344         eta4_kilcup_loop_fuzz.dump(xml_out,i) ;
01345       }
01346     
01347       // MUST checkpoint stochastic connected correlator measurements!
01348       eta4_conn.dump(xml_out,i) ;
01349       eta4_conn_FsrcLsink.dump(xml_out,i) ;
01350       eta4_conn_LsrcFsink.dump(xml_out,i) ;
01351 
01352       //      printf("OUTNOW!!!!\n");fflush(stdout);
01353      
01354     } // Nsamples
01355 
01356     // write output from the loop calc
01357   scalar_one_loop.dump(xml_out) ;
01358   scalar_two_loop.dump(xml_out) ;
01359   eta3_loop.dump(xml_out) ;
01360   eta4_loop.dump(xml_out) ;
01361   eta4_kilcup_loop.dump(xml_out) ;
01362 
01363   eta0_loop.dump(xml_out) ;
01364 
01365   scalar_one_loop_fuzz.dump(xml_out) ;
01366   scalar_two_loop_fuzz.dump(xml_out) ;
01367   eta3_loop_fuzz.dump(xml_out) ;
01368   eta4_loop_fuzz.dump(xml_out) ;
01369   eta4_kilcup_loop_fuzz.dump(xml_out) ;
01370 
01371   // no point in dumping connected correlator measurements, 
01372   // since corrs must be formed with each noise source, but what the hell, 
01373   // maybe there is a diagnostic use for it.
01374     printf("OUTNOW1!!!!\n");fflush(stdout);
01375     eta4_conn.dump(xml_out) ;
01376     eta4_conn_FsrcLsink.dump(xml_out) ;
01377     eta4_conn_LsrcFsink.dump(xml_out) ;
01378 
01379   // end of this section
01380   pop(xml_out);
01381 
01382 }
01383 
01384 
01385 /**********************************************************************/
01386 
01387 
01388 }  // end namespace Chroma

Generated on Sun Nov 22 04:33:19 2009 for CHROMA by  doxygen 1.4.7