ape_smear.cc

Go to the documentation of this file.
00001 //  $Id: ape_smear.cc,v 3.2 2006/08/24 02:34:18 edwards Exp $
00002 /*! \file
00003  *  \brief APE-smearing of the gauge configuration
00004  */
00005 
00006 #include "chromabase.h"
00007 #include "meas/smear/ape_smear.h"
00008 #include "util/gauge/reunit.h"
00009 #include "util/gauge/su3proj.h"
00010 #include "util/gauge/shift2.h"
00011 
00012 namespace Chroma 
00013 { 
00014   //! Construct APE smeared links from:
00015   /*!
00016    * \ingroup smear
00017    *
00018    *
00019    *                                  _______ 
00020    *      x               x           \           x------x
00021    *      +               |            \                 |
00022    *      +     =     c * |     +       \                |
00023    *      +               |             /                |
00024    *      x               x            /          x------x
00025    *                                  /______ 
00026    *
00027    *
00028    * Arguments:
00029    *
00030    * where c is the smearing factor sm_fact, and projected back onto SU(Nc)
00031 
00032    * Warning: this works only for Nc = 2 and 3 !
00033 
00034    * \param u        gauge field ( Read )
00035    * \param u_smear  smeared gauge field ( Write )
00036    * \param mu       direction of smeared gauge field ( Read )
00037    * \param bl_level blocking level (of the u's) ( Read )
00038    * \param sm_fact  smearing factor ( Read )
00039    * \param BlkAccu  accuracy in fuzzy link projection ( Read )
00040    * \param BlkMax   maximum number of iterations in fuzzy link projection ( Read )
00041    * \param j_decay  no staple in direction j_decay ( Read )
00042    */
00043 
00044   void APE_Smear(const multi1d<LatticeColorMatrix>& u,
00045                  LatticeColorMatrix& u_smear,
00046                  int mu, int bl_level, 
00047                  const Real& sm_fact, const Real& BlkAccu, 
00048                  int BlkMax, int j_decay)
00049   {
00050     START_CODE();
00051   
00052     // Initialize smeared link: sm_fact * "old" link
00053     u_smear = u[mu] * sm_fact;
00054 
00055     // Now construct and add the staples, except in direction j_decay
00056     for(int nu = 0; nu < Nd; ++nu)
00057     {
00058       if( nu != mu && nu != j_decay )
00059       {
00060         /* Forward staple */
00061         /* u_smear = u_smear + u(x,nu) * u(x+nu*2^bl_level,mu) * adj(u(x+mu*2^bl_level,nu)) */
00062         u_smear += u[nu] * shift2(u[mu], FORWARD, nu, bl_level) 
00063           * adj(shift2(u[nu], FORWARD, mu, bl_level));
00064 
00065         /* Backward staple */
00066         /* tmp_1 = u_dagger(x,nu) * u(x,mu) * u(x+mu*2^bl_level,nu) */
00067         LatticeColorMatrix tmp_1 = adj(u[nu]) * u[mu] * shift2(u[nu], FORWARD, mu, bl_level);
00068 
00069         /* u_smear = u_smear + tmp_1(x-nu*2^bl_level) */
00070         u_smear += shift2(tmp_1, BACKWARD, nu, bl_level);
00071       }
00072     }
00073 
00074       
00075     /* Now project back to SU(3) by maximizing tr(u_smear*u_unproj_dagger), */
00076     /* where u_unproj is the unprojected smear link. */
00077     /* This is done by looping proj_iter times over the 3 SU(2) subgroups */
00078     LatticeColorMatrix u_unproj = adj(u_smear);
00079 
00080 #if 0
00081     /* Start with a unitarized version */
00082     reunit(u_smear);
00083 #else
00084     /* Start with original link */
00085     u_smear = u[mu];
00086 #endif
00087 
00088 
00089 #if 0
00090     // Do not yet support schroedinger functional BC
00091     if (SchrFun > 0)
00092     {
00093       /* Make it easy, since these are overwritten anyway! */
00094       copymask(u_smear,  lSFmask[mu], LatticeReal(1));
00095       copymask(u_unproj, lSFmask[mu], LatticeReal(1));
00096     }
00097 #endif
00098 
00099     /* The initial trace */
00100     Double old_tr = sum(real(trace(u_smear * u_unproj))) / toDouble(Layout::vol()*Nc);
00101     Double new_tr;
00102 
00103     int n_smr = 0;
00104     bool wrswitch = false;                      /* Write out iterations? */
00105     Double conver = 1;
00106   
00107     while ( toBool(conver > BlkAccu)  &&  n_smr < BlkMax )
00108     {
00109       ++n_smr;
00110 
00111       // Loop over SU(2) subgroup index
00112       for(int su2_index = 0; su2_index < Nc*(Nc-1)/2; ++su2_index)
00113         su3proj(u_smear, u_unproj, su2_index);
00114 
00115       /* Reunitarize */
00116       reunit(u_smear);
00117     
00118       /* Calculate the trace */
00119       new_tr = sum(real(trace(u_smear * u_unproj))) / toDouble(Layout::vol()*Nc);
00120 
00121       if( wrswitch )
00122         QDPIO::cout << " BLOCK: " << n_smr << " old_tr= " << old_tr << " new_tr= " << new_tr;
00123 
00124       /* Normalized convergence criterion: */
00125       conver = fabs((new_tr - old_tr) / old_tr);
00126       old_tr = new_tr;
00127     }
00128   
00129 
00130     //  if ( wrswitch )
00131     //  {
00132     //    push(nml_out,"Final_smear");
00133     //    write(nml_out, "mu", mu);
00134     //    write(nml_out, "n_smr", n_smr);
00135     //    write(nml_out, "new_tr", new_tr);
00136     //    pop(nml_out);
00137     //  }
00138 
00139 #if 0
00140     // Do not yet support schroedinger functional BC
00141     if (SchrFun > 0)
00142     {
00143       /* Now do the overwrite. */
00144       copymask(u_smear, lSFmask[mu], SFBndFld[mu]);
00145     }
00146 #endif
00147 
00148     END_CODE();
00149   }
00150 
00151 } // Namespace Chroma

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