Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_eo.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_eo.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using std::valarray;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_string("gamma_matrix_type", "NULL");
27 
28  param.Register_double("hopping_parameter", 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.Wilson_eo", append_entry);
37 #endif
38 }
39 //- end
40 
41 //===================================================================
42 namespace {
46  void mult_Field_Gn_eo(Field_F& w, int ex,
47  const Field_G& U, const int ex1,
48  const Field_F& x, const int ex2,
49  const int ieo)
50  {
51  assert(ex < w.nex());
52  assert(ex1 < U.nex());
53  assert(ex2 < x.nex());
54  assert(U.nvol() == w.nvol() * 2);
55  assert(x.nvol() == w.nvol());
56 
57  Vec_SU_N vec(w.nc());
58 
59  for (int site = 0, nvol = w.nvol(); site < nvol; ++site) {
60  for (int s = 0, nd = w.nd(); s < nd; ++s) {
61  vec = U.mat(site + ieo * nvol, ex1) * x.vec(s, site, ex2);
62  w.set_vec(s, site, ex, vec);
63  }
64  }
65  }
66 
67 
68  //====================================================================
72  void mult_Field_Gd_eo(Field_F& w, int ex,
73  const Field_G& U, int ex1,
74  const Field_F& x, int ex2,
75  const int ieo)
76  {
77  assert(ex < w.nex());
78  assert(ex1 < U.nex());
79  assert(ex2 < x.nex());
80  assert(U.nvol() == w.nvol() * 2);
81  assert(x.nvol() == w.nvol());
82 
83  Vec_SU_N vec(w.nc());
84 
85  for (int site = 0, nvol = w.nvol(); site < nvol; ++site) {
86  for (int s = 0, nd = w.nd(); s < nd; ++s) {
87  vec = U.mat_dag(site + ieo * nvol, ex1) * x.vec(s, site, ex2);
88  w.set_vec(s, site, ex, vec);
89  }
90  }
91  }
92 }
93 
94 //====================================================================
96 {
97  const string str_vlevel = params.get_string("verbose_level");
98 
99  m_vl = vout.set_verbose_level(str_vlevel);
100 
101  //- fetch and check input parameters
102  double kappa;
103  valarray<int> bc;
104 
105  int err = 0;
106  err += params.fetch_double("hopping_parameter", kappa);
107  err += params.fetch_int_vector("boundary_condition", bc);
108 
109  if (err) {
110  vout.crucial(m_vl, "Fopr_Wilson_eo: fetch error, input parameter not found.\n");
111  abort();
112  }
113 
114 
115  set_parameters(kappa, bc);
116 }
117 
118 
119 //====================================================================
120 void Fopr_Wilson_eo::set_parameters(const double kappa, const std::valarray<int> bc)
121 {
122  //- print input parameters
123  vout.general(m_vl, "Parameters of Fopr_Wilson_eo:\n");
124  vout.general(m_vl, " kappa = %8.4f\n", kappa);
125  for (int mu = 0; mu < m_Ndim; ++mu) {
126  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
127  }
128 
129  //- range check
130  // NB. kappa = 0 is allowed.
131  assert(bc.size() == m_Ndim);
132 
133  //- store values
134  m_kappa = kappa;
135 
136  // m_boundary.resize(m_Ndim); // already resized in init.
137  for (int mu = 0; mu < m_Ndim; ++mu) {
138  m_boundary[mu] = bc[mu];
139  }
140 }
141 
142 
143 //====================================================================
145 {
146  int Ndim = CommonParameters::Ndim();
147  int Nvol = CommonParameters::Nvol();
148 
149  m_index.convertField(*m_Ueo, *U);
150 }
151 
152 
153 //====================================================================
154 void Fopr_Wilson_eo::init(const std::string repr)
155 {
156  m_repr = repr;
157 
158  m_boundary.resize(m_Ndim);
159  m_GM.resize(m_Ndim + 1);
160 
161  GammaMatrixSet *gmset = GammaMatrixSet::New(repr);
162 
163  m_GM[0] = gmset->get_GM(gmset->GAMMA1);
164  m_GM[1] = gmset->get_GM(gmset->GAMMA2);
165  m_GM[2] = gmset->get_GM(gmset->GAMMA3);
166  m_GM[3] = gmset->get_GM(gmset->GAMMA4);
167  m_GM[4] = gmset->get_GM(gmset->GAMMA5);
168 
169  m_Ueo = new Field_G(m_Nvol, m_Ndim);
170 
173  m_preProp = 0;
174  m_postProp = 0;
175 
176  delete gmset;
177 }
178 
179 
180 //====================================================================
181 void Fopr_Wilson_eo::prePropD(Field& Be, Field& bo, const Field& b)
182 {
183  int Nin = b.nin();
184  int Nex = b.nex();
185 
186  Field be(Nin, m_Nvol2, Nex);
187 
188  m_index.convertField(be, b, 0);
189  m_index.convertField(bo, b, 1);
190 
191  Be.reset(Nin, m_Nvol2, Nex);
192  Be = be - (Field)Meo(bo, 0);
193 }
194 
195 
196 void Fopr_Wilson_eo::postPropD(Field& x, const Field& xe, const Field& bo)
197 {
198  //Field bo();
199  //index.convertField(bo, b, 1);
200  int Nin = xe.nin();
201  int Nex = xe.nex();
202 
203  Field xo(Nin, m_Nvol2, Nex);
204 
205  xo = bo - (Field)Meo(xe, 1);
206 
207  x.reset(Nin, m_Nvol2 * 2, Nex);
208  m_index.reverseField(x, xe, 0);
209  m_index.reverseField(x, xo, 1);
210 }
211 
212 
213 //====================================================================
214 void Fopr_Wilson_eo::prePropDag(Field& Be, Field& bo, const Field& b)
215 {
216  int Nin = b.nin();
217  int Nex = b.nex();
218 
219  Field be(Nin, m_Nvol2, Nex);
220 
221  m_index.convertField(be, b, 0);
222  m_index.convertField(bo, b, 1);
223 
224  Be.reset(Nin, m_Nvol2, Nex);
225  Be = be - (Field)Mdageo(bo, 0);
226 }
227 
228 
229 void Fopr_Wilson_eo::postPropDag(Field& x, const Field& xe, const Field& bo)
230 {
231  //Field bo();
232  //index.convertField(bo, b, 1);
233  int Nin = xe.nin();
234  int Nex = xe.nex();
235 
236  Field xo(Nin, m_Nvol2, Nex);
237 
238  xo = bo - (Field)Mdageo(xe, 1);
239 
240  x.reset(Nin, m_Nvol2 * 2, Nex);
241  m_index.reverseField(x, xe, 0);
242  m_index.reverseField(x, xo, 1);
243 }
244 
245 
246 //====================================================================
247 const Field_F Fopr_Wilson_eo::Meo(const Field_F& f, const int ieo)
248 {
249  Field_F w(m_Nvol2, f.nex());
250 
251  w = 0.0;
252 
253  for (int mu = 0; mu < m_Ndim; ++mu) {
254  mult_p(mu, w, (Field_F)f, ieo);
255  mult_m(mu, w, (Field_F)f, ieo);
256  }
257 
258  w *= -m_kappa;
259 
260  return w;
261 }
262 
263 
264 //====================================================================
265 const Field_F Fopr_Wilson_eo::Mdageo(const Field_F& f, const int ieo)
266 {
267  Field_F w(m_Nvol2, f.nex());
268  Field_F v(m_Nvol2, f.nex());
269 
270  v = (Field_F)mult_gm5((Field)f);
271 
272  w = Meo_gm5(v, ieo);
273 
274  return w;
275 }
276 
277 
278 //====================================================================
279 const Field_F Fopr_Wilson_eo::Meo_gm5(const Field_F& f, const int ieo)
280 {
281  Field_F w(m_Nvol2, f.nex());
282 
283  w = Meo((Field)f, ieo);
284 
285 
286  Field_F v(m_Nvol2, f.nex());
287  v = (Field_F)mult_gm5((Field)w);
288 
289  return v;
290 }
291 
292 
293 //====================================================================
295 {
296  Field_F w = (Field_F)f;
297 
298  w.mult_GM(m_GM[4], (Field_F)f);
299 
300  return (Field)w;
301 }
302 
303 
304 //====================================================================
305 const Field Fopr_Wilson_eo::gm5p(const int mu, const Field& f)
306 {
307  Field_F w(f.nvol(), f.nex());
308  Field_F vt1(f.nvol(), 1);
309  Field_F vt2(f.nvol(), 1);
310 
311  for (int ex = 0; ex < f.nex(); ++ex) {
312  vt1.setpart_ex(0, f, ex);
313  shift.backward(vt2, vt1, m_boundary[mu], mu); // vt2 = vt1(x+mu)
314  vt1.mult_GMproj2(-1, m_GM[mu], vt2); // vt1 = (1 - gamma_mu) vt2
315  vt2.mult_GM(m_GM[4], vt1); // vt2 = gamma_5 vt1
316  w.addpart_ex(ex, vt2, 0);
317  }
318 
319  return (Field)w;
320 }
321 
322 
323 //====================================================================
325  Field_F& w, const Field_F& f,
326  const int ieo)
327 {
328  Field_F vt(f.nvol(), 1);
329 
330  for (int ex = 0; ex < f.nex(); ++ex) {
331  vt.setpart_ex(0, f, ex);
332  shift.backward_h(trf, vt, m_boundary[mu], mu, ieo);
333  mult_Field_Gn_eo(trf2, 0, *m_Ueo, mu, trf, 0, ieo);
334  vt.mult_GMproj2(-1, m_GM[mu], trf2);
335  w.addpart_ex(ex, vt, 0);
336  }
337 }
338 
339 
340 //=====================================================================
342  Field_F& w, const Field_F& f,
343  const int ieo)
344 {
345  Field_F vt(f.nvol(), 1);
346 
347  for (int ex = 0; ex < f.nex(); ++ex) {
348  mult_Field_Gd_eo(trf, 0, *m_Ueo, mu, f, ex, 1 - ieo);
349  shift.forward_h(trf2, trf, m_boundary[mu], mu, ieo);
350  vt.mult_GMproj2(1, m_GM[mu], trf2);
351  w.addpart_ex(ex, vt, 0);
352  }
353 }
354 
355 
356 //====================================================================
357 //============================================================END=====