Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_CloverTerm.cpp
Go to the documentation of this file.
1 
14 #include "force_F_CloverTerm.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_double("hopping_parameter", 0.0);
27  param.Register_double("clover_coefficient", 0.0);
28  param.Register_int_vector("boundary_condition", std::valarray<int>());
29 
30  param.Register_string("verbose_level", "NULL");
31  }
32 
33 
34 #ifdef USE_PARAMETERS_FACTORY
35  bool init_param = ParametersFactory::Register("Force.F_CloverTerm", append_entry);
36 #endif
37 }
38 //- end
39 
40 //- parameters class
42 //- end
43 
44 const std::string Force_F_CloverTerm::class_name = "Force_F_CloverTerm";
45 
46 //====================================================================
48 {
49  const string str_vlevel = params.get_string("verbose_level");
50 
51  m_vl = vout.set_verbose_level(str_vlevel);
52 
53  //- fetch and check input parameters
54  double kappa, cSW;
55  valarray<int> bc;
56 
57  int err = 0;
58  err += params.fetch_double("hopping_parameter", kappa);
59  err += params.fetch_double("clover_coefficient", cSW);
60  err += params.fetch_int_vector("boundary_condition", bc);
61 
62  if (err) {
63  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
64  abort();
65  }
66 
67 
68  set_parameters(kappa, cSW, bc);
69 }
70 
71 
72 //====================================================================
73 void Force_F_CloverTerm::set_parameters(double kappa, double cSW, const valarray<int> bc)
74 {
75  int Ndim = CommonParameters::Ndim();
76 
77  //- print input parameters
78  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
79  vout.general(m_vl, " kappa = %8.4f\n", kappa);
80  vout.general(m_vl, " cSW = %8.4f\n", cSW);
81  for (int mu = 0; mu < Ndim; ++mu) {
82  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
83  }
84 
85  //- range check
86  // NB. kappa,cSW == 0 is allowed.
87  assert(bc.size() == Ndim);
88 
89  //- store values
90  m_kappa = kappa;
91  m_cSW = cSW;
92 
93  m_boundary.resize(Ndim);
94  for (int mu = 0; mu < Ndim; ++mu) {
95  m_boundary[mu] = bc[mu];
96  }
97 }
98 
99 
100 //====================================================================
101 void Force_F_CloverTerm::init(std::string repr)
102 {
103  m_repr = repr;
104 
106 
108 
110  int Nvol = CommonParameters::Nvol();
111  m_Cud = new Field_G(Nvol, m_Ndim * m_Ndim);
112 }
113 
114 
115 //====================================================================
117 {
118  delete m_Cud;
119  delete m_fopr_csw;
120 }
121 
122 
123 // override default force_core()
124 //====================================================================
126 {
127  vout.crucial(m_vl, "force_core() is not available in Force_F_CloverTerm.\n");
128  abort();
129 }
130 
131 
132 //====================================================================
134 {
135  vout.crucial(m_vl, "force_udiv() is not available in Force_F_CloverTerm.\n");
136  abort();
137 }
138 
139 
140 //====================================================================
141 void Force_F_CloverTerm::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
142 {
143  int Nvol = CommonParameters::Nvol();
144  int Ndim = CommonParameters::Ndim();
145 
146  Field_G force(Nvol, Ndim);
147  Field_F zeta(zeta_);
148  Field_F eta(eta_);
149 
150  force_udiv1_impl(force, zeta, eta);
151 
152  force_ = force;
153 }
154 
155 
156 //====================================================================
157 void Force_F_CloverTerm::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
158 {
159  int Nc = CommonParameters::Nc();
160  int Nd = CommonParameters::Nd();
161  int Nvol = CommonParameters::Nvol();
162  int Ndim = CommonParameters::Ndim();
163  // int NinG = 2 * Nc * Nc;
164 
166 
167 // Field force(NinG, Nvol, Ndim);
168  force = 0.0;
169 
170  Field_G force1(Nvol, 1), force2(Nvol, 1);
171  Field_G Umu(Nvol, 1), Unu(Nvol, 1), Utmp(Nvol, 1), Utmp2(Nvol, 1);
172  Field_F vt1(Nvol, 1), vt2(Nvol, 1), vt3(Nvol, 1), vt4(Nvol, 1);
173  Field_F zeta_mu(Nvol, 1);
174 
175  Mat_SU_N ut(Nc);
176  Vec_SU_N vec1(Nc), vec2(Nc);
177 
178  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
179 
180  m_fopr_csw->mult_gm5(eta2, eta);
181 
182  for (int mu = 0; mu < Ndim; ++mu) {
183  for (int nu = 0; nu < Ndim; ++nu) {
184  if (nu == mu) continue;
185 
186  m_fopr_csw->mult_isigma(eta3, eta2, mu, nu);
187 
188  Umu.setpart_ex(0, *m_U, mu);
189  Unu.setpart_ex(0, *m_U, nu);
190 
191  int ex = 0;
192  // R(1) and R(5)
193  mult_Field_Gd(vt1, 0, *m_Cud, index_dir(mu, nu), eta3, ex);
194  tensorProd_Field_F(force1, zeta, vt1);
195  force2 = force1;
196 
197  // R(2)
198  mult_Field_Gd(vt3, 0, Umu, 0, eta3, ex);
199  shift.backward(vt1, vt3, nu);
200  shift.backward(vt2, zeta, nu);
201  shift.backward(Utmp, Unu, mu);
202  mult_Field_Gn(vt3, 0, Utmp, 0, vt1, ex);
203  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
204  tensorProd_Field_F(force1, vt4, vt3);
205  force2 += force1;
206 
207  // R(4) and R(8)
208  shift.backward(vt1, eta3, mu);
209  shift.backward(zeta_mu, zeta, mu);
210  mult_Field_Gn(vt4, 0, *m_Cud, index_dir(mu, nu), zeta_mu, ex);
211  tensorProd_Field_F(force1, vt4, vt1);
212  force2 += force1;
213 
214  // R(3)
215  shift.backward(vt1, eta3, nu);
216  mult_Field_Gn(vt3, 0, Unu, 0, vt1, ex);
217  mult_Field_Gn(vt4, 0, Umu, 0, zeta_mu, ex);
218  shift.backward(vt1, vt3, mu);
219  shift.backward(vt2, vt4, nu);
220  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
221  tensorProd_Field_F(force1, vt4, vt1);
222  force2 += force1;
223 
224  // R(6)
225  shift.backward(Utmp, Unu, mu);
226  mult_Field_Gdd(Utmp2, 0, Utmp, 0, Umu, 0);
227  mult_Field_Gn(vt1, 0, Utmp2, 0, eta3, ex);
228  mult_Field_Gd(vt2, 0, Unu, 0, zeta, ex);
229  shift.forward(vt3, vt1, nu);
230  shift.forward(vt4, vt2, nu);
231  tensorProd_Field_F(force1, vt4, vt3);
232  force2 -= force1;
233 
234  // R(7)
235  mult_Field_Gd(vt1, 0, Unu, 0, eta3, ex);
236  mult_Field_Gn(vt2, 0, Umu, 0, zeta_mu, ex);
237  shift.backward(vt3, vt1, mu);
238  shift.forward(vt1, vt3, nu);
239  mult_Field_Gd(vt4, 0, Unu, 0, vt2, ex);
240  shift.forward(vt2, vt4, nu);
241  tensorProd_Field_F(force1, vt2, vt1);
242  force2 -= force1;
243 
244  force2 *= -m_kappa * m_cSW / 8.0;
245  force.addpart_ex(mu, force2, 0);
246  }
247  }
248 }
249 
250 
251 //====================================================================
253 {
254  int Nc = CommonParameters::Nc();
255  int Nd = CommonParameters::Nd();
256  int Nvol = CommonParameters::Nvol();
257 
258  Staples staple;
259  Field_G Cmu_ud(Nvol, 1);
260 
261  for (int mu = 0; mu < m_Ndim; ++mu) {
262  for (int nu = 0; nu < m_Ndim; ++nu) {
263  if (nu == mu) continue;
264 
265  Cmu_ud = staple.upper(*m_U, mu, nu);
266  Cmu_ud -= staple.lower(*m_U, mu, nu);
267  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud, 0);
268  }
269  }
270 }
271 
272 
273 //====================================================================
274 //============================================================END=====
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
BridgeIO vout
Definition: bridgeIO.cpp:207
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
Staple construction.
Definition: staples.h:40
const Field mult_gm5(const Field &f)
Field_G upper(const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane (wrapping void version).
Definition: staples.cpp:118
void general(const char *format,...)
Definition: bridgeIO.cpp:38
Bridge::VerboseLevel m_vl
Definition: force.h:76
std::valarray< int > m_boundary
boundary conditions
int shift(void)
Container of Field-type object.
Definition: field.h:37
Field_G * m_U
Definition: force.h:74
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Class for parameters.
Definition: parameters.h:40
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:162
void mult_Field_Gdd(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
Wilson-type fermion field.
Definition: field_F.h:37
int index_dir(int mu, int nu)
double m_kappa
hopping parameter
SU(N) gauge field.
Definition: field_G.h:36
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void force_core(Field &force, const Field &eta)
Force determination for clover fermion.
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
void backward(Field &, const Field &, const int mu)
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
void mult_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
void set_component()
Set building components for force calculation.
int m_Ndim
spacetime dimension
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
std::string m_repr
gamma matrix representation
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:22
static bool Register(const std::string &realm, const creator_callback &cb)
Fopr_CloverTerm * m_fopr_csw
fermion operator
Field_G lower(const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane (wrapping void version).
Definition: staples.cpp:128
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
void Register_double(const string &, const double)
Definition: parameters.cpp:324
Methods to shift a field in the lexical site index.
void Register_int_vector(const string &, const std::valarray< int > &)
Definition: parameters.cpp:345
double m_cSW
clover coefficient
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:150
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
Field_G * m_Cud
for force calculation
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void forward(Field &, const Field &, const int mu)
void init(std::string)
static const std::string class_name