CHROMA
block.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct "block" links
3  */
4 
5 #include "chromabase.h"
6 #include "util/gauge/reunit.h"
7 #include "util/gauge/shift2.h"
8 #include "util/gauge/su3proj.h"
9 #include "meas/glue/block.h"
10 
11 namespace Chroma
12 {
13 
14  //! Construct block links
15  /*!
16  * \ingroup glue
17  *
18  * Construct block links from:
19  * x x x------x
20  * | | _______ |
21  * | | \ |
22  * | | \ |
23  * | = x + \ x
24  * | | / |
25  * | | / |
26  * | | /______ |
27  * x x x------x
28 
29  * projected back onto SU(Nc)
30 
31  * Warning: this works only for Nc = 2 and 3 !
32 
33  * \param u_block blocked gauge field ( Write )
34  * \param u gauge field ( Read )
35  * \param mu direction of blocked gauge field ( Read )
36  * \param bl_level blocking level (of the u's) ( Read )
37  * \param BlkAccu accuracy in fuzzy link projection ( Read )
38  * \param BlkMax maximum number of iterations in fuzzy link projection ( Read )
39  * \param j_decay no staple in direction j_decay ( Read )
40  */
41 
42  void block(LatticeColorMatrix& u_block,
43  const multi1d<LatticeColorMatrix>& u,
44  int mu, int bl_level,
45  const Real& BlkAccu, int BlkMax, int j_decay)
46  {
47  START_CODE();
48 
49  LatticeColorMatrix u_dble;
50  LatticeColorMatrix u_unproj;
51  LatticeColorMatrix tmp_1;
52  LatticeColorMatrix tmp_2;
53  LatticeColorMatrix tmp_3;
54 
55  /* Construct straight line segment x------x------x */
56  /* tmp_1(x) = u(x+mu*2^bl_level,mu) */
57  tmp_1 = shift2(u[mu], FORWARD, mu, bl_level);
58 
59  /* u_block = u(x,mu) * tmp_1 */
60  u_block = u[mu] * tmp_1;
61 
62  /* A copy */
63  u_dble = u_block;
64 
65  /* Now construct and add the staples, except in direction j_decay */
66  for(int nu = 0; nu < Nd; ++nu)
67  {
68  if( nu != mu && nu != j_decay )
69  {
70  /* Forward staple */
71  /* tmp_1(x) = u(x+mu*2**(bl_level+1),nu) */
72  tmp_1 = shift2(u[nu], FORWARD, mu, bl_level+1);
73 
74  /* tmp_2(x) = u_dble(x+nu*2^bl_level) */
75  tmp_1 = shift2(u_dble, FORWARD, nu, bl_level);
76 
77  /* tmp_3 = tmp_2 * tmp_1_dagger */
78  tmp_3 = tmp_2 * adj(tmp_1);
79 
80  /* u_block = u_block + u(x,nu) * tmp_3 */
81  u_block += u[nu] * tmp_3;
82 
83  /* Backward staple */
84  /* tmp_1(x) = u(x+mu*2^(bl_level+1),nu) */
85  tmp_1 = shift2(u[nu], FORWARD, mu, bl_level+1);
86 
87  /* tmp_2 = u_dble(x,mu) * tmp_1 */
88  tmp_2 = u_dble * tmp_1;
89 
90  /* tmp_1 = u_dagger(x,nu) * tmp_2 */
91  tmp_1 = adj(u[nu]) * tmp_2;
92 
93  /* tmp_2(x) = tmp_1(x-nu*2^bl_level) */
94  tmp_2 = shift2(tmp_1, BACKWARD, nu, bl_level);
95 
96  /* u_block = u_block + tmp_2 */
97  u_block += tmp_2;
98  }
99  }
100 
101 
102  /* Now project back to SU(3) by maximizing tr(u_block*u_dble_dagger), */
103  /* where u_dble is the unprojected block link. */
104  /* This is done by looping proj_iter times over the 3 SU(2) subgroups */
105  u_unproj = adj(u_block);
106 
107  /* Start with a unitarized version */
108  reunit(u_block);
109 
110  /* The initial trace */
111  Double old_tr = sum(real(trace(u_block * u_unproj)));
112  old_tr /= Double(QDP::Layout::vol()*Nc);
113 
114  int n_blk = 0;
115  bool wrswitch = true; /* Write out iterations? */
116  Double conver = 1;
117 
118  while ( toBool(conver > BlkAccu) && n_blk < BlkMax )
119  {
120  n_blk = n_blk + 1;
121 
122  /* Loop over SU(2) subgroup su2_index */
123  for(int su2_index = 0; su2_index < Nc*(Nc-1)/2; ++su2_index)
124  su3proj(u_block, u_unproj, su2_index);
125 
126  /* Reunitarize */
127  {
128  LatticeBoolean bad;
129  int numbad;
130  reunit(u_block, bad, numbad, REUNITARIZE_LABEL);
131  if ( numbad > 0 )
132  {
133  QDPIO::cout << "BLOCK: WARNING unitarity violation\n";
134  QDPIO::cout << " n_blk= " << n_blk << " bl_level= " << bl_level << "\n";
135  QDPIO::cout << " mu= " << mu << " numbad= " << numbad << std::endl;
136  }
137  }
138 
139  /* Calculate the trace */
140  Double new_tr = sum(real(trace(u_block * u_unproj)));
141  new_tr /= Double(QDP::Layout::vol()*Nc);
142 
143  if( wrswitch )
144  {
145  QDPIO::cout << "BLOCK: n=" << n_blk
146  << " old_tr = " << old_tr << " new_tr = " << new_tr << std::endl;
147  }
148 
149  /* Normalized convergence criterion: */
150  conver = fabs((new_tr - old_tr) / old_tr);
151  old_tr = new_tr;
152  }
153 
154  END_CODE();
155  }
156 
157 }
Construct "block" links.
Primary include file for CHROMA library code.
int numbad
Definition: cool.cc:28
int mu
Definition: cool.cc:24
int su2_index
Definition: cool.cc:27
int nu
Definition: cool.cc:25
LatticeBoolean bad
Definition: cool.cc:22
LatticeColorMatrix shift2(const LatticeColorMatrix &s1, int isign, int dir, int level)
A simple not-fancy power of 2 shift.
Definition: shift2.cc:13
void block(LatticeColorMatrix &u_block, const multi1d< LatticeColorMatrix > &u, int mu, int bl_level, const Real &BlkAccu, int BlkMax, int j_decay)
Construct block links.
Definition: block.cc:42
LatticeColorMatrix tmp_2
Definition: meslate.cc:51
int j_decay
Definition: meslate.cc:22
LatticeColorMatrix tmp_3
Definition: meslate.cc:52
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
@ REUNITARIZE_LABEL
Definition: reunit.h:29
START_CODE()
FloatingPoint< double > Double
Definition: gtest.h:7351
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
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)