mesplq.cc

Go to the documentation of this file.
00001 // $Id: mesplq.cc,v 3.1 2006/08/24 21:04:31 edwards Exp $
00002 /*! \file
00003  *  \brief Plaquette measurement
00004  */
00005 
00006 #include "chromabase.h"
00007 #include "meas/glue/mesplq.h"
00008 #include "meas/glue/polylp.h"
00009 
00010 
00011 namespace Chroma 
00012 {
00013 
00014   // Primitive way for now to indicate the time direction
00015   static int tDir() {return Nd-1;}
00016 
00017   //! Return the value of the average plaquette normalized to 1
00018   /*!
00019    * \ingroup glue
00020    *
00021    * \param u           gauge field (Read)
00022    * \param plane_plaq  plane plaquette average (Write)
00023    * \param link        space-time average link (Write)
00024    */
00025 
00026   void MesPlq(const multi1d<LatticeColorMatrix>& u, 
00027               multi2d<Double>& plane_plaq, Double& link)
00028   {
00029     START_CODE();
00030 
00031     plane_plaq.resize(Nd,Nd);
00032     link = zero;
00033 
00034     // Compute the average plaquettes
00035     for(int mu=1; mu < Nd; ++mu)
00036     {
00037       for(int nu=0; nu < mu; ++nu)
00038       {
00039 #if 0
00040         // This is the the longer way to write the 1-liner in the else clause
00041 
00042         /* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
00043         LatticeColorMatrix tmp_0 = shift(u[nu],FORWARD,mu) * adj(shift(u[mu],FORWARD,nu));
00044 
00045         /* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
00046         LatticeColorMatrix tmp_1 = tmp_0 * adj(u[nu]);
00047 
00048         /* tmp = sum(tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu))) */
00049         Double tmp = sum(real(trace(u[mu]*tmp_1)));
00050 
00051 #else
00052         // This is the the short way to write the clause in the above block
00053 
00054         /* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
00055         /* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
00056         /* wplaq_tmp = tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu)) */
00057         Double tmp = 
00058           sum(real(trace(u[mu]*shift(u[nu],FORWARD,mu)*adj(shift(u[mu],FORWARD,nu))*adj(u[nu]))));
00059 #endif
00060 
00061         plane_plaq[mu][nu] = tmp;
00062       }
00063     }
00064 
00065     // Normalize the planes
00066     for(int mu=1; mu < Nd; ++mu)
00067       for(int nu=0; nu < mu; ++nu)
00068       {
00069         plane_plaq[mu][nu] /= Double(Layout::vol()*Nc);
00070         plane_plaq[nu][mu] = plane_plaq[mu][nu];
00071       }
00072 
00073     // Compute the average link
00074     for(int mu=0; mu < Nd; ++mu)
00075       link += sum(real(trace(u[mu])));
00076 
00077     link /= Double(Layout::vol()*Nd*Nc);
00078 
00079     END_CODE();
00080   }
00081 
00082 
00083   //! Return the value of the average plaquette normalized to 1
00084   /*!
00085    * \ingroup glue
00086    *
00087    * \param u           gauge field (Read)
00088    * \param w_plaq      plaquette average (Write)
00089    * \param s_plaq      space-like plaquette average (Write)
00090    * \param t_plaq      time-like plaquette average (Write)
00091    * \param plane_plaq  plane plaquette average (Write)
00092    * \param link        space-time average link (Write)
00093    */
00094 
00095   void MesPlq(const multi1d<LatticeColorMatrix>& u, 
00096               Double& w_plaq, Double& s_plaq, Double& t_plaq, 
00097               multi2d<Double>& plane_plaq,
00098               Double& link)
00099   {
00100     START_CODE();
00101 
00102     // Compute plane plaquettes and link
00103     MesPlq(u, plane_plaq, link);
00104 
00105     // Compute basic plaquettes
00106     w_plaq = s_plaq = t_plaq = zero;
00107 
00108     for(int mu=1; mu < Nd; ++mu)
00109     {
00110       for(int nu=0; nu < mu; ++nu)
00111       {
00112         Double tmp = plane_plaq[mu][nu];
00113 
00114         w_plaq += tmp;
00115 
00116         if (mu == tDir() || nu == tDir())
00117           t_plaq += tmp;
00118         else 
00119           s_plaq += tmp;
00120       }
00121     }
00122   
00123     // Normalize
00124     w_plaq *= 2.0 / Double(Nd*(Nd-1));
00125   
00126     if (Nd > 2) 
00127       s_plaq *= 2.0 / Double((Nd-1)*(Nd-2));
00128   
00129     t_plaq /= Double(Nd-1);
00130   
00131     END_CODE();
00132   }
00133 
00134 
00135   //! Return the value of the average plaquette normalized to 1
00136   /*!
00137    * \ingroup glue
00138    *
00139    * \param u           gauge field (Read)
00140    * \param w_plaq      plaquette average (Write)
00141    * \param s_plaq      space-like plaquette average (Write)
00142    * \param t_plaq      time-like plaquette average (Write)
00143    * \param link        space-time average link (Write)
00144    */
00145 
00146   void MesPlq(const multi1d<LatticeColorMatrix>& u, 
00147               Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link)
00148   {
00149     START_CODE();
00150 
00151     multi2d<Double> plane_plaq;
00152 
00153     MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
00154 
00155     END_CODE();
00156   }
00157 
00158 
00159   //! Print the value of the average plaquette normalized to 1
00160   /*!
00161    * \ingroup glue
00162    *
00163    * \param xml        plaquette average (Write)
00164    * \param xml_group  xml file object ( Read )
00165    * \param u          gauge field (Read)
00166    */
00167   void MesPlq(XMLWriter& xml, 
00168               const string& xml_group,
00169               const multi1d<LatticeColorMatrix>& u)
00170   {
00171     START_CODE();
00172 
00173     Double w_plaq, s_plaq, t_plaq, link;
00174     multi2d<Double> plane_plaq;
00175     multi1d<DComplex> pollp;
00176 
00177     MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
00178     polylp(u, pollp);
00179 
00180     push(xml, xml_group);
00181     write(xml, "w_plaq", w_plaq);
00182     write(xml, "s_plaq", s_plaq);
00183     write(xml, "t_plaq", t_plaq);
00184 
00185     if (Nd >= 2)
00186     {
00187       write(xml, "plane_01_plaq", plane_plaq[0][1]);
00188     }
00189 
00190     if (Nd >= 3)
00191     {
00192       write(xml, "plane_02_plaq", plane_plaq[0][2]);
00193       write(xml, "plane_12_plaq", plane_plaq[1][2]);
00194     }
00195 
00196     if (Nd >= 4)
00197     {
00198       write(xml, "plane_03_plaq", plane_plaq[0][3]);
00199       write(xml, "plane_13_plaq", plane_plaq[1][3]);
00200       write(xml, "plane_23_plaq", plane_plaq[2][3]);
00201     }
00202 
00203 // This is commented out because it is redundant and takes up space
00204 // in what can be huge XML output files. However, if the info is
00205 // really useful it is trivial to turn the output back on.
00206 //    push(xml, "PlanePlaq");
00207 //    for(int mu=0; mu < Nd-1; ++mu)
00208 //    {
00209 //      for(int nu=mu+1; nu < Nd; ++nu)
00210 //      {
00211 //      push(xml, "elem");
00212 //      write(xml, "mu", mu);
00213 //      write(xml, "nu", nu);
00214 //      write(xml, "plane_plaq", plane_plaq[mu][nu]);
00215 //      pop(xml);  // elem
00216 //      }
00217 //    }
00218 //    pop(xml);  // PlanePlaq
00219 
00220     write(xml, "link", link);
00221     write(xml, "pollp", pollp);
00222 
00223     pop(xml);  // xml_group
00224 
00225     END_CODE();
00226   }
00227 
00228 }  // end namespace Chroma

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