CHROMA
instanton.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct an instanton or anti-instanton configuration in singular gauge.
3  *
4  * Arguments:
5  *
6  * \param u_inst Gauge field (Write)
7  * \param center location of instanton center ( Read )
8  * \param rho size of instanton ( Read )
9  * \param su2_index SU(2) subgroup index ( Read )
10  * \param sign instanton (1) or anti-instanton ( Read )
11 */
12 
13 #include "chromabase.h"
14 #include "util/gauge/sunfill.h"
15 
16 namespace Chroma
17 {
18  void instanton(multi1d<LatticeColorMatrix>& u_inst, const multi1d<Real>& center, Real rho, int su2_index, int sign)
19  {
20  multi1d<LatticeReal> rel_coord(Nd);
21  LatticeReal r2;
22  LatticeReal phimu;
23  LatticeReal phimus;
24  LatticeReal a_0;
25  LatticeReal a_1;
26  LatticeReal a_2;
27  LatticeReal a_3;
28  LatticeReal tmp1;
29  LatticeReal tmp2;
30  LatticeReal rel_tmp;
31  LatticeInteger my_coord;
32  LatticeInteger coord_sum;
33  LatticeInteger litmp;
34  LatticeBoolean lbtmp;
35  int mu;
36  int itmp;
37 
38  Real ftmp;
39  Real ftmp2;
40 
41  /* Include any hooks in the start macro */
42  START_CODE(); /*# May include declarations and/or code. */
43 
44  /* Start executable code */
45 
46  if ( Nd != 4 )
47  QDP_error_exit("Instanton construction requires Nd=4", Nd);
48  if (Nc == 1)
49  QDP_error_exit("Instanton construction requires Nc>1", Nc);
50 
51  Real rho2 = rho * rho;
52 
53 
54  for(int cb = 0; cb < 2; cb++)
55  {
56  r2 = zero;
57  coord_sum = zero;
58 
59  /* Compute coordintes relative to the center */
60  for(mu = 1; mu < Nd; mu++)
61  {
62  my_coord = Layout::latticeCoordinate(mu);
63  coord_sum += my_coord;
64  rel_coord[mu] = my_coord;
65  ftmp = center[mu];
66  tmp1 = ftmp;
67  rel_coord[mu] -= tmp1;
68  ftmp = QDP::Layout::lattSize()[mu];
69  ftmp2 = 0.5 * ftmp;
70  tmp2 = ftmp;
71 
72 // lbtmp = rel_coord[mu] > ftmp2;
73 // copymask(rel_coord[mu], lbtmp, tmp2, SUBTRACT);
74 // tmp1 = -rel_coord[mu];
75 // lbtmp = tmp1 > ftmp2;
76 // copymask(rel_coord[mu], lbtmp, tmp2, ADD);
77 
78  // New version
79  lbtmp = rel_coord[mu] > ftmp2;
80  rel_tmp = where(lbtmp, tmp2, LatticeReal(zero));
81  rel_coord[mu] -= rel_tmp;
82  tmp1 = -rel_coord[mu];
83  lbtmp = tmp1 > ftmp2;
84  rel_tmp = where(lbtmp, tmp2, LatticeReal(zero));
85  rel_coord[mu] += rel_tmp;
86 
87  r2 += rel_coord[mu] * rel_coord[mu];
88  }
89 
90  /* For the zeroth direction, we have to determine the real coordinate */
91  litmp = cb;
92  coord_sum += litmp;
93  itmp = 2;
94  my_coord = coord_sum % itmp;
95  mu = 0;
96  litmp = Layout::latticeCoordinate(mu);
97  my_coord += litmp * itmp;
98  rel_coord[mu] = my_coord;
99  ftmp = center[mu];
100  tmp1 = ftmp;
101  rel_coord[mu] -= tmp1;
102  ftmp = QDP::Layout::lattSize()[mu];
103  ftmp2 = 0.5 * ftmp;
104  tmp2 = ftmp;
105  lbtmp = rel_coord[mu] > ftmp2;
106  rel_tmp = where(lbtmp, tmp2, LatticeReal(zero));
107  rel_coord[mu] -= rel_tmp;
108  tmp1 = -rel_coord[mu];
109  lbtmp = tmp1 > ftmp2;
110  rel_tmp = where(lbtmp, tmp2, LatticeReal(zero));
111  rel_coord[mu] += rel_tmp;
112 
113  r2 += rel_coord[mu] * rel_coord[mu];
114 
115  for(mu = 0; mu < Nd; mu++)
116  {
117  tmp1 = r2;
118  tmp2 = tmp1;
119  tmp2 += rel_coord[mu];
120  tmp1 -= rel_coord[mu] * rel_coord[mu];
121  tmp1 = sqrt(tmp1);
122  tmp2 = tmp1 / tmp2;
123  tmp2 = atan(tmp2);
124  phimu = tmp2 / tmp1;
125 
126  tmp1 = rho2;
127  tmp1 += r2;
128  tmp2 = tmp1;
129  tmp2 += rel_coord[mu];
130  tmp1 -= rel_coord[mu] * rel_coord[mu];
131  tmp1 = sqrt(tmp1);
132  tmp2 = tmp1 / tmp2;
133  tmp2 = atan(tmp2);
134  tmp2 = tmp2 / tmp1;
135  phimu -= tmp2;
136 
137  if (sign == PLUS)
138  {
139  phimus = phimu;
140  }
141  else
142  {
143  phimus = -phimu;
144  }
145 
146  switch (mu)
147  {
148  case 0:
149  a_1 = -(rel_coord[3] * phimus);
150  a_2 = rel_coord[2] * phimu;
151  a_3 = -(rel_coord[1] * phimu);
152  break;
153 
154  case 1:
155  a_1 = -(rel_coord[2] * phimu);
156  a_2 = -(rel_coord[3] * phimus);
157  a_3 = rel_coord[0] * phimu;
158  break;
159 
160  case 2:
161  a_1 = rel_coord[1] * phimu;
162  a_2 = -(rel_coord[0] * phimu);
163  a_3 = -(rel_coord[3] * phimus);
164  break;
165 
166  case 3:
167  a_1 = rel_coord[0] * phimus;
168  a_2 = rel_coord[1] * phimus;
169  a_3 = rel_coord[2] * phimus;
170  break;
171 
172  default:
173  QDP_error_exit("mu out of range", mu);
174  break;
175  }
176 
177  tmp1 = a_1 * a_1;
178  tmp1 += a_2 * a_2;
179  tmp1 += a_3 * a_3;
180  tmp1 = sqrt(tmp1);
181  tmp2 = 1;
182  ftmp = 1.0e-5;
183  lbtmp = tmp1 > ftmp;
184  copymask(tmp2, lbtmp, tmp1);
185  a_0 = cos(tmp2);
186  tmp1 = sin(tmp2);
187  tmp1 = tmp1 / tmp2;
188  a_1 = a_1 * tmp1;
189  a_2 = a_2 * tmp1;
190  a_3 = a_3 * tmp1;
191 
192  /* Where tmp1 < FUZZ above, fill a_i with (1,0,0,0) */
193  tmp1 = 1;
194  tmp2 = zero;
195  lbtmp = !lbtmp;
196  copymask(a_0, lbtmp, tmp1);
197  copymask(a_1, lbtmp, tmp2);
198  copymask(a_2, lbtmp, tmp2);
199  copymask(a_3, lbtmp, tmp2);
200 
201 /* SUN_FILL(a_0, a_1, a_2, a_3, su2_index, u_inst(cb,mu)); */
202  multi1d<LatticeReal> a(4);
203  a[0] = a_0;
204  a[1] = a_1;
205  a[2] = a_2;
206  a[3] = a_3;
207 
208  sunFill(u_inst[mu], a, su2_index, QDP::rb[cb]);
209  }
210  }
211 
212  /* Close out any other code */
213  END_CODE();
214  }
215 }
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 instanton(multi1d< LatticeColorMatrix > &u_inst, const multi1d< Real > &center, Real rho, int su2_index, int sign)
Instanton construction.
Definition: instanton.cc:18
Nd
Definition: meslate.cc:74
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
@ PLUS
Definition: chromabase.h:45
Complex a
Definition: invbicg.cc:95
START_CODE()
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106
copymask(lcoord, lbit, ltmp_1, REPLACE)
int itmp
Definition: qtopcor.cc:34
Fill an SU(Nc) matrix with an SU(2) submatrix.
Double ftmp2
Definition: topol.cc:30