Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverTerm_eo.cpp
Go to the documentation of this file.
1 
14 #include "fopr_CloverTerm_eo.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using std::valarray;
21 
22 //====================================================================
23 //- parameter entry
24 namespace {
25  void append_entry(Parameters& param)
26  {
27  param.Register_double("hopping_parameter", 0.0);
28  param.Register_double("clover_coefficient", 0.0);
29  param.Register_int_vector("boundary_condition", std::valarray<int>());
30 
31  param.Register_string("verbose_level", "NULL");
32  }
33 
34 
35 #ifdef USE_PARAMETERS_FACTORY
36  bool init_param = ParametersFactory::Register("Fopr.CloverTerm_eo", append_entry);
37 #endif
38 }
39 //- end
40 
41 //- parameters class
43 //- end
44 
45 //====================================================================
47 {
48  const string str_vlevel = params.get_string("verbose_level");
49 
50  m_vl = vout.set_verbose_level(str_vlevel);
51 
52  //- fetch and check input parameters
53  double kappa, cSW;
54  valarray<int> bc;
55 
56  int err = 0;
57  err += params.fetch_double("hopping_parameter", kappa);
58  err += params.fetch_double("clover_coefficient", cSW);
59  err += params.fetch_int_vector("boundary_condition", bc);
60 
61  if (err) {
62  vout.crucial(m_vl, "Fopr_CloverTerm_eo: fetch error, input parameter not found.\n");
63  abort();
64  }
65 
66 
67  set_parameters(kappa, cSW, bc);
68 }
69 
70 
71 //====================================================================
72 void Fopr_CloverTerm_eo::set_parameters(const double kappa, const double cSW,
73  const std::valarray<int> bc)
74 {
75  //- print input parameters
76  vout.general(m_vl, "Parameters of Fopr_CloverTerm_eo:\n");
77  vout.general(m_vl, " kappa = %8.4f\n", m_kappa);
78  vout.general(m_vl, " cSW = %8.4f\n", m_cSW);
79  for (int mu = 0; mu < m_Ndim; ++mu) {
80  vout.general(m_vl, " boundary[%d] = %2d\n", mu, m_boundary[mu]);
81  }
82 
83  //- range check
84  // NB. kappa,cSW == 0 is allowed.
85  assert(bc.size() == m_Ndim);
86 
87  //- store values
88  m_kappa = kappa;
89  m_cSW = cSW;
90  assert(bc.size() == m_Ndim);
91  for (int mu = 0; mu < m_Ndim; ++mu) {
92  m_boundary[mu] = bc[mu];
93  }
94 }
95 
96 
97 //====================================================================
99 {
100  m_Ueo = (Field_G *)Ueo;
101  set_csw();
102 }
103 
104 
105 //====================================================================
106 void Fopr_CloverTerm_eo::init(std::string repr)
107 {
108  m_Ueo = 0;
109 
110  m_repr = repr;
111 
112  m_boundary.resize(m_Ndim);
113  m_GM.resize(m_Ndim + 1);
114  m_SG.resize(m_Ndim * m_Ndim);
115 
116  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
117 
118  m_GM[0] = gmset->get_GM(gmset->GAMMA1);
119  m_GM[1] = gmset->get_GM(gmset->GAMMA2);
120  m_GM[2] = gmset->get_GM(gmset->GAMMA3);
121  m_GM[3] = gmset->get_GM(gmset->GAMMA4);
122  m_GM[4] = gmset->get_GM(gmset->GAMMA5);
123 
124  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
125  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
126  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
127  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
128  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
129  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
130 
131  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
132  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
133  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
134  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
135  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
136  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
137 
138  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
139  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
140  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
141  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
142  // these 4 gamma matrices are actually not used.
143 
144  delete gmset;
145 }
146 
147 
148 //====================================================================
149 std::vector<double> Fopr_CloverTerm_eo::csmatrix(const int& site)
150 {
151  std::vector<double> matrix(m_Nc * m_Nc * m_Nd * m_Nd * 2);
152 
153  for (int ispin = 0; ispin < m_Nd / 2; ++ispin) {
154  for (int icolor = 0; icolor < m_Nc; ++icolor) {
155  int ics = icolor + ispin * m_Nc;
156  for (int jspin = 0; jspin < m_Nd; ++jspin) {
157  int js2 = (jspin + m_Nd / 2) % m_Nd;
158  for (int jcolor = 0; jcolor < m_Nc; ++jcolor) {
159  int cs1 = jcolor + m_Nc * (jspin + m_Nd * ics);
160  int cs2 = jcolor + m_Nc * (jspin + m_Nd * (ics + m_Nc * m_Nd / 2));
161  int cc = jcolor + icolor * m_Nc;
162  int ss1 = jspin + ispin * m_Nd;
163  int ss2 = js2 + ispin * m_Nd;
164 
165  matrix[2 * cs1] = m_T.cmp_r(cc, site, ss1);
166  matrix[2 * cs1 + 1] = m_T.cmp_i(cc, site, ss1);
167 
168  matrix[2 * cs2] = m_T.cmp_r(cc, site, ss2);
169  matrix[2 * cs2 + 1] = m_T.cmp_i(cc, site, ss2);
170  }
171  }
172  }
173  }
174 
175  return matrix;
176 }
177 
178 
179 //====================================================================
180 void Fopr_CloverTerm_eo::D(Field& v, const Field& f, const int ieo)
181 {
182  // Field_F& vf = (Field_F&) v;
183  // Field_F& ff = (Field_F&) f;
184 
185  Field_F vf(v.nvol(), v.nex());
186  Field_F ff(f.nvol(), f.nex());
187 
188  ff = (Field_F)f;
189 
190  int n_ex = f.nex();
191 
192  Vec_SU_N u_vec, d_vec;
193  for (int iex = 0; iex < n_ex; ++iex) {
194  for (int isite = 0; isite < m_Nvol2; ++isite) {
195  for (int ispin = 0; ispin < m_Nd / 2; ++ispin) {
196  u_vec.zero();
197  d_vec.zero();
198  for (int jspin = 0; jspin < m_Nd; ++jspin) {
199  int u_spin = jspin + ispin * m_Nd;
200  u_vec += m_T.mat(idx.site(isite, ieo), u_spin)
201  * ff.vec(jspin, isite, iex);
202  int d_spin = (jspin + m_Nd / 2) % m_Nd + ispin * m_Nd;
203  d_vec += m_T.mat(idx.site(isite, ieo), d_spin)
204  * ff.vec(jspin, isite, iex);
205  }
206  vf.set_vec(ispin, isite, iex, u_vec);
207  vf.set_vec(ispin + m_Nd / 2, isite, iex, d_vec);
208  }
209  }
210  }
211 
212  v = (Field)vf;
213 }
214 
215 
216 //====================================================================
218  const int mu, const int nu)
219 {
220  assert(mu != nu);
221  v.mult_iGM(m_SG[sg_index(mu, nu)], w);
222 }
223 
224 
225 //====================================================================
227 {
228  m_T = 0.0;
229 
230  //- sigma23
231  Field_G F;
232  set_fieldstrength(F, 1, 2);
233  F.xI();
234  m_T.addpart_ex(1, F, 0);
235  m_T.addpart_ex(4, F, 0);
236 
237  //- sigma31
238  set_fieldstrength(F, 2, 0);
239  m_T.addpart_ex(1, F, 0);
240  m_T.addpart_ex(4, -F, 0);
241 
242  //- sigma12
243  set_fieldstrength(F, 0, 1);
244  F.xI();
245  m_T.addpart_ex(0, F, 0);
246  m_T.addpart_ex(5, -F, 0);
247 
248  //- sigma41
249  set_fieldstrength(F, 3, 0);
250  F.xI();
251  F *= -1.0;
252  m_T.addpart_ex(3, F, 0);
253  m_T.addpart_ex(6, F, 0);
254 
255  //- sigma42
256  set_fieldstrength(F, 3, 1);
257  m_T.addpart_ex(6, F, 0);
258  m_T.addpart_ex(3, -F, 0);
259 
260  //- sigma43
261  set_fieldstrength(F, 3, 2);
262  F.xI();
263  m_T.addpart_ex(7, F, 0);
264  m_T.addpart_ex(2, -F, 0);
265 
266  m_T *= -m_kappa * m_cSW;
267 
268  //- add unit color matrix for diag part of dirac matrix;
269  for (int ispin = 0; ispin < m_Nd / 2; ++ispin) {
270  int spin_diag = ispin + m_Nd * ispin;
271  for (int isite = 0; isite < m_Nvol; ++isite) {
272  for (int icolor = 0; icolor < m_Nc; ++icolor) {
273  int cc2 = 2 * (icolor * m_Nc + icolor);
274  m_T.add(cc2, isite, spin_diag, 1.0);
275  }
276  }
277  }
278 }
279 
280 
281 //====================================================================
283  const int mu, const int nu)
284 {
285  Staples_eo staple;
286 
287  Field_G Cup(m_Nvol, 1), Cdn(m_Nvol, 1);
288  Field_G Umu(m_Nvol, 1);
289  Field_G w(m_Nvol, 1), v(m_Nvol, 1), v2(m_Nvol, 1);
290 
291  Cup = staple.upper(m_Ueo, mu, nu);
292  Cdn = staple.lower(m_Ueo, mu, nu);
293  Umu.setpart_ex(0, *m_Ueo, mu);
294 
295  for (int site = 0; site < m_Nvol; ++site) {
296  w.set_mat(site, 0, Umu.mat(site) * Cup.mat_dag(site));
297  }
298 
299  for (int site = 0; site < m_Nvol; ++site) {
300  v2.set_mat(site, 0, Umu.mat(site) * Cdn.mat_dag(site));
301  }
302 
303  w -= v2;
304 
305  for (int site = 0; site < m_Nvol; ++site) {
306  v.set_mat(site, 0, Cup.mat_dag(site) * Umu.mat(site));
307  }
308 
309  for (int site = 0; site < m_Nvol; ++site) {
310  v2.set_mat(site, 0, Cdn.mat_dag(site) * Umu.mat(site));
311  }
312 
313  v -= v2;
314 
315  m_shift_eo.forward(v2, v, mu);
316 
317  w += v2;
318 
319  for (int site = 0; site < m_Nvol; ++site) {
320  Fst.set_mat(site, 0, w.mat(site).ah());
321  }
322 
323  Fst *= 0.25;
324 }
325 
326 
327 //====================================================================
328 //============================================================END=====