Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Wilson_Nf2.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_Nf2.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using Bridge::vout;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_double("hopping_parameter", 0.0);
27  param.Register_int_vector("boundary_condition", std::valarray<int>());
28 
29  param.Register_string("verbose_level", "NULL");
30  }
31 
32 
33 #ifdef USE_PARAMETERS_FACTORY
34  bool init_param = ParametersFactory::Register("Force.F_Wilson_Nf2", append_entry);
35 #endif
36 }
37 //- end
38 
39 //- parameters class
41 //- end
42 
43 //====================================================================
45 {
46  const string str_vlevel = params.get_string("verbose_level");
47 
48  m_vl = vout.set_verbose_level(str_vlevel);
49 
50  //- fetch and check input parameters
51  double kappa;
52  valarray<int> bc;
53 
54  int err = 0;
55  err += params.fetch_double("hopping_parameter", kappa);
56  err += params.fetch_int_vector("boundary_condition", bc);
57 
58  if (err) {
59  vout.crucial(m_vl, "Force_F_Wilson: fetch error, input parameter not found.\n");
60  abort();
61  }
62 
63 
64  set_parameters(kappa, bc);
65 }
66 
67 
68 //====================================================================
69 void Force_F_Wilson_Nf2::set_parameters(const double kappa, const valarray<int> bc)
70 {
71  int Ndim = CommonParameters::Ndim();
72 
73  //- print input parameters
74  vout.general(m_vl, "Parameters of Wilson fermion operator:\n");
75  vout.general(m_vl, " kappa = %8.4f\n", kappa);
76  for (int mu = 0; mu < Ndim; ++mu) {
77  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
78  }
79 
80  //- range check
81  // NB. kappa == 0 is allowed.
82  assert(bc.size() == Ndim);
83 
84  //- store values
85  m_kappa = kappa;
86 
87  m_boundary.resize(Ndim);
88  for (int mu = 0; mu < Ndim; ++mu) {
89  m_boundary[mu] = bc[mu];
90  }
91 
92  //- post-process
94 }
95 
96 
97 //====================================================================
99 {
100  int Nc = CommonParameters::Nc();
101  int Nvol = CommonParameters::Nvol();
102  int Ndim = CommonParameters::Ndim();
103  int NinG = 2 * Nc * Nc;
104 
105  Field_G force(Nvol, Ndim);
106  Field_G force1(Nvol, Ndim);
107 
108  force1 = force_udiv(eta);
109 
110  for (int mu = 0; mu < Ndim; ++mu) {
111  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
112  force.at_Field_G(mu);
113  }
114  force *= -2.0;
115 
116  return (Field)force;
117 }
118 
119 
120 //====================================================================
122  const Field& eta)
123 {
124  int Nc = CommonParameters::Nc();
125  int Nvol = CommonParameters::Nvol();
126  int Ndim = CommonParameters::Ndim();
127  int NinG = 2 * Nc * Nc;
128 
129  Field_G force(Nvol, Ndim);
130  Field_G force1(Nvol, Ndim);
131 
132  force1 = force_udiv1(zeta, eta);
133 
134  for (int mu = 0; mu < Ndim; ++mu) {
135  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
136  force.at_Field_G(mu);
137  }
138  force *= -2.0;
139 
140  return (Field)force;
141 }
142 
143 
144 //====================================================================
146 {
147  int Nc = CommonParameters::Nc();
148  int Nd = CommonParameters::Nd();
149  int Nvol = CommonParameters::Nvol();
150  int Ndim = CommonParameters::Ndim();
151 
152  Field_G force(Nvol, Ndim);
153  Field_G force1(Nvol, Ndim);
154 
155  Field_F zeta(Nvol, 1);
156 
157  //zeta = m_fopr_w->H(eta);
158  m_fopr_w->set_mode("H");
159  zeta = (Field_F)m_fopr_w->mult(eta);
160 
161  force = (Field_G)force_udiv1(zeta, (Field_F)eta);
162  force1 = (Field_G)force_udiv1((Field_F)eta, zeta);
163  force += force1;
164 
165  return (Field)force;
166 }
167 
168 
169 //====================================================================
171  const Field& eta)
172 {
173  return force_udiv1((Field_F)zeta, (Field_F)eta);
174 }
175 
176 
177 //====================================================================
179  const Field_F& eta)
180 {
181  int Nc = CommonParameters::Nc();
182  int Nd = CommonParameters::Nd();
183  int Nvol = CommonParameters::Nvol();
184  int Ndim = CommonParameters::Ndim();
185 
186  Field_G force(Nvol, Ndim);
187  Field_G force1(Nvol, 1);
188  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
189 
190  for (int mu = 0; mu < Ndim; ++mu) {
191  eta2 = m_fopr_w->mult_gm5p(mu, eta);
192  eta3.mult_Field_Gd(0, *m_U, mu, eta2, 0);
193  tensorProd_Field_F(force1, zeta, eta3);
194  force.setpart_ex(mu, force1, 0);
195  }
196 
197  force *= -m_kappa;
198 
199  return (Field)force;
200 }
201 
202 
203 //====================================================================
204 //============================================================END=====