CHROMA
coulgauge.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Coulomb (and Landau) gauge fixing
3  */
4 
5 #include "chromabase.h"
6 #include "meas/gfix/coulgauge.h"
7 #include "meas/gfix/grelax.h"
8 #include "util/gauge/reunit.h"
9 
10 namespace Chroma {
11 
12 /********************** HACK ******************************/
13 // Primitive way for now to indicate the time direction
14 static int tDir() {return Nd-1;}
15 static Real xi_0() {return 1.0;}
16 /******************** END HACK ***************************/
17 
18 
19 //! Coulomb (and Landau) gauge fixing
20 /*!
21  * \ingroup gfix
22  *
23  * Driver for gauge fixing to Coulomb gauge in slices perpendicular
24  * to the direction "j_decay".
25  * If j_decay >= Nd: fix to Landau gauge.
26  * Note: as written this works only for SU(2) and SU(3)!
27 
28  * \param u (gauge fixed) gauge field ( Modify )
29  * \param n_gf number of gauge fixing iterations ( Write )
30  * \param j_decay direction perpendicular to slices to be gauge fixed ( Read )
31  * \param GFAccu desired accuracy for gauge fixing ( Read )
32  * \param GFMax maximal number of gauge fixing iterations ( Read )
33  * \param OrDo use overrelaxation or not ( Read )
34  * \param OrPara overrelaxation parameter ( Read )
35  */
36 
37 void coulGauge(multi1d<LatticeColorMatrix>& u,
38  int& n_gf,
39  int j_decay, const Real& GFAccu, int GFMax,
40  bool OrDo, const Real& OrPara)
41 {
42  LatticeColorMatrix g;
43 
44  coulGauge(u, g, n_gf, j_decay, GFAccu, GFMax, OrDo, OrPara);
45 }
46 
47 
48 
49 //! Coulomb (and Landau) gauge fixing
50 /*!
51  * \ingroup gfix
52  *
53  * Driver for gauge fixing to Coulomb gauge in slices perpendicular
54  * to the direction "j_decay".
55  * If j_decay >= Nd: fix to Landau gauge.
56  * Note: as written this works only for SU(2) and SU(3)!
57 
58  * \param u (gauge fixed) gauge field ( Modify )
59  * \param g Gauge transformation matrices (Write)
60  * \param n_gf number of gauge fixing iterations ( Write )
61  * \param j_decay direction perpendicular to slices to be gauge fixed ( Read )
62  * \param GFAccu desired accuracy for gauge fixing ( Read )
63  * \param GFMax maximal number of gauge fixing iterations ( Read )
64  * \param OrDo use overrelaxation or not ( Read )
65  * \param OrPara overrelaxation parameter ( Read )
66  */
67 
68 void coulGauge(multi1d<LatticeColorMatrix>& u,
69  LatticeColorMatrix& g,
70  int& n_gf,
71  int j_decay, const Real& GFAccu, int GFMax,
72  bool OrDo, const Real& OrPara)
73 {
74  Double tgfold;
75  Double tgfnew;
76  Double tgf_t;
77  Double tgf_s;
78  Double norm;
79  int num_sdir;
80  bool tdirp;
81 
82  START_CODE();
83 
84  Real xi_sq = pow(xi_0(),2);
85  if( j_decay >= 0 && j_decay < Nd )
86  {
87  if( tDir() >= 0 && tDir() != j_decay )
88  {
89  num_sdir = Nd - 2;
90  tdirp = true;
91  norm = Double(Layout::vol()*Nc) * (Double(num_sdir)+Double(xi_sq));
92  }
93  else
94  {
95  num_sdir = Nd - 1;
96  tdirp = false;
97  norm = Double(Layout::vol()*Nc*num_sdir);
98  }
99  }
100  else
101  {
102  if( tDir() >= 0 && tDir() < Nd )
103  {
104  num_sdir = Nd - 1;
105  tdirp = true;
106  norm = Double(Layout::vol()*Nc) * (Double(num_sdir)+Double(xi_sq));
107  }
108  else
109  {
110  num_sdir = Nd;
111  tdirp = false;
112  norm = Double(Layout::vol()*Nc*num_sdir);
113  }
114  }
115 
116 
117  /* Compute initial gauge fixing term: sum(trace(U_spacelike)); */
118  tgf_t = 0;
119  tgf_s = 0;
120  for(int mu=0; mu<Nd; ++mu)
121  if( mu != j_decay )
122  {
123  Double tgf_tmp = sum(real(trace(u[mu])));
124 
125  if( mu != tDir() )
126  tgf_s += tgf_tmp;
127  else
128  tgf_t += tgf_tmp;
129  }
130 
131  if( tdirp )
132  {
133  tgfold = (xi_sq*tgf_t+tgf_s)/norm;
134  tgf_s = tgf_s/(Double(Layout::vol()*Nc*num_sdir));
135  tgf_t = tgf_t/(Double(Layout::vol()*Nc));
136  }
137  else
138  {
139  tgf_s = tgf_s/(Double(Layout::vol()*Nc*num_sdir));
140  tgfold = tgf_s;
141  }
142 
143  // Gauge transf. matrices always start from identity
144  g = 1;
145 
146  /* Gauge fix until converged or too many iterations */
147  n_gf = 0;
148  bool wrswitch = true; /* switch for writing of gauge fixing term */
149  Double conver = 1; /* convergence criterion */
150 
151  while( toBool(conver > GFAccu) && n_gf < GFMax )
152  {
153  n_gf = n_gf + 1;
154  if( GFMax - n_gf < 11 )
155  wrswitch = true;
156 
157  /* Loop over checkerboards for gauge fixing */
158  for(int cb=0; cb<2; ++cb)
159  {
160  if (Nc > 1)
161  {
162  /* Loop over SU(2) subgroup index */
163  for(int su2_index=0; su2_index < Nc*(Nc-1)/2; ++su2_index)
164  {
165  /* Now do a gauge fixing relaxation step */
166  grelax(g, u, j_decay, su2_index, cb, OrDo, OrPara);
167  } /* end su2_index loop */
168  }
169  else
170  {
171  int su2_index = -1;
172  /* Now do a gauge fixing relaxation step */
173  grelax(g, u, j_decay, su2_index, cb, OrDo, OrPara);
174  }
175  } /* end cb loop */
176 
177  /* Reunitarize */
178  reunit(g);
179 
180  /* Compute new gauge fixing term: sum(trace(U_spacelike)): */
181  tgf_t = 0;
182  tgf_s = 0;
183  for(int mu=0; mu<Nd; ++mu)
184  if( mu != j_decay )
185  {
186  Double tgf_tmp = sum(real(trace(g * u[mu] * shift(adj(g), FORWARD, mu))));
187 
188  if( mu != tDir() )
189  tgf_s += tgf_tmp;
190  else
191  tgf_t += tgf_tmp;
192  }
193 
194  if( tdirp )
195  {
196  tgfnew = (xi_sq*tgf_t+tgf_s)/norm;
197  tgf_s = tgf_s/(Double(Layout::vol()*Nc*num_sdir));
198  tgf_t = tgf_t/(Double(Layout::vol()*Nc));
199  }
200  else
201  {
202  tgf_s = tgf_s/(Double(Layout::vol()*Nc*num_sdir));
203  tgfnew = tgf_s;
204  }
205 
206  if( wrswitch )
207  QDPIO::cout << "COULGAUGE: iter= " << n_gf
208  << " tgfold= " << tgfold
209  << " tgfnew= " << tgfnew
210  << " tgf_s= " << tgf_s
211  << " tgf_t= " << tgf_t << std::endl;
212 
213  /* Normalized convergence criterion: */
214  conver = fabs((tgfnew - tgfold) / tgfnew);
215  tgfold = tgfnew;
216  } /* end while loop */
217 
218 
219  if( wrswitch )
220  QDPIO::cout << "COULGAUGE: end: iter= " << n_gf
221  << " tgfold= " << tgfold
222  << " tgf_s= " << tgf_s
223  << " tgf_t= " << tgf_t << std::endl;
224 
225  // Finally, gauge rotate the original matrices and overwrite them
226  for(int mu = 0; mu < Nd; ++mu)
227  {
228  LatticeColorMatrix u_tmp = g * u[mu];
229  u[mu] = u_tmp * shift(adj(g), FORWARD, mu);
230  }
231 
232 #if 0
233  /*+ debugging */
234  XMLBufferWriter xml_out;
235  push(xml_out,"Final_trace_max_in_CoulGauge");
236  write(xml_out, "j_decay", j_decay);
237  write(xml_out, "t_dir", tDir());
238  write(xml_out, "n_gf",n_gf);
239  write(xml_out, "tgfold", tgfold);
240  write(xml_out, "tgf_s", tgf_s);
241  write(xml_out, "tgf_t", tgf_t);
242  pop(xml_out);
243 #endif
244 
245  END_CODE();
246 }
247 
248 
249 } // Namespace Chroma
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
int su2_index
Definition: cool.cc:27
Coulomb (and Landau) gauge fixing.
Perform a single gauge fixing iteration.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void coulGauge(multi1d< LatticeColorMatrix > &u, int &n_gf, int j_decay, const Real &GFAccu, int GFMax, bool OrDo, const Real &OrPara)
Coulomb (and Landau) gauge fixing.
Definition: coulgauge.cc:37
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
push(xml_out,"Condensates")
void reunit(LatticeColorMatrixF3 &xa)
Definition: reunit.cc:467
pop(xml_out)
START_CODE()
int cb
Definition: invbicg.cc:120
FloatingPoint< double > Double
Definition: gtest.h:7351
#define FORWARD
Definition: primitives.h:82
Double sum
Definition: qtopcor.cc:37
int norm
Definition: qtopcor.cc:35
Reunitarize in place a color matrix to SU(N)