CHROMA
grelax.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Perform a single gauge fixing iteration
3  */
4 
5 #include "chromabase.h"
6 #include "meas/gfix/axgauge.h"
8 #include "util/gauge/sunfill.h"
9 
10 namespace Chroma {
11 
12 
13 /********************** HACK ******************************/
14 // Primitive way for now to indicate the time direction
15 static int tDir() {return Nd-1;}
16 static Real xi_0() {return 1.0;}
17 static bool anisoP() {return false;}
18 /******************** END HACK ***************************/
19 
20 //! Perform a single gauge fixing iteration
21 /*!
22  * \ingroup gfix
23  *
24  * Performs one gauge fixing 'iteration', one checkerboard and SU(2)
25  * subgroup only, for gauge fixing to Coulomb gauge in slices perpendicular
26  * to the direction "j_decay".
27  *
28  * \param g Current (global) gauge transformation matrices ( Modify )
29  * \param u original gauge field ( Read )
30  * \param j_decay direction perpendicular to slices to be gauge fixed ( Read )
31  * \param su2_index SU(2) subgroup index ( Read )
32  * \param cb checkerboard index ( Read )
33  * \param ordo use overrelaxation or not ( Read )
34  * \param orpara overrelaxation parameter ( Read )
35  */
36 
37 void grelax(LatticeColorMatrix& g,
38  const multi1d<LatticeColorMatrix>& u,
39  int j_decay, int su2_index, int cb, bool ordo,
40  const Real& orpara)
41 {
42  LatticeColorMatrix v;
43  multi1d<LatticeReal> r(4);
44  multi1d<LatticeReal> a(4);
45 
46  START_CODE();
47 
48  // Rotate the matrices using the current gauge rotation
49  multi1d<LatticeColorMatrix> ug(Nd);
50  for(int mu = 0; mu < Nd; ++mu)
51  ug[mu] = g * u[mu] * shift(adj(g), FORWARD, mu);
52 
53  /* Gather the Nd negative links attached to a site: */
54  /* u_tmp(x,mu) = U(x-mu,mu) */
55  multi1d<LatticeColorMatrix> u_neg(Nd);
56  for(int mu=0; mu<Nd; ++mu)
57  u_neg[mu][rb[cb]] = shift(ug[mu], BACKWARD, mu);
58 
59  /* Sum links to be gauge transformed on site x not in the direction */
60  /* j_decay into matrix V: */
61  v = 0;
62  if (tDir() != j_decay)
63  {
64  v[rb[cb]] = ug[tDir()] + adj(u_neg[tDir()]);
65 
66  if (anisoP())
67  v[rb[cb]] *= pow(xi_0(), 2);
68  }
69 
70  for(int mu = 0; mu < Nd; ++mu)
71  {
72  if (mu != j_decay && mu != tDir())
73  v[rb[cb]] += ug[mu] + adj(u_neg[mu]);
74  }
75 
76  if (Nc > 1)
77  {
78 
79  /* Extract components r_k proportional to SU(2) submatrix su2_index */
80  /* from the SU(Nc) matrix V. The SU(2) matrix is parametrized in the */
81  /* sigma matrix basis. */
82  su2Extract(r, v, su2_index, rb[cb]);
83 
84  /*
85  * Now project onto SU(2)
86  */
87  LatticeReal r_l;
88  r_l[rb[cb]] = sqrt(r[0]*r[0] + r[1]*r[1] + r[2]*r[2] + r[3]*r[3]);
89 
90  // Normalize
91  LatticeBoolean lbtmp;
92  lbtmp[rb[cb]] = r_l > fuzz;
93  LatticeReal lftmp;
94  lftmp[rb[cb]] = 1.0 / where(lbtmp, r_l, LatticeReal(1));
95 
96  // Fill (r[0]/r_l, -r[1]/r_l, -r[2]/r_l, -r[3]/r_l) for r_l > fuzz
97  // and (1,0,0,0) for sites with r_l < fuzz
98  multi1d<LatticeReal> a(4);
99  a[0][rb[cb]] = where(lbtmp, r[0] * lftmp, LatticeReal(1));
100  a[1][rb[cb]] = where(lbtmp, -(r[1] * lftmp), LatticeReal(0));
101  a[2][rb[cb]] = where(lbtmp, -(r[2] * lftmp), LatticeReal(0));
102  a[3][rb[cb]] = where(lbtmp, -(r[3] * lftmp), LatticeReal(0));
103 
104  /* Now do the overrelaxation, if desired */
105  if( ordo )
106  {
107  /* get angle */
108  LatticeReal theta_old;
109  theta_old[rb[cb]] = acos(a[0]);
110 
111  /* old sin */
112  LatticeReal oldsin;
113  oldsin[rb[cb]] = sin(theta_old);
114 
115  /* overrelax, i.e. multiply by the angle */
116  LatticeReal theta_new;
117  theta_new[rb[cb]] = theta_old * orpara;
118 
119  /* compute sin(new)/sin(old) */
120  /* set the ratio to 0, if sin(old) < FUZZ */
121  lftmp[rb[cb]] = where(oldsin > fuzz, sin(theta_new) / oldsin, LatticeReal(0));
122 
123  /* get the new cos = a[0] */
124  a[0][rb[cb]] = cos(theta_new);
125 
126  /* get the new a_k, k = 1, 2, 3 */
127  a[1][rb[cb]] *= lftmp;
128  a[2][rb[cb]] *= lftmp;
129  a[3][rb[cb]] *= lftmp;
130  }
131 
132 
133  /* Now fill the SU(Nc) matrix V with the SU(2) submatrix 'su2_index' */
134  /* paramtrized by a_k in the sigma matrix basis. */
135  sunFill(v, a, su2_index, rb[cb]);
136 
137  }
138  else /* Nc = 1 */
139  {
140  r[0][rb[cb]] = real(peekColor(v, 0, 0));
141  r[1][rb[cb]] = imag(peekColor(v, 0, 0));
142  LatticeReal r_l;
143  r_l[rb[cb]] = sqrt(r[0] * r[0] + r[1] * r[1]);
144 
145  // Normalize
146  LatticeBoolean lbtmp;
147  lbtmp[rb[cb]] = r_l > fuzz;
148  LatticeReal lftmp;
149  lftmp[rb[cb]] = 1.0 / where(lbtmp, r_l, LatticeReal(1));
150 
151  // Fill (r[0]/r_l, -r[1]/r_l, -r[2]/r_l, -r[3]/r_l) for r_l > fuzz
152  // and (1,0,0,0) for sites with r_l < fuzz
153  multi1d<LatticeReal> a(4);
154  a[0][rb[cb]] = where(lbtmp, r[0] * lftmp, LatticeReal(1));
155  a[1][rb[cb]] = where(lbtmp, -(r[1] * lftmp), LatticeReal(0));
156 
157  /* Now do the overrelaxation, if desired */
158  if( ordo )
159  {
160  Real pi = 0.5 * twopi;
161 
162  /* get angle */
163  LatticeReal theta;
164  theta[rb[cb]] = acos(a[0]) + pi; // Do I really want to add pi ??? This was in szin
165 
166  /* overrelax, i.e. multiply by the angle */
167  theta[rb[cb]] *= orpara;
168 
169  /* get the new cos = a[0] */
170  a[0][rb[cb]] = cos(theta);
171 
172  /* get the new sin */
173  a[1][rb[cb]] = sin(theta);
174  }
175 
176  pokeColor(v, cmplx(a[0],a[1]), 0, 0);
177  }
178 
179 
180  // Now do the gauge transformation with matrix V:
181  // Multiply into the global "g" field
182  LatticeColorMatrix u_tmp;
183  u_tmp[rb[cb]] = v * g;
184  g[rb[cb]] = u_tmp;
185 
186  END_CODE();
187 }
188 
189 } // end namespace Chroma
Axial gauge fixing.
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
int su2_index
Definition: cool.cc:27
void sunFill(LatticeColorMatrix &dest, const multi1d< LatticeReal > &r, int su2_index, const Subset &s)
Fill a dest(su2_index) <- r_0,r_1,r_2,r_3 under a subset.
Definition: sunfill.cc:33
void su2Extract(multi1d< LatticeReal > &r, const LatticeColorMatrix &source, int su2_index, const Subset &s)
Su2_extract: r_0,r_1,r_2,r_3 <- source(su2_index) [SU(N) field] under a subset.
Definition: su2extract.cc:86
void grelax(LatticeColorMatrix &g, const multi1d< LatticeColorMatrix > &u, int j_decay, int su2_index, int cb, bool ordo, const Real &orpara)
Perform a single gauge fixing iteration.
Definition: grelax.cc:37
int j_decay
Definition: meslate.cc:22
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static int tDir()
Definition: coulgauge.cc:14
static multi1d< LatticeColorMatrix > u
static Real xi_0()
Definition: coulgauge.cc:15
const Real twopi
Definition: chromabase.h:55
Complex a
Definition: invbicg.cc:95
START_CODE()
static bool anisoP()
Definition: grelax.cc:17
int cb
Definition: invbicg.cc:120
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Extract an unnormalized SU(2) matrix from a GL(3,C) matrix.
Fill an SU(Nc) matrix with an SU(2) submatrix.