inline_spectrum_s.cc

Go to the documentation of this file.
00001 /*! \file
00002  * \brief Inline construction of staggered spectrum
00003  *
00004  * Spectrum calculations
00005  */
00006 
00007 #include "meas/inline/hadron_s/inline_spectrum_s.h"
00008 #include "meas/inline/abs_inline_measurement_factory.h"
00009 #include "meas/glue/mesplq.h"
00010 #include "meas/smear/ape_smear.h"
00011 #include "meas/hadron/stag_propShift_s.h"
00012 
00013 #include "util/ft/sftmom.h"
00014 #include "util/info/proginfo.h"
00015 #include "io/param_io.h"
00016 #include "io/enum_io/enum_stochsrc_io.h"
00017 
00018 // staggered stuff
00019 #include "handle.h"
00020 #include "state.h"
00021 #include "actions/ferm/fermbcs/simple_fermbc_s.h"
00022 #include "actions/ferm/fermacts/fermacts_s.h"
00023 
00024 #include "meas/inline/io/named_objmap.h"
00025 
00026 #include "util/ferm/transf.h"
00027 #include "meas/hadron/ks_local_loops.h"
00028 #include "meas/smear/fuzz_smear.h"
00029 #include "meas/hadron/vector_meson_s.h"
00030 
00031 
00032 #include "meas/inline/make_xml_file.h"
00033 
00034 #include "util_compute_quark_prop_s.h"
00035 #include "util_compute_meson_s.h"
00036 #include "meas/hadron/pion_local_s.h"
00037 #include "meas/hadron/g4g5_x_g4g5_local.h"
00038 
00039 namespace Chroma 
00040 { 
00041   int build_basic_8_props(multi1d<LatticeStaggeredPropagator> stag_prop,
00042                           stag_src_type type_of_src,
00043                           bool gauge_shift, bool sym_shift,
00044                           int fuzz_width,
00045                           const multi1d<LatticeColorMatrix> & u,
00046                           const multi1d<LatticeColorMatrix> & u_smr,
00047                           Handle< SystemSolver<LatticeStaggeredFermion> >
00048                           & qprop,
00049                           XMLWriter & xml_out,
00050                           Real RsdCG, Real Mass, int j_decay ) ;
00051 
00052 }
00053 
00054 
00055 // ------------------------
00056 
00057 
00058 namespace Chroma { 
00059 
00060   int compute_quark_propagator_s(LatticeStaggeredFermion & psi,
00061                                  stag_src_type type_of_src,
00062                                  bool gauge_shift,
00063                                  bool sym_shift,
00064                                  int fuzz_width,
00065                                  const multi1d<LatticeColorMatrix> & u ,
00066                                  multi1d<LatticeColorMatrix> & u_smr,
00067                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00068                                  XMLWriter & xml_out,
00069                                  Real RsdCG, Real Mass, 
00070                                  int j_decay,
00071                                  int src_ind, int color_source);
00072 
00073   int compute_quark_propagator_s(LatticeStaggeredFermion & psi,
00074                                  stag_src_type type_of_src,
00075                                  bool gauge_shift,
00076                                  bool sym_shift,
00077                                  const multi1d<LatticeColorMatrix> & u ,
00078                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00079                                  XMLWriter & xml_out,
00080                                  Real RsdCG, Real Mass, 
00081                                  int j_decay,
00082                                  int src_ind, int color_source, int t_source=0);
00083 
00084 
00085   int compute_quark_propagator_s(LatticeStaggeredFermion & psi1,
00086                                  LatticeStaggeredFermion & psi2,
00087                                  stag_src_type type_of_src,
00088                                  bool gauge_shift,
00089                                  bool sym_shift,
00090                                  const multi1d<LatticeColorMatrix> & u ,
00091                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop1,
00092                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop2,
00093                                  XMLWriter & xml_out,
00094                                  Real RsdCG, Real Mass1, Real Mass2, 
00095                                  int j_decay,
00096                                  int src_ind, int color_source, int t_source) ; 
00097 
00098   int compute_quark_propagator_s(LatticeStaggeredFermion & psi,
00099                                  stag_src_type type_of_src,
00100                                  bool gauge_shift,
00101                                  bool sym_shift,
00102                                  int fuzz_width,
00103                                  const multi1d<LatticeColorMatrix> & u ,
00104                                  multi1d<LatticeColorMatrix> & u_smr,
00105                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00106                                  XMLWriter & xml_out,
00107                                  Real RsdCG, Real Mass, 
00108                                  int j_decay,
00109                                  int src_ind, int color_source, 
00110                                  LatticeStaggeredFermion & q_source_in ) ;
00111 
00112 
00113   int compute_quark_propagator_s(LatticeStaggeredFermion & psi,
00114                                  stag_src_type type_of_src,
00115                                  bool gauge_shift,
00116                                  bool sym_shift,
00117                                  const multi1d<LatticeColorMatrix> & u ,
00118                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00119                                  XMLWriter & xml_out,
00120                                  Real RsdCG, Real Mass, 
00121                                  int j_decay,
00122                                  int src_ind, int color_source, int t_source,
00123                                  LatticeStaggeredFermion & q_source_in ) ; 
00124 
00125 
00126 
00127   int compute_quark_propagator_s(LatticeStaggeredFermion & psi1,
00128                                  LatticeStaggeredFermion & psi2,
00129                                  stag_src_type type_of_src,
00130                                  bool gauge_shift,
00131                                  bool sym_shift,
00132                                  const multi1d<LatticeColorMatrix> & u ,
00133                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop1,
00134                                  Handle< SystemSolver<LatticeStaggeredFermion> > & qprop2,
00135                                  XMLWriter & xml_out,
00136                                  Real RsdCG, Real Mass1, Real Mass2, 
00137                                  int j_decay,
00138                                  int src_ind, int color_source, int t_source, 
00139                                  LatticeStaggeredFermion & q_source_in) ;
00140 
00141 
00142   void ks_compute_baryon(string name,
00143                          LatticeStaggeredPropagator & quark_propagator,
00144                          XMLWriter & xml_out,
00145                          int j_decay, int tlength) ; 
00146 
00147   void ks_compute_baryon(string name,
00148                          LatticeStaggeredPropagator & quark_propagator_a,
00149                          LatticeStaggeredPropagator & quark_propagator_b,
00150                          LatticeStaggeredPropagator & quark_propagator_c,
00151                          XMLWriter & xml_out,
00152                          int j_decay, int tlength);
00153 
00154   void ks_compute_baryon(string name,
00155                          LatticeStaggeredPropagator & quark_propagator_a,
00156                          LatticeStaggeredPropagator & quark_propagator_b,
00157                          LatticeStaggeredPropagator & quark_propagator_c,
00158                          XMLWriter & xml_out,
00159                          int j_decay, int tlength,
00160                          bool binary_baryon_dump, std::string binary_name);
00161 
00162 
00163   void write_smearing_info(string name, stag_src_type type_of_src,
00164                            XMLWriter &xml_out, int fuzz_width ) ;
00165 
00166 
00167   void compute_vary_baryon_s(XMLWriter &xml_out, int t_source, int fuzz_width,
00168                              int j_decay, int t_len,
00169                              LatticeStaggeredPropagator & 
00170                              quark_propagator_Lsink_Lsrc,
00171                              LatticeStaggeredPropagator & 
00172                              quark_propagator_Fsink_Lsrc,
00173                              LatticeStaggeredPropagator & 
00174                              quark_propagator_Lsink_Fsrc,
00175                              LatticeStaggeredPropagator & 
00176                              quark_propagator_Fsink_Fsrc) ;
00177 
00178 
00179   void compute_vary_baryon_s(XMLWriter &xml_out, int t_source, int fuzz_width,
00180                              int j_decay, int t_len,
00181                              LatticeStaggeredPropagator &
00182                              quark_propagator_Lsink_Lsrc,
00183                              LatticeStaggeredPropagator &
00184                              quark_propagator_Fsink_Lsrc,
00185                              LatticeStaggeredPropagator &
00186                              quark_propagator_Lsink_Fsrc,
00187                              LatticeStaggeredPropagator &
00188                              quark_propagator_Fsink_Fsrc,
00189                              bool binary_baryon_dump,
00190                              std::string binary_name) ;
00191 
00192 
00193 
00194 
00195   int compute_singlet_ps(LatticeStaggeredFermion & psi,
00196                          LatticeStaggeredPropagator quark_propagator,
00197                          stag_src_type type_of_src,
00198                          bool gauge_shift,
00199                          bool sym_shift,
00200                          const multi1d<LatticeColorMatrix> & u ,
00201                          Handle< SystemSolver<LatticeStaggeredFermion> > &
00202                          qprop,
00203                          XMLWriter & xml_out,
00204                          Real RsdCG, Real Mass, 
00205                          int j_decay, int t_source, int t_length);
00206 
00207   int compute_vary_singlet_ps(LatticeStaggeredFermion & psi,
00208                    LatticeStaggeredPropagator & quark_propagator_Lsink_Lsrc,
00209                    LatticeStaggeredPropagator & quark_propagator_Fsink_Lsrc,
00210                    LatticeStaggeredPropagator & quark_propagator_Lsink_Fsrc,
00211                    LatticeStaggeredPropagator & quark_propagator_Fsink_Fsrc,
00212                    stag_src_type type_of_src,
00213                    bool gauge_shift,
00214                    bool sym_shift,
00215                    const multi1d<LatticeColorMatrix> & u ,
00216                    const multi1d<LatticeColorMatrix> & u_smr ,
00217                    Handle< SystemSolver<LatticeStaggeredFermion> > & qprop,
00218                    XMLWriter & xml_out,
00219                    Real RsdCG, Real Mass, 
00220                    int j_decay, int t_source, int t_length, 
00221                               int fuzz_width);
00222 
00223 }
00224 
00225 // ----------
00226 /***************************************************************************/
00227 /***************************************************************************/
00228 
00229 namespace Chroma { 
00230 
00231 /***************************************************************************/
00232 
00233   namespace InlineStaggeredSpectrumEnv 
00234   { 
00235     namespace
00236     {
00237       AbsInlineMeasurement* createMeasurement(XMLReader& xml_in, 
00238                                               const std::string& path) {
00239         return new InlineStaggeredSpectrum(InlineStaggeredSpectrumParams(xml_in, path));
00240       }
00241 
00242       //! Local registration flag
00243       bool registered = false;
00244     }
00245 
00246     const std::string name = "SPECTRUM_S";
00247 
00248     //! Register all the factories
00249     bool registerAll() 
00250     {
00251       bool success = true; 
00252       if (! registered)
00253       {
00254         success &= TheInlineMeasurementFactory::Instance().registerObject(name, 
00255                                                                           createMeasurement);
00256         registered = true;
00257       }
00258       return success;
00259     }
00260   }
00261 
00262 /***************************************************************************/
00263 
00264 
00265   //! Reader for parameters
00266   void read(XMLReader& xml, const string& path,
00267             InlineStaggeredSpectrumParams::Param_t& param) 
00268   {
00269     XMLReader paramtop(xml, path);
00270 
00271     int version;
00272     read(paramtop, "version", version);
00273 
00274     //    switch (version) 
00275 
00276     read(paramtop, "Meson_local", param.Meson_local);
00277     read(paramtop, "Meson_charm_local", param.Meson_charm_local);
00278     read(paramtop, "Meson_charm_noisy_local", param.Meson_charm_noisy_local);
00279     read(paramtop, "Wilson_loops", param.Wilson_loops);
00280     read(paramtop, "Pion_nondegen_noisy_local", param.Pion_nondegen_noisy_local);
00281 
00282     param.Pion_nondegen_noisy_local2 = false ;
00283     if (paramtop.count("Pion_nondegen_noisy_local2") == 1)
00284     read(paramtop, "Pion_nondegen_noisy_local2", param.Pion_nondegen_noisy_local2);
00285 
00286     param.Pion_nondegen_noisy_local3 = false ;
00287     if (paramtop.count("Pion_nondegen_noisy_local3") == 1)
00288     read(paramtop, "Pion_nondegen_noisy_local3", param.Pion_nondegen_noisy_local3);
00289 
00290     param.Pion_nondegen_noisy_local4 = false ;
00291     if (paramtop.count("Pion_nondegen_noisy_local4") == 1)
00292     read(paramtop, "Pion_nondegen_noisy_local4", param.Pion_nondegen_noisy_local4);
00293 
00294 
00295 
00296     read(paramtop, "Baryon_local", param.Baryon_local);
00297     read(paramtop, "Baryon_vary", param.Baryon_vary);
00298     read(paramtop, "LocalPion_vary", param.LocalPion_vary);
00299 
00300     if( paramtop.count("LocalScalar_vary") > 0 ) {
00301       read(paramtop, "LocalScalar_vary", param.LocalScalar_vary);
00302     }
00303     else
00304       {
00305         param.LocalScalar_vary = false ; 
00306       }
00307 
00308     read(paramtop, "disconnected_local", param.disconnected_local);
00309     read(paramtop, "disconnected_fuzz", param.disconnected_fuzz);
00310     read(paramtop, "singletPs_Conn_local", param.ps4link_singlet_conn);
00311     read(paramtop, "singletPs_Conn_local_fuzz", param.ps4link_singlet_conn_fuzz);
00312 
00313     read(paramtop, "eight_pions", param.eight_pions);
00314     read(paramtop, "eight_scalars", param.eight_scalars);
00315     read(paramtop, "eight_rhos", param.eight_rhos);
00316 
00317     read(paramtop, "t_srce", param.t_srce);
00318     read(paramtop, "nrow", param.nrow);
00319     read(paramtop, "sym_shift_oper", param.sym_shift_oper);
00320     read(paramtop, "gauge_invar_oper", param.gauge_invar_oper);
00321     read(paramtop, "loop_checkpoint", param.loop_checkpoint);
00322 
00323     param.binary_name = "dump_"  ; 
00324     param.binary_loop_checkpoint = false ;
00325     param.binary_meson_dump = false ;
00326     param.binary_baryon_dump = false ;
00327 
00328     if (paramtop.count("binary_loop_checkpoint") == 1){
00329       read(paramtop, "binary_loop_checkpoint", 
00330            param.binary_loop_checkpoint) ;
00331     }
00332 
00333     if (paramtop.count("binary_meson_dump") == 1){
00334       read(paramtop, "binary_meson_dump",
00335            param.binary_meson_dump) ;
00336     }
00337 
00338     if (paramtop.count("binary_baryon_dump") == 1){
00339       read(paramtop, "binary_baryon_dump",
00340            param.binary_baryon_dump) ;
00341     }
00342 
00343       if( param.binary_loop_checkpoint || param.binary_baryon_dump  ||
00344       param.binary_meson_dump )
00345         {
00346           read(paramtop, "binary_name", param.binary_name) ;
00347         }
00348 
00349 
00350 
00351 
00352     param.fermact = readXMLGroup(paramtop, "FermionAction", "FermAct");
00353 
00354     if( param.Pion_nondegen_noisy_local )
00355       param.fermact2 = readXMLGroup(paramtop, "FermionAction2", "FermAct");
00356 
00357 
00358     if( param.Pion_nondegen_noisy_local2 )
00359       param.fermact3 = readXMLGroup(paramtop, "FermionAction3", "FermAct");
00360     if( param.Pion_nondegen_noisy_local )
00361       param.fermact4 = readXMLGroup(paramtop, "FermionAction4", "FermAct");
00362     if( param.Pion_nondegen_noisy_local )
00363       param.fermact5 = readXMLGroup(paramtop, "FermionAction5", "FermAct");
00364 
00365 
00366     read(paramtop, "src_seperation", param.src_seperation);
00367 
00368     if( !param.gauge_invar_oper ){
00369       //read gauge-fixing parameters
00370       read(paramtop, "GFAccu", param.GFAccu);
00371       read(paramtop, "OrPara", param.OrPara );
00372       read(paramtop, "GFMax", param.GFMax );
00373     }
00374 
00375 
00376 //    if(( param.disconnected_local )||(param.disconnected_fuzz)){
00377 
00378     if(( param.disconnected_local )||(param.disconnected_fuzz) || param.Meson_charm_noisy_local || param.Pion_nondegen_noisy_local   ){
00379 
00380       read(paramtop, "Number_sample", param.Nsamp);
00381       read(paramtop, "CFGNO", param.CFGNO);
00382       // more work
00383       param.volume_source = GAUSSIAN ;
00384       read(paramtop, "volume_src", param.volume_source);
00385 
00386     }else{
00387       param.Nsamp = 10 ;
00388       param.CFGNO = 10 ;
00389       param.volume_source = GAUSSIAN ;
00390     }
00391 
00392     if(((param.Baryon_vary)||(param.ps4link_singlet_conn_fuzz))||
00393        ((param.disconnected_fuzz)||(param.LocalPion_vary) || param.LocalScalar_vary )){
00394       read(paramtop, "fuzz_width", param.fuzz_width);
00395     }else{
00396       param.fuzz_width = 0 ;
00397     }
00398   }
00399 
00400 /***************************************************************************/
00401 
00402 
00403   //! Writer for parameters
00404   void write(XMLWriter& xml, const string& path, 
00405              const InlineStaggeredSpectrumParams::Param_t& param) {
00406     push(xml, path);
00407 
00408     int version = 1;
00409     write(xml, "version", version);
00410 
00411     write(xml, "Meson_local", param.Meson_local);
00412     write(xml, "Meson_charm_local", param.Meson_charm_local);
00413     write(xml, "Meson_charm_noisy_local", param.Meson_charm_noisy_local);
00414     write(xml, "Pion_nondegen_noisy_local", param.Pion_nondegen_noisy_local);
00415 
00416     write(xml, "Pion_nondegen_noisy_local2", param.Pion_nondegen_noisy_local2);
00417     write(xml, "Pion_nondegen_noisy_local3", param.Pion_nondegen_noisy_local3);
00418     write(xml, "Pion_nondegen_noisy_local4", param.Pion_nondegen_noisy_local4);
00419 
00420     write(xml, "Wilson_loops", param.Wilson_loops);
00421     write(xml, "Baryon_local", param.Baryon_local);
00422     write(xml, "Baryon_vary", param.Baryon_vary);
00423     write(xml, "disconnected_local", param.disconnected_local);
00424     write(xml, "disconnected_fuzz", param.disconnected_fuzz);
00425     write(xml, "nrow", param.nrow);
00426     write(xml, "t_srce", param.t_srce);
00427     write(xml, "volume_source",param.volume_source);
00428     write(xml, "fuzz_width", param.fuzz_width);
00429     pop(xml);
00430   }
00431 
00432 /***************************************************************************/
00433 
00434   //! Propagator generation params input
00435   void read(XMLReader& xml, const string& path, 
00436             InlineStaggeredSpectrumParams::Quark_Prop_t& input) {
00437     XMLReader inputtop(xml, path);
00438 
00439 
00440     //    read(inputtop, "RsdCG", input.invParam.RsdCG);
00441     //  read(inputtop, "MaxCG", input.invParam.MaxCG);
00442     read(inputtop, "invParam", input.invParam); // inverter parameters
00443 
00444 
00445     if( inputtop.count("invParam/MaxCGRestart") > 0 ) {
00446       read(inputtop, "invParam/MaxCGRestart", input.invParam.MaxCGRestart);
00447     }
00448     else {
00449       input.invParam.MaxCGRestart = 0 ; 
00450     }
00451 
00452   }
00453 
00454 /***************************************************************************/
00455 
00456 
00457   //! Propagator output
00458   void write(XMLWriter& xml, const string& path, 
00459              const InlineStaggeredSpectrumParams::Quark_Prop_t& input) {
00460     push(xml, path);
00461     write(xml, "Mass", input.Mass);
00462 //    write(xml,"Inverter",input.invParam.invType);
00463     write(xml,"RsdCG", input.invParam.RsdCG);
00464     write(xml,"MaxCG", input.invParam.MaxCG);
00465     pop(xml);
00466   }
00467 
00468 
00469 /***************************************************************************/
00470   //! Named object input
00471   void read(XMLReader& xml, const string& path, InlineStaggeredSpectrumParams::NamedObject_t& input)
00472   {
00473     XMLReader inputtop(xml, path);
00474 
00475     read(inputtop, "gauge_id", input.gauge_id);
00476   }
00477 
00478 /***************************************************************************/
00479 
00480   //! Named object output
00481   void write(XMLWriter& xml, const string& path, const InlineStaggeredSpectrumParams::NamedObject_t& input)
00482   {
00483     push(xml, path);
00484 
00485     write(xml, "gauge_id", input.gauge_id);
00486 
00487     pop(xml);
00488   }
00489 
00490 /***************************************************************************/
00491 
00492   // Param stuff
00493   InlineStaggeredSpectrumParams::InlineStaggeredSpectrumParams()
00494   { 
00495     frequency = 0; 
00496   }
00497 
00498 /***************************************************************************/
00499 
00500   InlineStaggeredSpectrumParams::InlineStaggeredSpectrumParams(XMLReader& xml_in, 
00501                                                                const std::string& path) {
00502     try {
00503       XMLReader paramtop(xml_in, path);
00504 
00505       if (paramtop.count("Frequency") == 1){
00506         read(paramtop, "Frequency", frequency);
00507       }else {
00508         frequency = 1;
00509       }
00510 
00511       // Parameters for source construction
00512       read(paramtop, "Param", param);
00513 
00514       // Read in the output propagator/source configuration info
00515       read(paramtop, "Inversion", prop_param);
00516 
00517       // Read in the gauge field id
00518       read(paramtop, "NamedObject", named_obj);
00519 
00520       // Possible alternate XML file pattern
00521       if (paramtop.count("xml_file") != 0) {
00522         read(paramtop, "xml_file", xml_file);
00523       }
00524     } catch(const std::string& e) {
00525       QDPIO::cerr << "Caught Exception reading XML: " << e << endl;
00526       QDP_abort(1);
00527     }
00528   }
00529 
00530 /***************************************************************************/
00531 
00532   void
00533   InlineStaggeredSpectrumParams::write(XMLWriter& xml_out, 
00534                                        const std::string& path) {
00535     push(xml_out, path);
00536     
00537     Chroma::write(xml_out, "Param", param);
00538     Chroma::write(xml_out, "Inversion", prop_param);
00539     Chroma::write(xml_out, "NamedObject", named_obj);
00540     QDP::write(xml_out, "xml_file", xml_file);
00541 
00542     pop(xml_out);
00543   }
00544 
00545 /***************************************************************************/
00546 
00547 
00548   int
00549   build_basic_8_props(multi1d<LatticeStaggeredPropagator> &stag_prop,
00550                       stag_src_type type_of_src, 
00551                       bool gauge_shift, bool sym_shift,
00552                       int fuzz_width,
00553                       const multi1d<LatticeColorMatrix> & u,
00554                       multi1d<LatticeColorMatrix> & u_smr,
00555                       Handle< SystemSolver<LatticeStaggeredFermion> > & 
00556                       qprop,
00557                       XMLWriter & xml_out,
00558                       Real RsdCG, Real Mass, int j_decay){
00559 
00560 
00561     LatticeStaggeredFermion q_source, psi ;
00562     LatticeStaggeredFermion q_source_fuzz ;
00563     LatticeStaggeredPropagator quark_propagator;
00564 
00565     int ncg_had = 0;                         // count CG iterations
00566 
00567     psi = zero;                              // note this is ``zero'' and not 0
00568 
00569 
00570 
00571     for(int src_ind = 0; src_ind < 8 ; ++src_ind){
00572       stag_prop[src_ind] = zero ;
00573     
00574       for(int color_source = 0; color_source < Nc; ++color_source) {
00575 
00576         ncg_had += compute_quark_propagator_s(psi,type_of_src,
00577                                               fuzz_width, 
00578                                               gauge_shift, sym_shift,
00579                                               u, u_smr, qprop, xml_out,
00580                                               RsdCG, Mass, j_decay,
00581                                               src_ind, color_source) ;
00582 
00583 
00584         /*
00585          * Move the solution to the appropriate components
00586          * of quark propagator.
00587          */
00588         FermToProp(psi, quark_propagator, color_source);
00589       }  //color_source
00590     
00591       stag_prop[src_ind] = quark_propagator;
00592 
00593     }// end src_ind
00594 
00595     return ncg_had;
00596 
00597   }
00598 /***************************************************************************/
00599 
00600   // no fuzzing version
00601   int
00602   build_basic_8_props(multi1d<LatticeStaggeredPropagator> &stag_prop,
00603                       stag_src_type type_of_src, 
00604                       bool gauge_shift, bool sym_shift,
00605                       const multi1d<LatticeColorMatrix> & u,
00606                       Handle< SystemSolver<LatticeStaggeredFermion> > & 
00607                       qprop,
00608                       XMLWriter & xml_out,
00609                       Real RsdCG, Real Mass, int j_decay){
00610 
00611 
00612     LatticeStaggeredFermion q_source, psi ;
00613     LatticeStaggeredFermion q_source_fuzz ;
00614     LatticeStaggeredPropagator quark_propagator;
00615 
00616     int ncg_had = 0;                         // count CG iterations
00617 
00618     psi = zero;                              // note this is ``zero'' and not 0
00619 
00620 
00621 
00622     for(int src_ind = 0; src_ind < 8 ; ++src_ind){
00623       stag_prop[src_ind] = zero ;
00624     
00625       for(int color_source = 0; color_source < Nc; ++color_source) {
00626 
00627         ncg_had += compute_quark_propagator_s(psi,type_of_src,
00628                                               gauge_shift, sym_shift,
00629                                               u, qprop, xml_out,
00630                                               RsdCG, Mass, j_decay,
00631                                               src_ind, color_source) ;
00632 
00633 
00634         /*
00635          * Move the solution to the appropriate components
00636          * of quark propagator.
00637          */
00638         FermToProp(psi, quark_propagator, color_source);
00639       }  //color_source
00640     
00641       stag_prop[src_ind] = quark_propagator;
00642 
00643     }// end src_ind
00644 
00645     return ncg_had;
00646   }
00647 
00648 /***************************************************************************/
00649   int
00650   MakeFuzzedCornerProp(LatticeStaggeredFermion & psi,
00651                        int fuzz_width,
00652                        bool gauge_shift, bool sym_shift,
00653                        const multi1d<LatticeColorMatrix> & u , 
00654                        multi1d<LatticeColorMatrix> & u_smr,
00655                        Handle< SystemSolver<LatticeStaggeredFermion> > & 
00656                        qprop,
00657                        XMLWriter & xml_out,
00658                        Real RsdCG, Real Mass,
00659                        int j_decay,
00660                        bool do_fuzzing,
00661                        LatticeStaggeredFermion &psi_fuzz,
00662                        LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc,
00663                        LatticeStaggeredPropagator &quark_propagator_Fsink_Lsrc,
00664                        LatticeStaggeredPropagator &quark_propagator_Lsink_Fsrc,
00665                        LatticeStaggeredPropagator &quark_propagator_Fsink_Fsrc
00666     ){
00667 
00668     //    stag_src_type type_of_src = LOCAL_SRC ;
00669     stag_src_type type_of_src = GAUGE_INVAR_LOCAL_SOURCE;
00670 
00671     QDPIO::cout << "LOCAL INVERSIONS"  << endl;
00672     int ncg_had = 0 ;
00673 
00674     for(int color_source = 0; color_source < Nc; ++color_source){
00675       psi = zero;    // note this is ``zero'' and not 0
00676 
00677       const int src_ind = 0 ;
00678       ncg_had += compute_quark_propagator_s(psi,type_of_src, 
00679                                             gauge_shift, sym_shift,
00680                                             fuzz_width,
00681                                             u, u_smr, qprop, xml_out,
00682                                             RsdCG, Mass,
00683                                             j_decay, src_ind, color_source) ;
00684 
00685       /*
00686        * Move the solution to the appropriate components
00687        * of quark propagator.
00688        */
00689       FermToProp(psi, quark_propagator_Lsink_Lsrc, color_source);
00690 
00691 
00692       //  fuzz at the sink 
00693       if( do_fuzzing ) {
00694         fuzz_smear(u_smr, psi, psi_fuzz, fuzz_width, j_decay) ;
00695         FermToProp(psi_fuzz, quark_propagator_Fsink_Lsrc, color_source);
00696       }
00697     } // color_source
00698 
00699 
00700     if( do_fuzzing ){
00701       type_of_src = FUZZED_SRC ;
00702 
00703       QDPIO::cout << "FUZZED SOURCE INVERSIONS"  << endl;
00704 
00705       for(int color_source = 0; color_source < Nc; ++color_source) {
00706         psi = zero;            // note this is ``zero'' and not 0
00707 
00708         const int src_ind = 0 ;
00709 
00710         ncg_had += compute_quark_propagator_s(psi,type_of_src, 
00711                                               gauge_shift, sym_shift, 
00712                                               fuzz_width,
00713                                               u, u_smr, qprop, xml_out,
00714                                               RsdCG, Mass, j_decay, src_ind, 
00715                                               color_source);
00716 
00717         /*
00718          * Move the solution to the appropriate components
00719          * of quark propagator.
00720          */
00721         FermToProp(psi, quark_propagator_Lsink_Fsrc, color_source);
00722 
00723 
00724         //  fuzz at the sink 
00725         fuzz_smear(u_smr, psi, psi_fuzz, fuzz_width, j_decay) ;
00726         FermToProp(psi_fuzz, quark_propagator_Fsink_Fsrc, color_source);
00727 
00728       }  //color_source
00729 
00730     }  // end of compute fuzzed correlator
00731 
00732     return ncg_had;
00733   }
00734 /***************************************************************************/
00735    int
00736   MakeCornerProp(LatticeStaggeredFermion & psi,
00737                  bool gauge_shift, bool sym_shift,
00738                  const multi1d<LatticeColorMatrix> & u ,
00739                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop,
00740                  XMLWriter & xml_out,
00741                  Real RsdCG, Real Mass,
00742                  int j_decay,
00743                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc,
00744                  stag_src_type type_of_src, int t_source = 0  ){
00745 
00746     //    stag_src_type type_of_src = LOCAL_SRC ;
00747     //    stag_src_type type_of_src = GAUGE_INVAR_LOCAL_SOURCE;
00748 
00749      //    QDPIO::cout << "LOCAL INVERSIONS"  << endl;
00750     int ncg_had = 0 ;
00751 
00752     for(int color_source = 0; color_source < Nc; ++color_source){
00753       psi = zero;    // note this is ``zero'' and not 0
00754 
00755       const int src_ind = 0 ;
00756       ncg_had += compute_quark_propagator_s(psi,type_of_src, 
00757                                             gauge_shift, sym_shift,
00758                                             u, qprop, xml_out,
00759                                             RsdCG, Mass,
00760                                             j_decay, src_ind, 
00761                                             color_source,t_source) ;
00762 
00763       /*
00764        * Move the solution to the appropriate components
00765        * of quark propagator.
00766        */
00767       FermToProp(psi, quark_propagator_Lsink_Lsrc, color_source);
00768 
00769     } // color_source
00770 
00771     return ncg_had;
00772   }
00773 
00774 
00775 
00776    int
00777   MakeCornerProp(LatticeStaggeredFermion & psi,
00778                  bool gauge_shift, bool sym_shift,
00779                  const multi1d<LatticeColorMatrix> & u ,
00780                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop,
00781                  XMLWriter & xml_out,
00782                  Real RsdCG, Real Mass,
00783                  int j_decay,
00784                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc,
00785                  stag_src_type type_of_src, int t_source,
00786                  LatticeStaggeredPropagator &qsource_out){
00787 
00788     //    stag_src_type type_of_src = LOCAL_SRC ;
00789     //    stag_src_type type_of_src = GAUGE_INVAR_LOCAL_SOURCE;
00790        LatticeStaggeredFermion q_source ;
00791 
00792 
00793      //    QDPIO::cout << "LOCAL INVERSIONS"  << endl;
00794     int ncg_had = 0 ;
00795 
00796     for(int color_source = 0; color_source < Nc; ++color_source){
00797       psi = zero;    // note this is ``zero'' and not 0
00798 
00799       // load the source
00800       PropToFerm(qsource_out,q_source,  color_source);
00801 
00802       const int src_ind = 0 ;
00803       ncg_had += compute_quark_propagator_s(psi,type_of_src, 
00804                                             gauge_shift, sym_shift,
00805                                             u, qprop, xml_out,
00806                                             RsdCG, Mass,
00807                                             j_decay, src_ind, 
00808                                             color_source,t_source,q_source) ;
00809 
00810       /*
00811        * Move the solution to the appropriate components
00812        * of quark propagator.
00813        */
00814       FermToProp(psi, quark_propagator_Lsink_Lsrc, color_source);
00815 
00816 
00817 
00818     } // color_source
00819 
00820     return ncg_had;
00821   }
00822 
00823 
00824 
00825 
00826 
00827    int
00828   MakeCornerProp(LatticeStaggeredFermion & psi_1,
00829                  bool gauge_shift, bool sym_shift,
00830                  const multi1d<LatticeColorMatrix> & u ,
00831                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop_1,
00832                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop_2,
00833                  XMLWriter & xml_out,
00834                  Real RsdCG, Real Mass_1,Real Mass_2,
00835                  int j_decay,
00836                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc_1,
00837                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc_2,
00838                  stag_src_type type_of_src, int t_source = 0  ){
00839 
00840      LatticeStaggeredFermion psi_2 ; 
00841     int ncg_had = 0 ;
00842 
00843     for(int color_source = 0; color_source < Nc; ++color_source){
00844       psi_1 = zero;    // note this is ``zero'' and not 0
00845       psi_2 = zero;    // note this is ``zero'' and not 0
00846 
00847       const int src_ind = 0 ;
00848       ncg_had += compute_quark_propagator_s(psi_1,psi_2,type_of_src, 
00849                                             gauge_shift, sym_shift,
00850                                             u, qprop_1,qprop_2, xml_out,
00851                                             RsdCG, Mass_1,Mass_2,
00852                                             j_decay, src_ind, 
00853                                             color_source,t_source) ;
00854 
00855       /*
00856        * Move the solution to the appropriate components
00857        * of quark propagator.
00858        */
00859       FermToProp(psi_1, quark_propagator_Lsink_Lsrc_1, color_source);
00860       FermToProp(psi_2, quark_propagator_Lsink_Lsrc_2, color_source);
00861 
00862     } // color_source
00863 
00864     return ncg_had;
00865   }
00866 
00867 
00868 /*  Also store the random source for additional inversions
00869 
00870 
00871 */
00872 
00873    int
00874   MakeCornerProp(LatticeStaggeredFermion & psi_1,
00875                  bool gauge_shift, bool sym_shift,
00876                  const multi1d<LatticeColorMatrix> & u ,
00877                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop_1,
00878                  Handle< SystemSolver<LatticeStaggeredFermion> > &  qprop_2,
00879                  XMLWriter & xml_out,
00880                  Real RsdCG, Real Mass_1,Real Mass_2,
00881                  int j_decay,
00882                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc_1,
00883                  LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc_2,
00884                  stag_src_type type_of_src, int t_source, 
00885                  LatticeStaggeredPropagator &qsource_out  ){
00886 
00887      LatticeStaggeredFermion psi_2 ; 
00888      LatticeStaggeredFermion q_source ; 
00889 
00890 
00891     int ncg_had = 0 ;
00892 
00893     for(int color_source = 0; color_source < Nc; ++color_source){
00894       psi_1 = zero;    // note this is ``zero'' and not 0
00895       psi_2 = zero;    // note this is ``zero'' and not 0
00896 
00897       // load the source 
00898       PropToFerm( qsource_out, q_source,color_source);
00899 
00900 
00901       const int src_ind = 0 ;
00902       ncg_had += compute_quark_propagator_s(psi_1,psi_2,type_of_src, 
00903                                             gauge_shift, sym_shift,
00904                                             u, qprop_1,qprop_2, xml_out,
00905                                             RsdCG, Mass_1,Mass_2,
00906                                             j_decay, src_ind, 
00907                                             color_source,t_source,q_source) ;
00908 
00909       /*
00910        * Move the solution to the appropriate components
00911        * of quark propagator.
00912        */
00913       FermToProp(psi_1, quark_propagator_Lsink_Lsrc_1, color_source);
00914       FermToProp(psi_2, quark_propagator_Lsink_Lsrc_2, color_source);
00915 
00916 
00917       // save the source 
00918       FermToProp(q_source, qsource_out, color_source);
00919 
00920     } // color_source
00921 
00922     return ncg_had;
00923   }
00924 
00925 
00926 
00927 /***************************************************************************/
00928 
00929   void
00930   DoFuzzing(const multi1d<LatticeColorMatrix> & u,
00931             multi1d<LatticeColorMatrix> & u_smr,
00932             int j_decay){
00933 
00934     QDPIO::cout << "Starting to APE smear the gauge configuration" << endl;
00935   
00936     Real sm_fact = 2.5;   // typical parameter
00937     int sm_numb = 10;     // number of smearing hits
00938         
00939     int BlkMax = 100;   // max iterations in max-ing trace
00940     Real BlkAccu = 1.0e-5;  // accuracy of max-ing
00941         
00942     u_smr = u;
00943     for(int i=0; i < sm_numb; ++i){
00944       multi1d<LatticeColorMatrix> u_tmp(Nd);
00945             
00946       for(int mu = 0; mu < Nd; ++mu){
00947         if ( mu != j_decay ){
00948           APE_Smear(u_smr, u_tmp[mu], mu, 0, sm_fact, BlkAccu, BlkMax, 
00949                     j_decay);
00950         }else{
00951           u_tmp[mu] = u_smr[mu];
00952         }
00953       }
00954       u_smr = u_tmp;
00955     }
00956 
00957 
00958 
00959   }
00960 
00961 
00962 /***************************************************************************/
00963 
00964   // Function call
00965   void 
00966   InlineStaggeredSpectrum::operator()(unsigned long update_no,
00967                                       XMLWriter& xml_out) {
00968     // If xml file not empty, then use alternate
00969     if (params.xml_file != ""){
00970       string xml_file = makeXMLFileName(params.xml_file, update_no);
00971 
00972       push(xml_out, "spectrum_s");
00973       write(xml_out, "update_no", update_no);
00974       write(xml_out, "xml_file", xml_file);
00975       pop(xml_out);
00976 
00977       XMLFileWriter xml(xml_file);
00978       func(update_no, xml);
00979     }
00980     else
00981     {
00982       func(update_no, xml_out);
00983     }
00984   }
00985 
00986 
00987   /***  **/
00988 
00989   void meson_charm(LatticeStaggeredPropagator & quark_prop, 
00990                    XMLWriter& xml_out, 
00991                    const multi1d<LatticeColorMatrix> & u,
00992                    int  t_source, int j_decay, int t_length)
00993   {
00994   push(xml_out, "local_meson_charm_correlators");
00995 
00996   // local pseudoscalar pion
00997   staggered_local_pion pion(t_length,u) ;
00998   pion.compute(quark_prop,quark_prop,j_decay) ;
00999   pion.dump(t_source,xml_out) ;
01000 
01001   bool avg_equiv_mom = true ;
01002   int mom2_max = 2 ; 
01003   // non-zero momentum
01004   multi1d<int> tsrc(4) ; 
01005   tsrc[0] =  tsrc[1] =  tsrc[2] =  tsrc[3] =  0 ; 
01006   tsrc[j_decay] = t_source ;
01007 
01008   SftMom phases(mom2_max, tsrc, avg_equiv_mom,j_decay);
01009 
01010 
01011   pion.compute_and_dump(quark_prop,quark_prop,j_decay,t_source,
01012                phases,xml_out) ;
01013 
01014   // ( gamma_4 gamma_5 cross gamma_4 gamma_5 ) pion
01015   g4g5_x_g4g5_local_meson pion_g4g5(t_length,u)  ;  
01016   pion_g4g5.compute(quark_prop,quark_prop,j_decay) ;
01017   pion_g4g5.dump(t_source,xml_out) ;
01018 
01019   // vector mesons
01020   vector_meson vector(t_length,  u) ;
01021   vector.compute(quark_prop,j_decay);
01022   vector.dump(t_source,xml_out);
01023 
01024   pop(xml_out);
01025 
01026 }
01027 
01028 
01029   /**
01030     Non-degenerate noisy heavy-light pseudoscalars
01031 
01032   **/
01033 
01034   void noisy_pion_nondegen(LatticeStaggeredPropagator & quark_prop_1, 
01035                            Real Mass1,
01036                            LatticeStaggeredPropagator & quark_prop_2, 
01037                            Real Mass2,
01038                            XMLWriter& xml_out, 
01039                            const multi1d<LatticeColorMatrix> & u,
01040                            int  t_source, int j_decay, int t_length)
01041   {
01042   push(xml_out, "non_degenerate_noisy_pseudoscalar_correlators");
01043 
01044   // local pseudoscalar pion
01045   push(xml_out, "meson_11");
01046   write(xml_out,"Mass",Mass1); 
01047   staggered_local_pion pion_1(t_length,u) ;
01048   pion_1.compute(quark_prop_1,quark_prop_1,j_decay) ;
01049   pion_1.dump(t_source,xml_out) ;
01050   pop(xml_out);
01051 
01052   push(xml_out, "meson_22");
01053   write(xml_out,"Mass",Mass2); 
01054   staggered_local_pion pion_2(t_length,u) ;
01055   pion_2.compute(quark_prop_2,quark_prop_2,j_decay) ;
01056   pion_2.dump(t_source,xml_out) ;
01057   pop(xml_out);
01058 
01059   push(xml_out, "meson_12");
01060   write(xml_out,"Mass1",Mass1); 
01061   write(xml_out,"Mass2",Mass2); 
01062   staggered_local_pion pion_12(t_length,u) ;
01063   pion_12.compute(quark_prop_1,quark_prop_2,j_decay) ;
01064   pion_12.dump(t_source,xml_out) ;
01065   pop(xml_out);
01066 
01067 
01068   //-----------------------
01069   pop(xml_out);
01070 
01071 }
01072 
01073 
01074 
01075 
01076 
01077 
01078 /***************************************************************************/
01079 
01080   // Real work done here
01081   void 
01082   InlineStaggeredSpectrum::func(unsigned long update_no,
01083                                 XMLWriter& xml_out) 
01084   {
01085     START_CODE();
01086 
01087     StopWatch snoop;
01088     snoop.reset();
01089     snoop.start();
01090 
01091     // Test and grab a reference to the gauge field
01092     XMLBufferWriter gauge_xml;
01093     try
01094     {
01095       TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
01096       TheNamedObjMap::Instance().get(params.named_obj.gauge_id).getRecordXML(gauge_xml);
01097     }
01098     catch( std::bad_cast ) 
01099     {
01100       QDPIO::cerr << InlineStaggeredSpectrumEnv::name << ": caught dynamic cast error" 
01101                   << endl;
01102       QDP_abort(1);
01103     }
01104     catch (const string& e) 
01105     {
01106       QDPIO::cerr << InlineStaggeredSpectrumEnv::name << ": map call failed: " << e 
01107                   << endl;
01108       QDP_abort(1);
01109     }
01110     const multi1d<LatticeColorMatrix>& u = 
01111       TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
01112 
01113     QDPIO::cout << InlineStaggeredSpectrumEnv::name << ": Spectroscopy for Staggered-like fermions" 
01114                 << endl;
01115     QDPIO::cout << "Gauge group: SU(" << Nc << ")" << endl;
01116 
01117     push(xml_out, "spectrum_s");
01118     write(xml_out, "update_no", update_no);
01119 
01120     /*  set some flags **/
01121 
01122     bool do_Baryon_local         = params.param.Baryon_local;
01123     bool do_ps4_singlet          = params.param.ps4link_singlet_conn;
01124     bool do_ps4_singlet_fuzz     = params.param.ps4link_singlet_conn_fuzz;
01125     bool Meson_local             = params.param.Meson_local ;
01126     bool Meson_charm_local       = params.param.Meson_charm_local ;
01127     bool Meson_charm_noisy_local = params.param.Meson_charm_noisy_local ;
01128     bool Wilson_loops             = params.param.Wilson_loops ;
01129     bool Pion_nondegen_noisy_local = params.param.Pion_nondegen_noisy_local ;
01130 
01131     bool Pion_nondegen_noisy_local2 = params.param.Pion_nondegen_noisy_local2 ;
01132     bool Pion_nondegen_noisy_local3 = params.param.Pion_nondegen_noisy_local3 ;
01133     bool Pion_nondegen_noisy_local4 = params.param.Pion_nondegen_noisy_local4 ;
01134 
01135     bool do_Baryon_vary          = params.param.Baryon_vary ;
01136     bool do_LocalPion_vary       = params.param.LocalPion_vary;
01137     bool do_LocalScalar_vary     = params.param.LocalScalar_vary;
01138     bool do_8_pions              = params.param.eight_pions;
01139     bool do_8_scalars            = params.param.eight_scalars;
01140     bool do_8_rhos               = params.param.eight_rhos;
01141     bool do_fuzzed_disc_loops    = params.param.disconnected_fuzz  ;
01142     bool do_local_disc_loops     = params.param.disconnected_local  ;
01143 
01144     //change this to do stochastic connected loops
01145     bool do_stoch_conn_corr       = false;
01146 
01147     bool do_fuzzing               = false;
01148     bool do_variational_spectra   = false;
01149 
01150     bool need_basic_8             = false;  
01151 
01152     bool need_fuzzed_corner_prop  = false;
01153 
01154     bool done_ps4_singlet         = false;
01155     bool done_ps4_singlet_fuzz    = false;
01156     bool done_local_baryons       = false;
01157     bool done_fuzzed_baryons      = false;
01158     bool done_local_disc_loops    = false;
01159     bool done_fuzzed_disc_loops   = false;
01160     bool done_meson_corr          = false;
01161     bool done_meson_charm_corr    = false;
01162 
01163     //shouldnt be hard-coded
01164     stag_src_type type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01165 
01166 
01167     if( ( do_Baryon_vary || do_LocalPion_vary  ||  do_LocalScalar_vary )|| 
01168         (do_fuzzed_disc_loops||do_ps4_singlet_fuzz)){
01169       // need smeared links
01170       do_fuzzing = true ;
01171     }
01172 
01173     if (( do_Baryon_vary || do_LocalPion_vary)||(do_ps4_singlet_fuzz) || do_LocalScalar_vary  ) {
01174 
01175       // make the fuzzed corner props
01176       // (LsrcLsnk, LsrcFsnk,FsrcLsink,FsrcFsnk)
01177 
01178       do_variational_spectra = true;
01179     }
01180 
01181     if( do_8_pions || do_8_scalars || do_8_rhos){
01182       need_basic_8 = true;
01183     }
01184 
01185 
01186     int          ncg_had = 0;                 // tally of all CG iterations
01187 
01188 
01189     bool         gauge_shift     = true;
01190     bool         sym_shift       = true;
01191     bool         loop_checkpoint = false;
01192     const int    j_decay         = Nd-1;
01193     int          Nsamp;
01194     int          CFGNO;
01195     VolSrc_type  volume_source;
01196     int          src_seperation;
01197     int          t_length;
01198 
01199 
01200     gauge_shift        = params.param.gauge_invar_oper;   // use covar shift?
01201     sym_shift          = params.param.sym_shift_oper;     // use symm shift?
01202     loop_checkpoint    = params.param.loop_checkpoint;    // write all meas?
01203     Nsamp              = params.param.Nsamp;              // # of stoch srcs
01204     CFGNO              = params.param.CFGNO;              // seed
01205     volume_source      = params.param.volume_source;      // type of vol src
01206     src_seperation     = params.param.src_seperation;     // sep of dilute srcs
01207     t_length           = params.param.nrow[j_decay];      // length of t dir
01208     Real RsdCG         = params.prop_param.invParam.RsdCG;// CG residual
01209     //    Real Mass          = params.prop_param.Mass;          // fermion mass
01210     Real Mass ; 
01211     int  fuzz_width    = params.param.fuzz_width;         // fuzzing width
01212     int  t_source      = params.param.t_srce[j_decay];    // source t coord
01213 
01214     /*
01215      * Sanity checks
01216      */
01217 
01218 
01219     QDPIO::cout << "Volume: " << params.param.nrow[0];
01220     for (int i=1; i<Nd; ++i) {
01221       QDPIO::cout << " x " << params.param.nrow[i];
01222     }
01223     QDPIO::cout << endl;
01224 
01225     proginfo(xml_out);    // Print out basic program info
01226 
01227 
01228     // Write out the input
01229     params.write(xml_out, "Input");
01230 
01231     // Write out the config info
01232     write(xml_out, "Config_info", gauge_xml);
01233 
01234     push(xml_out, "Output_version");
01235     write(xml_out, "out_version", 1);
01236     pop(xml_out);
01237 
01238     // First calculate some gauge invariant observables just for info.
01239     MesPlq(xml_out, "Observables", u);
01240 
01241     // Typedefs to save typing
01242     typedef LatticeStaggeredFermion      T;
01243     typedef multi1d<LatticeColorMatrix>  P;
01244     typedef multi1d<LatticeColorMatrix>  Q;
01245 
01246 #if 0 
01247     // Create a fermion state
01248     // boundary has been deleted
01249     Handle< CreateFermState<T,P,Q> > cfs(new CreateSimpleFermState<T,P,Q>(params.param.boundary));
01250 
01251     // Initialize fermion action
01252     AsqtadFermActParams asq_param;
01253     asq_param.Mass = params.prop_param.Mass;
01254     asq_param.u0   = params.prop_param.u0;
01255     AsqtadFermAct S_f(cfs, asq_param);
01256     Handle< FermState<T,P,Q> > state(S_f.createState(u));
01257 #endif
01258 
01259     //
01260     // Initialize fermion action
01261     //
01262 
01263     XMLReader fermact_reader ;
01264     // Make a memory 'input stream' out of the XML, so we can open an
01265     // XML Reader on it.
01266     try{
01267       std::istringstream is(params.param.fermact.xml);
01268 
01269       // Open a reader on the memory stream.
01270       //  XMLReader fermact_reader(is);
01271       fermact_reader.open(is);
01272     }
01273     catch (...)
01274       {
01275         QDPIO::cerr << "Error reading action name " << endl;
01276         throw;
01277       }
01278 
01279     Handle< StaggeredTypeFermAct< T,P,Q> > fermact(
01280 TheStagTypeFermActFactory::Instance().createObject(params.param.fermact.id, 
01281 fermact_reader, 
01282 params.param.fermact.path));
01283     // Cast of a pointer to a reference?
01284     StaggeredTypeFermAct<T,P,Q>& S_f= *(fermact);
01285 
01286     Mass = S_f.getQuarkMass() ;
01287     params.prop_param.Mass = S_f.getQuarkMass() ;
01288 
01289     // Set up a state for the current u,
01290     // (compute fat & triple links)
01291     // Use S_f.createState so that S_f can pass in u0
01292 
01293     Handle< FermState<T,P,Q> > state(S_f.createState(u));
01294 
01295     // Jiggery-pokery to turn a CG struct into a GroupXML_t for the qprops
01296     GroupXML_t inv_param;
01297     {
01298       XMLBufferWriter xml_buf;
01299       write(xml_buf, "InvertParam", params.prop_param.invParam);
01300       XMLReader xml_in(xml_buf);
01301       inv_param = readXMLGroup(xml_in, "/InvertParam", "invType");
01302     }
01303     Handle< SystemSolver<LatticeStaggeredFermion> > 
01304       qprop(S_f.qprop(state, inv_param));
01305 
01306 
01307 
01308     //
01309     //  local inversions
01310     // 
01311     LatticeStaggeredFermion psi ;
01312     LatticeStaggeredFermion q_source ; 
01313 
01314 
01315     if( Wilson_loops ) 
01316       {
01317         //      push(xml_out, "Wilson_loops") ;
01318         Wloop(xml_out,"Wilson_loops", u) ;
01319         //  pop(xml_out);
01320       }
01321 
01322 
01323 
01324     // Do local disconnected loops if we are not going to do fuzzed 
01325     //   disconnected loops.
01326 
01327     if (((  do_local_disc_loops ) && (do_stoch_conn_corr )) && 
01328         (!do_fuzzed_disc_loops)){
01329       push(xml_out, "disconnected_loops");
01330 
01331       StopWatch swatch;
01332       swatch.start();
01333       ks_local_loops_and_stoch_conn(qprop, q_source, psi , u, xml_out, 
01334                                     gauge_shift, sym_shift, loop_checkpoint,
01335                                     t_length, Mass, Nsamp, RsdCG, CFGNO, 
01336                                     volume_source, src_seperation, j_decay);
01337       swatch.stop();
01338       double time_in_sec  = swatch.getTimeInSeconds();
01339       QDPIO::cout << "PROF1:ks_local_loops_and_stoch_conn" << time_in_sec << " sec" << endl;
01340 
01341       pop(xml_out);
01342 
01343       done_local_disc_loops = true;
01344     }
01345 
01346 
01347     if((( do_local_disc_loops  )  && (!done_local_disc_loops))&&
01348        (!do_fuzzed_disc_loops)){
01349       push(xml_out, "disconnected_loops");
01350 
01351       StopWatch swatch;
01352       swatch.start();
01353       ks_local_loops(qprop, q_source, psi , u, xml_out, 
01354                      gauge_shift, sym_shift, loop_checkpoint,
01355                      t_length, Mass, Nsamp, RsdCG, CFGNO, volume_source, 
01356                      src_seperation, j_decay);
01357 
01358       swatch.stop();
01359       double time_in_sec  = swatch.getTimeInSeconds();
01360       QDPIO::cout << "PROF2:ks_local_loops " << time_in_sec << " sec" << endl;
01361 
01362       done_local_disc_loops = true;
01363 
01364       pop(xml_out);
01365     }
01366 
01367 
01368 
01369     if (need_basic_8 ){
01370       //Dont need to allocate u_smr here
01371 
01372       multi1d<LatticeStaggeredPropagator> stag_prop(8);
01373 
01374       StopWatch swatch;
01375       swatch.start();
01376       ncg_had += build_basic_8_props(stag_prop, type_of_src, gauge_shift,
01377                                      sym_shift, u, qprop, xml_out, RsdCG,  
01378                                      Mass, j_decay);
01379       swatch.stop();
01380       double time_in_sec  = swatch.getTimeInSeconds();
01381       QDPIO::cout << "PROF3:build_basic_8_props " << time_in_sec << " sec" << endl;
01382 
01383 
01384       // put the spectrum calls here 
01385       if(do_8_pions){
01386         // do pion stuff
01387 
01388         StopWatch swatch;
01389         swatch.start();
01390         compute_8_pions( stag_prop, u , gauge_shift, sym_shift,
01391                          xml_out, j_decay, t_length, t_source,
01392                          params.param.binary_meson_dump,
01393                          params.param.binary_name);
01394 
01395         swatch.stop();
01396         double time_in_sec  = swatch.getTimeInSeconds();
01397         QDPIO::cout << "PROF4:compute_8_pions " << time_in_sec << " sec" << endl;
01398 
01399       }
01400       if(do_8_scalars){
01401         // do scalar stuff
01402         compute_8_scalars( stag_prop, u,  gauge_shift, sym_shift,
01403                            xml_out, j_decay, t_length, t_source,
01404                            params.param.binary_meson_dump,
01405                            params.param.binary_name);
01406         
01407       }
01408       if(do_8_rhos){
01409         // do vector stuff
01410         compute_8_vectors( stag_prop, u,  gauge_shift, sym_shift,
01411                            xml_out, j_decay, t_length, t_source,
01412                            params.param.binary_meson_dump,
01413                            params.param.binary_name);
01414       }
01415 
01416 
01417       // if we need to do 4-link singlets and local baryons, do them here
01418       // so we can re-use the stag_pro[0] as the local corner prop
01419 
01420       if((( do_ps4_singlet ) && (!done_ps4_singlet))&&(!do_ps4_singlet_fuzz)) {
01421         //only do the non-fuzzed ps singlet if we are not doing the fuzzed 
01422         // ps singlet connected, as the latter does both
01423 
01424         StopWatch swatch;
01425         swatch.start();
01426 
01427         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01428         ncg_had += 
01429           compute_singlet_ps(psi,stag_prop[0], type_of_src, gauge_shift, 
01430                              sym_shift, u, qprop, xml_out, RsdCG,Mass,
01431                              j_decay, t_source, t_length);
01432 
01433         done_ps4_singlet = true;
01434         swatch.stop();
01435         double time_in_sec  = swatch.getTimeInSeconds();
01436         QDPIO::cout << "PROF5:compute_singlet_ps " << time_in_sec << " sec" << endl;
01437 
01438 
01439       }
01440 
01441 
01442       if((( do_Baryon_local) &&(!done_local_baryons)) && (!do_Baryon_vary)) {
01443 
01444         push(xml_out, "baryon_correlators");
01445 
01446         // describe the source
01447         string NN ;
01448         write(xml_out, "source_time", t_source);
01449         push(xml_out, "smearing_info");
01450         NN = "L" ;
01451         write_smearing_info(NN, LOCAL_SRC,xml_out, fuzz_width) ;
01452         pop(xml_out);
01453         string b_tag("srcLLL_sinkLLL_nucleon") ;
01454         string b_filename(params.param.binary_name+b_tag);
01455         ks_compute_baryon(b_tag,stag_prop[0],stag_prop[0],stag_prop[0],
01456                           xml_out, j_decay, t_length,
01457                           params.param.binary_baryon_dump,b_filename) ;
01458 
01459         pop(xml_out);
01460         done_local_baryons = true;
01461       }
01462 
01463  
01464     } // basic 8 
01465 
01466 
01467 
01468     // fuzz the gauge configuration. if needed
01469 
01470     if( do_fuzzing  ){
01471 
01472       LatticeStaggeredFermion psi_fuzz ;
01473       multi1d<LatticeColorMatrix> u_smr(Nd);
01474 
01475       u_smr = u ;
01476 
01477       {
01478         StopWatch swatch;
01479         swatch.start();
01480         DoFuzzing(u, u_smr, j_decay);
01481         swatch.stop();
01482         double time_in_sec  = swatch.getTimeInSeconds();
01483         QDPIO::cout << "PROF6: DoFuzzing " << time_in_sec << " sec" << endl;
01484       }
01485 
01486       if ( do_variational_spectra ){
01487 
01488         // only allocate these if needed
01489         LatticeStaggeredPropagator quark_propagator_Lsink_Lsrc;
01490         LatticeStaggeredPropagator quark_propagator_Fsink_Lsrc ;
01491         LatticeStaggeredPropagator quark_propagator_Lsink_Fsrc ;
01492         LatticeStaggeredPropagator quark_propagator_Fsink_Fsrc ;
01493 
01494         {
01495           StopWatch swatch;
01496           swatch.start();
01497 
01498           ncg_had+=  MakeFuzzedCornerProp(psi, fuzz_width, gauge_shift, 
01499                                         sym_shift, u, u_smr, qprop, 
01500                                         xml_out, RsdCG, Mass, j_decay,
01501                                         do_fuzzing, psi_fuzz,
01502                                         quark_propagator_Lsink_Lsrc,
01503                                         quark_propagator_Fsink_Lsrc,
01504                                         quark_propagator_Lsink_Fsrc,
01505                                         quark_propagator_Fsink_Fsrc );
01506           swatch.stop();
01507           double time_in_sec  = swatch.getTimeInSeconds();
01508           QDPIO::cout << "PROF7:MakeFuzzedCornerProp " << time_in_sec << " sec" << endl;
01509 
01510         }
01511 
01512 
01513           {
01514 
01515             //testing crap
01516             DComplex productLL;
01517             DComplex productLF;
01518             DComplex productFL;
01519             DComplex productFF;
01520 
01521             LatticeComplex test_corr_fnLL;
01522             LatticeComplex test_corr_fnLF;
01523             LatticeComplex test_corr_fnFL;
01524             LatticeComplex test_corr_fnFF;
01525 
01526             test_corr_fnLL = trace(adj(quark_propagator_Lsink_Lsrc)
01527                                  *quark_propagator_Lsink_Lsrc);
01528             test_corr_fnFL = trace(adj(quark_propagator_Fsink_Lsrc)
01529                                  *quark_propagator_Fsink_Lsrc);
01530             test_corr_fnLF = trace(adj(quark_propagator_Lsink_Fsrc)
01531                                  *quark_propagator_Lsink_Fsrc);
01532             test_corr_fnFF = trace(adj(quark_propagator_Fsink_Fsrc)
01533                                  *quark_propagator_Fsink_Fsrc);
01534 
01535             productLL = sum(test_corr_fnLL);
01536             productFL = sum(test_corr_fnFL);
01537             productLF = sum(test_corr_fnLF);
01538             productFF = sum(test_corr_fnFF);
01539 
01540             QDPIO::cout << "product of LL= " << productLL << std::endl; 
01541             QDPIO::cout << "product of FL= " << productFL << std::endl; 
01542             QDPIO::cout << "product of LF= " << productLF << std::endl; 
01543             QDPIO::cout << "product of FF= " << productFF << std::endl; 
01544             // one copy on output
01545           }
01546 
01547 
01548 
01549 
01550         if( do_Baryon_vary ) {
01551 
01552           compute_vary_baryon_s(xml_out,t_source,
01553                                 fuzz_width,
01554                                 j_decay,t_length,
01555                                 quark_propagator_Lsink_Lsrc,
01556                                 quark_propagator_Fsink_Lsrc,
01557                                 quark_propagator_Lsink_Fsrc,
01558                                 quark_propagator_Fsink_Fsrc,
01559                                 params.param.binary_baryon_dump,
01560                                 params.param.binary_name) ;
01561 
01562           done_local_baryons = true;
01563           done_fuzzed_baryons = true;
01564 
01565         }
01566 
01567 
01568         if( do_LocalPion_vary ) {
01569           compute_vary_ps(quark_propagator_Lsink_Lsrc,
01570                           quark_propagator_Fsink_Lsrc,
01571                           quark_propagator_Lsink_Fsrc,
01572                           quark_propagator_Fsink_Fsrc,
01573                           u, gauge_shift, sym_shift,
01574                           xml_out,j_decay,
01575                           t_length,t_source);
01576         }
01577 
01578 
01579         if( do_LocalScalar_vary ) {
01580           compute_vary_scalar(quark_propagator_Lsink_Lsrc,
01581                           quark_propagator_Fsink_Lsrc,
01582                           quark_propagator_Lsink_Fsrc,
01583                           quark_propagator_Fsink_Fsrc,
01584                           u, gauge_shift, sym_shift,
01585                           xml_out,j_decay,
01586                           t_length,t_source);
01587         }
01588 
01589         if(( do_ps4_singlet_fuzz ) && (!done_ps4_singlet_fuzz)) {
01590 
01591 
01592           ncg_had += 
01593             compute_vary_singlet_ps(psi, quark_propagator_Lsink_Lsrc,
01594                                     quark_propagator_Fsink_Lsrc,
01595                                     quark_propagator_Lsink_Fsrc,
01596                                     quark_propagator_Fsink_Fsrc,
01597                                     type_of_src, gauge_shift, sym_shift, u ,
01598                                     u_smr , qprop, xml_out, RsdCG, Mass, 
01599                                     j_decay, t_source, t_length,fuzz_width);
01600 
01601           done_ps4_singlet = true;
01602           done_ps4_singlet_fuzz = true;
01603 
01604         }
01605 
01606 
01607         // if we need to do local 4-link singlets and local baryons, 
01608         // do them here so we can re-use quark_propagator_Lsink_Lsrc 
01609         // as the local corner prop
01610 
01611         if(( do_ps4_singlet ) && (!done_ps4_singlet)) {
01612           type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01613 
01614           ncg_had += 
01615             compute_singlet_ps(psi,quark_propagator_Lsink_Lsrc, type_of_src,
01616                                gauge_shift, sym_shift, u, qprop, xml_out, 
01617                                RsdCG, Mass, j_decay, t_source, t_length);
01618 
01619           done_ps4_singlet = true;
01620         }
01621 
01622 
01623         if(( do_Baryon_local) &&(!done_local_baryons)) {
01624 
01625           push(xml_out, "baryon_correlators");
01626 
01627           // describe the source
01628           string NN ;
01629           write(xml_out, "source_time", t_source);
01630           push(xml_out, "smearing_info");
01631           NN = "L" ;
01632           write_smearing_info(NN, LOCAL_SRC,xml_out, fuzz_width) ;
01633           pop(xml_out);
01634           string b_tag("srcLLL_sinkLLL_nucleon") ;
01635           ks_compute_baryon(b_tag,quark_propagator_Lsink_Lsrc,
01636                             quark_propagator_Lsink_Lsrc,
01637                             quark_propagator_Lsink_Lsrc,
01638                             xml_out, j_decay, t_length,
01639                             params.param.binary_baryon_dump,
01640                             params.param.binary_name) ;
01641 
01642           pop(xml_out);
01643           done_local_baryons = true;
01644         }
01645 
01646         
01647       }// do_variational_spectra
01648 
01649 
01650 
01651       // still have the smeared links if needed for fuzzed loops
01652 
01653       if(( do_fuzzed_disc_loops  )&&(!done_fuzzed_disc_loops)) {
01654         push(xml_out, "disconnected_loops");
01655 
01656         StopWatch swatch;
01657         swatch.start();
01658 
01659         ks_fuzz_loops(qprop,q_source, psi ,psi_fuzz , u, u_smr,xml_out, 
01660                       gauge_shift, sym_shift, loop_checkpoint, t_length, Mass, 
01661                       Nsamp, RsdCG, CFGNO, volume_source, fuzz_width, 
01662                       src_seperation, j_decay, 
01663                       params.param.binary_loop_checkpoint,
01664                       params.param.binary_name);
01665         swatch.stop();
01666         double time_in_sec  = swatch.getTimeInSeconds();
01667         QDPIO::cout << "PROF9:ks_fuzz_loops " << time_in_sec << " sec" << endl;
01668 
01669 
01670 /* for testing
01671 
01672         ks_fuzz_loops_stoch_conn(qprop,q_source,psi ,psi_fuzz ,u,u_smr,
01673                                       xml_out, gauge_shift, sym_shift,
01674                                       loop_checkpoint, t_length, Mass, Nsamp,
01675                                       RsdCG, CFGNO, volume_source, fuzz_width, 
01676                                       src_seperation, j_decay);
01677 */
01678         pop(xml_out);
01679         done_local_disc_loops = true;
01680         done_fuzzed_disc_loops  = true;
01681       }
01682 
01683 
01684     }  // do fuzzing
01685 
01686 
01687 
01688 
01689     //might still need to local pions or baryons
01690 
01691     if((( do_ps4_singlet ) && (!done_ps4_singlet)) ||
01692        (( do_Baryon_local) &&(!done_local_baryons))  || 
01693        ( Meson_local  && ! done_meson_corr  )  ||
01694        (  Meson_charm_local && ! done_meson_charm_corr)
01695        )
01696       {
01697 
01698       //still need to compute local corner propagator
01699       LatticeStaggeredPropagator local_corner_prop;
01700 
01701       ncg_had += 
01702         MakeCornerProp(psi, gauge_shift, sym_shift, u , qprop, xml_out, RsdCG, 
01703                        Mass, j_decay, 
01704                        local_corner_prop, type_of_src, t_source);
01705 
01706 
01707 
01708       if(( do_ps4_singlet ) && (!done_ps4_singlet)) {
01709         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01710 
01711         ncg_had += 
01712           compute_singlet_ps(psi,local_corner_prop, type_of_src, gauge_shift, 
01713                              sym_shift, u, qprop, xml_out, RsdCG, Mass, 
01714                              j_decay, t_source, t_length);
01715 
01716         done_ps4_singlet = true;
01717       }
01718 
01719 
01720       if(( do_Baryon_local) &&(!done_local_baryons)) {
01721 
01722         push(xml_out, "baryon_correlators");
01723 
01724         // describe the source
01725         string NN ;
01726         write(xml_out, "source_time", t_source);
01727         push(xml_out, "smearing_info");
01728         NN = "L" ;
01729         write_smearing_info(NN, LOCAL_SRC,xml_out, fuzz_width) ;
01730         pop(xml_out);
01731         string b_tag("srcLLL_sinkLLL_nucleon") ;
01732         ks_compute_baryon(b_tag,local_corner_prop, local_corner_prop,
01733                           local_corner_prop, xml_out, j_decay, t_length,
01734                           params.param.binary_baryon_dump,
01735                           params.param.binary_name) ;
01736 
01737         pop(xml_out);
01738         done_local_baryons = true;
01739       }
01740 
01741       // local meson correlators 
01742       if( !done_meson_corr && Meson_local )
01743         {
01744           push(xml_out, "local_meson_correlators");
01745           staggered_local_pion pion(t_length,u) ;
01746           pion.compute(local_corner_prop,local_corner_prop,j_decay) ;
01747           pion.dump(t_source,xml_out) ;
01748           pop(xml_out);
01749           done_meson_corr = true ;
01750         }
01751 
01752 
01753       // local meson correlators 
01754       if( !done_meson_charm_corr && Meson_charm_local )
01755         {
01756           meson_charm(local_corner_prop,
01757                       xml_out, u,t_source,j_decay,t_length) ;
01758 
01759           done_meson_charm_corr = true ;
01760         }
01761 
01762 
01763       } // end if-then compute quark propagator
01764 
01765 
01766     if( Meson_charm_noisy_local 
01767         || Pion_nondegen_noisy_local
01768         || Pion_nondegen_noisy_local2
01769         || Pion_nondegen_noisy_local3  
01770         || Pion_nondegen_noisy_local4  
01771         )
01772     {
01773         int seed = t_source +  t_length * CFGNO  ;
01774         RNG::setrn(seed);
01775         QDPIO::cout << "Seeded RNG for noisy time slice source " << seed << endl;
01776         QDPIO::cout << "Set from t_source " << t_source << " CFG " << CFGNO << "\n" ;
01777     }
01778 
01779 
01780     // compute wall source
01781     if( Meson_charm_noisy_local  )
01782       {
01783           push(xml_out, "noisy_local_meson_correlators");
01784 
01785       LatticeStaggeredPropagator noisy_corner_prop;
01786 
01787       QDPIO::cout << "Starting inversion for noisy wall source \n" ;
01788       ncg_had += 
01789         MakeCornerProp(psi, gauge_shift, sym_shift, u , qprop, xml_out, RsdCG, 
01790                        Mass, j_decay, 
01791                        noisy_corner_prop, NOISY_LOCAL_SOURCE , t_source);
01792 
01793 
01794       meson_charm(noisy_corner_prop,xml_out, u,t_source,j_decay,t_length) ;
01795 
01796       pop(xml_out); 
01797       }
01798 
01799     LatticeStaggeredPropagator quark_source_nondegen ; 
01800     LatticeStaggeredPropagator noisy_corner_prop_strange;
01801 
01802 
01803     if( Pion_nondegen_noisy_local  )
01804       {
01805           push(xml_out, "noisy_local_nondegen_meson_correlators");
01806       QDPIO::cout << "Setting up second inverter for nondegen\n" ;
01807 
01808         // create second inverter for different mass
01809         XMLReader fermact_reader2 ;
01810         try{
01811           std::istringstream is(params.param.fermact2.xml);
01812           fermact_reader2.open(is);
01813         }
01814         catch (...)
01815           {
01816             QDPIO::cerr << "Error reading SECOND action name " << endl;
01817             throw;
01818           }
01819 
01820         Handle< StaggeredTypeFermAct< T,P,Q> > fermact2(
01821                                                        TheStagTypeFermActFactory::Instance().createObject(params.param.fermact.id,
01822 fermact_reader2,params.param.fermact2.path));
01823 
01824         StaggeredTypeFermAct<T,P,Q>& S_f2= *(fermact2);
01825         Handle< FermState<T,P,Q> > state2(S_f2.createState(u));
01826 
01827         Handle< SystemSolver<LatticeStaggeredFermion> > 
01828           qprop2(S_f2.qprop(state, inv_param));
01829 
01830         Real Mass2 = S_f2.getQuarkMass() ;
01831         Real Mass1 = S_f.getQuarkMass() ;
01832         
01833 
01834         LatticeStaggeredPropagator noisy_corner_prop_2;
01835         
01836         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01837 //      type_of_src = NOISY_LOCAL_SOURCE ; 
01838     
01839         QDPIO::cout << "Starting non-degen inversions for local source\n" ;
01840     ncg_had += 
01841       MakeCornerProp(psi, gauge_shift, sym_shift, u , qprop, qprop2, 
01842                        xml_out, RsdCG, 
01843                        Mass1, Mass2, j_decay, 
01844                        noisy_corner_prop_strange, noisy_corner_prop_2, 
01845                        type_of_src , t_source,quark_source_nondegen);
01846 
01847     noisy_pion_nondegen(noisy_corner_prop_strange,Mass1,
01848                         noisy_corner_prop_2,Mass2,
01849                         xml_out, u,t_source,j_decay,t_length) ;
01850 
01851     pop(xml_out); 
01852       }
01853 
01854 
01855 
01856 
01857     if( Pion_nondegen_noisy_local2  )
01858       {
01859           push(xml_out, "noisy_local_nondegen_meson_correlators_2");
01860       QDPIO::cout << "Setting up third inverter for nondegen\n" ;
01861 
01862         // create second inverter for different mass
01863         XMLReader fermact_reader2 ;
01864         try{
01865           std::istringstream is(params.param.fermact3.xml);
01866           fermact_reader2.open(is);
01867         }
01868         catch (...)
01869           {
01870             QDPIO::cerr << "Error reading THIRD action name " << endl;
01871             throw;
01872           }
01873 
01874         Handle< StaggeredTypeFermAct< T,P,Q> > fermact2(
01875                                                        TheStagTypeFermActFactory::Instance().createObject(params.param.fermact3.id,
01876 fermact_reader2,params.param.fermact3.path));
01877 
01878         StaggeredTypeFermAct<T,P,Q>& S_f2= *(fermact2);
01879         Handle< FermState<T,P,Q> > state2(S_f2.createState(u));
01880 
01881         Handle< SystemSolver<LatticeStaggeredFermion> > 
01882           qprop2(S_f2.qprop(state, inv_param));
01883 
01884         Real Mass2 = S_f2.getQuarkMass() ;
01885         Real Mass1 = S_f.getQuarkMass() ;
01886         
01887         LatticeStaggeredPropagator noisy_corner_prop_2;
01888         
01889         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01890 //      type_of_src = LOAD_IN_SOURCE ;
01891     
01892         QDPIO::cout << "Starting 2nd inversions for local source\n" ;
01893         ncg_had += 
01894       MakeCornerProp(psi, gauge_shift, sym_shift, u ,qprop2, 
01895                        xml_out, RsdCG, 
01896                        Mass2, j_decay, 
01897                        noisy_corner_prop_2, 
01898                        type_of_src , t_source,quark_source_nondegen);
01899 
01900 
01901 
01902 
01903     noisy_pion_nondegen(noisy_corner_prop_strange,Mass1,
01904                         noisy_corner_prop_2,Mass2,
01905                         xml_out, u,t_source,j_decay,t_length) ;
01906 
01907     pop(xml_out); 
01908       }
01909 
01910 
01911 
01912 
01913 
01914 
01915     if( Pion_nondegen_noisy_local3  )
01916       {
01917           push(xml_out, "noisy_local_nondegen_meson_correlators_3");
01918       QDPIO::cout << "Setting up fourth inverter for nondegen\n" ;
01919 
01920         // create second inverter for different mass
01921         XMLReader fermact_reader4 ;
01922         try{
01923           std::istringstream is(params.param.fermact4.xml);
01924           fermact_reader4.open(is);
01925         }
01926         catch (...)
01927           {
01928             QDPIO::cerr << "Error reading FOURTH action name " << endl;
01929             throw;
01930           }
01931 
01932         Handle< StaggeredTypeFermAct< T,P,Q> > fermact2(
01933                                                        TheStagTypeFermActFactory::Instance().createObject(params.param.fermact4.id,
01934 fermact_reader4,params.param.fermact4.path));
01935 
01936         StaggeredTypeFermAct<T,P,Q>& S_f2= *(fermact2);
01937         Handle< FermState<T,P,Q> > state2(S_f2.createState(u));
01938 
01939         Handle< SystemSolver<LatticeStaggeredFermion> > 
01940           qprop2(S_f2.qprop(state, inv_param));
01941 
01942         Real Mass2 = S_f2.getQuarkMass() ;
01943         Real Mass1 = S_f.getQuarkMass() ;
01944         
01945         LatticeStaggeredPropagator noisy_corner_prop_2;
01946         
01947 //      type_of_src = LOAD_IN_SOURCE ;
01948         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
01949     
01950         QDPIO::cout << "Starting 3rd inversions for local source\n" ;
01951         ncg_had += 
01952       MakeCornerProp(psi, gauge_shift, sym_shift, u ,qprop2, 
01953                        xml_out, RsdCG, 
01954                        Mass2, j_decay, 
01955                        noisy_corner_prop_2, 
01956                        type_of_src , t_source,quark_source_nondegen);
01957 
01958 
01959     noisy_pion_nondegen(noisy_corner_prop_strange,Mass1,
01960                         noisy_corner_prop_2,Mass2,
01961                         xml_out, u,t_source,j_decay,t_length) ;
01962 
01963     pop(xml_out); 
01964       }
01965 
01966 
01967 
01968 
01969 
01970     if( Pion_nondegen_noisy_local4  )
01971       {
01972           push(xml_out, "noisy_local_nondegen_meson_correlators_4");
01973       QDPIO::cout << "Setting up fifth inverter for nondegen\n" ;
01974 
01975         // create second inverter for different mass
01976         XMLReader fermact_reader5 ;
01977         try{
01978           std::istringstream is(params.param.fermact5.xml);
01979           fermact_reader5.open(is);
01980         }
01981         catch (...)
01982           {
01983             QDPIO::cerr << "Error reading FIFTH action name " << endl;
01984             throw;
01985           }
01986 
01987         Handle< StaggeredTypeFermAct< T,P,Q> > fermact5(
01988                                                        TheStagTypeFermActFactory::Instance().createObject(params.param.fermact5.id,
01989 fermact_reader5,params.param.fermact5.path));
01990 
01991         StaggeredTypeFermAct<T,P,Q>& S_f2= *(fermact5);
01992         Handle< FermState<T,P,Q> > state2(S_f2.createState(u));
01993 
01994         Handle< SystemSolver<LatticeStaggeredFermion> > 
01995           qprop2(S_f2.qprop(state, inv_param));
01996 
01997         Real Mass2 = S_f2.getQuarkMass() ;
01998         Real Mass1 = S_f.getQuarkMass() ;
01999         
02000         LatticeStaggeredPropagator noisy_corner_prop_2;
02001         
02002 //      type_of_src = LOAD_IN_SOURCE ;
02003         type_of_src = GAUGE_INVAR_LOCAL_SOURCE ;
02004         QDPIO::cout << "Starting 4th inversions for local source\n" ;
02005 
02006         ncg_had += 
02007       MakeCornerProp(psi, gauge_shift, sym_shift, u ,qprop2, 
02008                        xml_out, RsdCG, 
02009                        Mass2, j_decay, 
02010                        noisy_corner_prop_2, 
02011                        type_of_src , t_source,quark_source_nondegen);
02012 
02013     noisy_pion_nondegen(noisy_corner_prop_strange,Mass1,
02014                         noisy_corner_prop_2,Mass2,
02015                         xml_out, u,t_source,j_decay,t_length) ;
02016 
02017     pop(xml_out); 
02018       }
02019 
02020 
02021 
02022 
02023   
02024     pop(xml_out); // spectrum_s
02025 
02026     snoop.stop();
02027     QDPIO::cout << InlineStaggeredSpectrumEnv::name << ": total time = "
02028                 << snoop.getTimeInSeconds() 
02029                 << " secs" << endl;
02030 
02031     QDPIO::cout << InlineStaggeredSpectrumEnv::name << ": ran successfully" << endl;
02032 
02033     END_CODE();
02034   }  // end of InlineStaggeredSpectrum
02035 
02036 }

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