CHROMA
ape_smear.cc
Go to the documentation of this file.
1 // $Id: ape_smear.cc,v 3.2 2006-08-24 02:34:18 edwards Exp $
2 /*! \file
3  * \brief APE-smearing of the gauge configuration
4  */
5 
6 #include "chromabase.h"
7 #include "meas/smear/ape_smear.h"
8 #include "util/gauge/reunit.h"
9 #include "util/gauge/su3proj.h"
10 #include "util/gauge/shift2.h"
11 
12 namespace Chroma
13 {
14  //! Construct APE smeared links from:
15  /*!
16  * \ingroup smear
17  *
18  *
19  * _______
20  * x x \ x------x
21  * + | \ |
22  * + = c * | + \ |
23  * + | / |
24  * x x / x------x
25  * /______
26  *
27  *
28  * Arguments:
29  *
30  * where c is the smearing factor sm_fact, and projected back onto SU(Nc)
31 
32  * Warning: this works only for Nc = 2 and 3 !
33 
34  * \param u gauge field ( Read )
35  * \param u_smear smeared gauge field ( Write )
36  * \param mu direction of smeared gauge field ( Read )
37  * \param bl_level blocking level (of the u's) ( Read )
38  * \param sm_fact smearing factor ( Read )
39  * \param BlkAccu accuracy in fuzzy link projection ( Read )
40  * \param BlkMax maximum number of iterations in fuzzy link projection ( Read )
41  * \param j_decay no staple in direction j_decay ( Read )
42  */
43 
44  void APE_Smear(const multi1d<LatticeColorMatrix>& u,
45  LatticeColorMatrix& u_smear,
46  int mu, int bl_level,
47  const Real& sm_fact, const Real& BlkAccu,
48  int BlkMax, int j_decay)
49  {
50  START_CODE();
51 
52  // Initialize smeared link: sm_fact * "old" link
53  u_smear = u[mu] * sm_fact;
54 
55  // Now construct and add the staples, except in direction j_decay
56  for(int nu = 0; nu < Nd; ++nu)
57  {
58  if( nu != mu && nu != j_decay )
59  {
60  /* Forward staple */
61  /* u_smear = u_smear + u(x,nu) * u(x+nu*2^bl_level,mu) * adj(u(x+mu*2^bl_level,nu)) */
62  u_smear += u[nu] * shift2(u[mu], FORWARD, nu, bl_level)
63  * adj(shift2(u[nu], FORWARD, mu, bl_level));
64 
65  /* Backward staple */
66  /* tmp_1 = u_dagger(x,nu) * u(x,mu) * u(x+mu*2^bl_level,nu) */
67  LatticeColorMatrix tmp_1 = adj(u[nu]) * u[mu] * shift2(u[nu], FORWARD, mu, bl_level);
68 
69  /* u_smear = u_smear + tmp_1(x-nu*2^bl_level) */
70  u_smear += shift2(tmp_1, BACKWARD, nu, bl_level);
71  }
72  }
73 
74 
75  /* Now project back to SU(3) by maximizing tr(u_smear*u_unproj_dagger), */
76  /* where u_unproj is the unprojected smear link. */
77  /* This is done by looping proj_iter times over the 3 SU(2) subgroups */
78  LatticeColorMatrix u_unproj = adj(u_smear);
79 
80 #if 0
81  /* Start with a unitarized version */
82  reunit(u_smear);
83 #else
84  /* Start with original link */
85  u_smear = u[mu];
86 #endif
87 
88 
89 #if 0
90  // Do not yet support schroedinger functional BC
91  if (SchrFun > 0)
92  {
93  /* Make it easy, since these are overwritten anyway! */
94  copymask(u_smear, lSFmask[mu], LatticeReal(1));
95  copymask(u_unproj, lSFmask[mu], LatticeReal(1));
96  }
97 #endif
98 
99  /* The initial trace */
100  Double old_tr = sum(real(trace(u_smear * u_unproj))) / toDouble(Layout::vol()*Nc);
101  Double new_tr;
102 
103  int n_smr = 0;
104  bool wrswitch = false; /* Write out iterations? */
105  Double conver = 1;
106 
107  while ( toBool(conver > BlkAccu) && n_smr < BlkMax )
108  {
109  ++n_smr;
110 
111  // Loop over SU(2) subgroup index
112  for(int su2_index = 0; su2_index < Nc*(Nc-1)/2; ++su2_index)
113  su3proj(u_smear, u_unproj, su2_index);
114 
115  /* Reunitarize */
116  reunit(u_smear);
117 
118  /* Calculate the trace */
119  new_tr = sum(real(trace(u_smear * u_unproj))) / toDouble(Layout::vol()*Nc);
120 
121  if( wrswitch )
122  QDPIO::cout << " BLOCK: " << n_smr << " old_tr= " << old_tr << " new_tr= " << new_tr;
123 
124  /* Normalized convergence criterion: */
125  conver = fabs((new_tr - old_tr) / old_tr);
126  old_tr = new_tr;
127  }
128 
129 
130  // if ( wrswitch )
131  // {
132  // push(nml_out,"Final_smear");
133  // write(nml_out, "mu", mu);
134  // write(nml_out, "n_smr", n_smr);
135  // write(nml_out, "new_tr", new_tr);
136  // pop(nml_out);
137  // }
138 
139 #if 0
140  // Do not yet support schroedinger functional BC
141  if (SchrFun > 0)
142  {
143  /* Now do the overwrite. */
144  copymask(u_smear, lSFmask[mu], SFBndFld[mu]);
145  }
146 #endif
147 
148  END_CODE();
149  }
150 
151 } // Namespace Chroma
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
int su2_index
Definition: cool.cc:27
int nu
Definition: cool.cc:25
LatticeColorMatrix shift2(const LatticeColorMatrix &s1, int isign, int dir, int level)
A simple not-fancy power of 2 shift.
Definition: shift2.cc:13
void APE_Smear(const multi1d< LatticeColorMatrix > &u, LatticeColorMatrix &u_smear, int mu, int bl_level, const Real &sm_fact, const Real &BlkAccu, int BlkMax, int j_decay)
Construct APE smeared links from:
Definition: ape_smear.cc:44
int j_decay
Definition: meslate.cc:22
LatticeColorMatrix tmp_1
Definition: meslate.cc:50
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
void su3proj(LatticeColorMatrix &u, const LatticeColorMatrix &w, int su2_index)
Definition: su3proj.cc:76
void reunit(LatticeColorMatrixF3 &xa)
Definition: reunit.cc:467
START_CODE()
FloatingPoint< double > Double
Definition: gtest.h:7351
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
copymask(lcoord, lbit, ltmp_1, REPLACE)
Double sum
Definition: qtopcor.cc:37
Reunitarize in place a color matrix to SU(N)
Shift by a power of 2.
Project a GL(3,C) color matrix onto SU(3)