Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Clover_SF.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Clover_SF.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  param.Register_double_vector("phi", std::valarray<double>());
30  param.Register_double_vector("phipr", std::valarray<double>());
31 
32  param.Register_string("verbose_level", "NULL");
33  }
34 
35 
36 #ifdef USE_PARAMETERS_FACTORY
37  bool init_param = ParametersFactory::Register("Force.F_Clover_SF", append_entry);
38 #endif
39 }
40 //- end
41 
42 //- parameters class
44 //- end
45 
46 const std::string Force_F_Clover_SF::class_name = "Force_F_Clover_SF";
47 
48 //====================================================================
50 {
51  const string str_vlevel = params.get_string("verbose_level");
52 
53  m_vl = vout.set_verbose_level(str_vlevel);
54 
55  //- fetch and check input parameters
56  double kappa, cSW;
57  valarray<int> bc;
58  valarray<double> phi, phipr;
59 
60  int err = 0;
61  err += params.fetch_double("hopping_parameter", kappa);
62  err += params.fetch_double("clover_coefficient", cSW);
63  err += params.fetch_int_vector("boundary_condition", bc);
64  err += params.fetch_double_vector("phi", phi);
65  err += params.fetch_double_vector("phipr", phipr);
66 
67  if (err) {
68  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
69  abort();
70  }
71 
72 
73  set_parameters(kappa, cSW, bc, &phi[0], &phipr[0]);
74 }
75 
76 
77 //====================================================================
78 void Force_F_Clover_SF::set_parameters(double kappa, double cSW, const valarray<int> bc,
79  double *phi, double *phipr)
80 {
81  int Ndim = CommonParameters::Ndim();
82 
83  //- print input parameters
84  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
85  vout.general(m_vl, " kappa = %8.4f\n", kappa);
86  vout.general(m_vl, " cSW = %8.4f\n", cSW);
87  for (int mu = 0; mu < Ndim; ++mu) {
88  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
89  }
90 
91  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
92  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
93  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
94  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
95  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
96  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
97 
98  //- range check
99  // NB. kappa,cSW == 0 is allowed.
100  assert(bc.size() == Ndim);
101  // NB. phi,phipr == 0 is allowed.
102 
103  //- store values
104  m_kappa = kappa;
105  m_cSW = cSW;
106 
107  for (int i = 0; i < 3; ++i) {
108  m_phi[i] = phi[i];
109  m_phipr[i] = phipr[i];
110  }
111 
112  m_boundary.resize(Ndim);
113  for (int mu = 0; mu < Ndim; ++mu) {
114  m_boundary[mu] = bc[mu];
115  }
116 
117  //- propagate parameters
119 
121 
123 }
124 
125 
126 //====================================================================
127 void Force_F_Clover_SF::force_udiv(Field& force_, const Field& eta_)
128 {
129  int Nc = CommonParameters::Nc();
130  int Nvol = CommonParameters::Nvol();
131  int Ndim = CommonParameters::Ndim();
132 
133  Field_G force(Nvol, Ndim);
134  Field_G force1(Nvol, Ndim);
135  Field_F zeta(Nvol, 1);
136  Field_F eta(eta_);
137 
138  m_fopr_c->set_mode("H");
139  m_fopr_c->mult(zeta, eta);
140 
141  force_udiv1_impl(force, eta, zeta);
142  force_udiv1_impl(force1, zeta, eta);
143  force += force1;
144 
146 
147  force_ = force;
148 }
149 
150 
151 //====================================================================
152 void Force_F_Clover_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
153 {
154  int Nc = CommonParameters::Nc();
155  int Nvol = CommonParameters::Nvol();
156  int Ndim = CommonParameters::Ndim();
157 
158  Field_G force(Nvol, Ndim);
159  Field_F zeta(zeta_);
160  Field_F eta(eta_);
161 
162  force_udiv1_impl(force, zeta, eta);
163 
164  force_ = force;
165 }
166 
167 
168 //====================================================================
169 void Force_F_Clover_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
170 {
171  int Nc = CommonParameters::Nc();
172  int Nd = CommonParameters::Nd();
173  int Nvol = CommonParameters::Nvol();
174  int Ndim = CommonParameters::Ndim();
175  // int NinG = 2 * Nc * Nc;
176 
178 
179 // Field force(NinG, Nvol, Ndim);
180  force = 0.0;
181 
182  Field_G force1(Nvol, 1), force2(Nvol, 1);
183  Field_G Umu(Nvol, 1), Unu(Nvol, 1), Utmp(Nvol, 1), Utmp2(Nvol, 1);
184  Field_F vt1(Nvol, 1), vt2(Nvol, 1), vt3(Nvol, 1), vt4(Nvol, 1);
185  Field_F zeta_mu(Nvol, 1);
186 
187  Mat_SU_N ut(Nc);
188  Vec_SU_N vec1(Nc), vec2(Nc);
189 
190  Field_F zeta1(zeta);
191 
193 
194 // force = m_force_w->force_udiv1(zeta, eta);
195  m_force_w->force_udiv1(force, zeta, eta);
196 
197  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
198  m_fopr_c->mult_gm5(eta2, eta);
200 
201  for (int mu = 0; mu < Ndim; ++mu) {
202  for (int nu = 0; nu < Ndim; ++nu) {
203  if (nu == mu) continue;
204 
205  m_fopr_c->mult_isigma(eta3, eta2, mu, nu);
206 
207  Umu.setpart_ex(0, *m_U, mu);
208  Unu.setpart_ex(0, *m_U, nu);
209  if (mu != 3) set_wk.set_boundary_wk(Umu);
210  if (nu != 3) set_wk.set_boundary_wk(Unu);
211 
212  int ex = 0;
213  // R(1) and R(5)
214  mult_Field_Gd(vt1, 0, *m_Cud, index_dir(mu, nu), eta3, ex);
215  tensorProd_Field_F(force1, zeta1, vt1);
216  force2 = force1;
217 
218  // R(2)
219  mult_Field_Gd(vt3, 0, Umu, 0, eta3, ex);
220  shift.backward(vt1, vt3, nu);
221  shift.backward(vt2, zeta1, nu);
222  shift.backward(Utmp, Unu, mu);
223  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
224  mult_Field_Gn(vt3, 0, Utmp, 0, vt1, ex);
225  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
226  tensorProd_Field_F(force1, vt4, vt3);
227  force2 += force1;
228 
229  // R(4) and R(8)
230  shift.backward(vt1, eta3, mu);
231  shift.backward(zeta_mu, zeta1, mu);
232  mult_Field_Gn(vt4, 0, *m_Cud, index_dir(mu, nu), zeta_mu, ex);
233  tensorProd_Field_F(force1, vt4, vt1);
234  force2 += force1;
235 
236  // R(3)
237  shift.backward(vt1, eta3, nu);
238  mult_Field_Gn(vt3, 0, Unu, 0, vt1, ex);
239  mult_Field_Gn(vt4, 0, Umu, 0, zeta_mu, ex);
240  shift.backward(vt1, vt3, mu);
241  shift.backward(vt2, vt4, nu);
242  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
243  tensorProd_Field_F(force1, vt4, vt1);
244  force2 += force1;
245 
246  // R(6)
247  shift.backward(Utmp, Unu, mu);
248  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
249  mult_Field_Gdd(Utmp2, 0, Utmp, 0, Umu, 0);
250  mult_Field_Gn(vt1, 0, Utmp2, 0, eta3, ex);
251  mult_Field_Gd(vt2, 0, Unu, 0, zeta1, ex);
252  shift.forward(vt3, vt1, nu);
253  shift.forward(vt4, vt2, nu);
254  tensorProd_Field_F(force1, vt4, vt3);
255  force2 -= force1;
256 
257  // R(7)
258  mult_Field_Gd(vt1, 0, Unu, 0, eta3, ex);
259  mult_Field_Gn(vt2, 0, Umu, 0, zeta_mu, ex);
260  shift.backward(vt3, vt1, mu);
261  shift.forward(vt1, vt3, nu);
262  mult_Field_Gd(vt4, 0, Unu, 0, vt2, ex);
263  shift.forward(vt2, vt4, nu);
264  tensorProd_Field_F(force1, vt2, vt1);
265  force2 -= force1;
266 
267  force2 *= -m_kappa * m_cSW / 8.0;
268  force.addpart_ex(mu, force2, 0);
269  }
270  }
271 }
272 
273 
274 //====================================================================
276 {
277  int Nc = CommonParameters::Nc();
278  int Nd = CommonParameters::Nd();
279  int Nvol = CommonParameters::Nvol();
280 
281  Staples_SF staple;
282 
283  staple.set_parameters(m_phi, m_phipr);
284 
285  Field_G Cmu_ud(Nvol, 1);
286 
287  for (int mu = 0; mu < m_Ndim; ++mu) {
288  for (int nu = 0; nu < m_Ndim; ++nu) {
289  if (nu == mu) continue;
290 
291  Cmu_ud = staple.upper(*m_U, mu, nu);
292  Cmu_ud -= staple.lower(*m_U, mu, nu);
293  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud, 0);
294  }
295  }
296 }
297 
298 
299 //====================================================================
300 //============================================================END=====
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
double m_phi[3]
SF boundary condition at t=0.
BridgeIO vout
Definition: bridgeIO.cpp:207
void set_boundary_wkpr(const Mat_SU_N &U)
Set the boundary spatial link at t=Nt-1 for SF bc.
Definition: field_G_SF.cpp:76
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
double m_cSW
clover coefficient
void set_parameters(const Parameters &params)
Definition: staples_SF.cpp:63
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
Field_F_SF set_zero
In order to set the boundary field.
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void general(const char *format,...)
Definition: bridgeIO.cpp:38
Bridge::VerboseLevel m_vl
Definition: force.h:76
int shift(void)
Container of Field-type object.
Definition: field.h:37
Field_G * m_U
Definition: force.h:74
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
Class for parameters.
Definition: parameters.h:40
Fopr_Clover_SF * m_fopr_c
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
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)
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
double m_phipr[3]
SF boundary condition at t=Nt.
Wilson-type fermion field.
Definition: field_F.h:37
int fetch_double_vector(const string &key, std::valarray< double > &val) const
Definition: parameters.cpp:158
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:125
SU(N) gauge field.
Definition: field_G.h:36
std::valarray< int > m_boundary
boundary conditions
void set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:50
void backward(Field &, const Field &, const int mu)
static const std::string class_name
int index_dir(int mu, int nu)
void mult_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
double m_kappa
hopping parameter
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
void set_parameters(const Parameters_Field_G_SF &params)
Set the parameter with Parameters_Field_G_SF class.
Definition: field_G_SF.cpp:268
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:22
void set_parameters(const Parameters &params)
Field_G * m_Cud
for force calculation
static bool Register(const std::string &realm, const creator_callback &cb)
void set_boundary_zero(Field &f)
Definition: field_F_SF.h:56
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
void set_parameters(const Parameters &params)
Force_F_Wilson_SF * m_force_w
void Register_double_vector(const string &, const std::valarray< double > &)
Definition: parameters.cpp:338
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
const Field mult_gm5(const Field &w)
Field_G_SF lower(const Field_G &, const int, const int)
Definition: staples_SF.cpp:910
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:150
Field_G_SF upper(const Field_G &, const int, const int)
Definition: staples_SF.cpp:864
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void set_parameters(const Parameters &params)
void set_component()
Set building components for force calculation.
void forward(Field &, const Field &, const int mu)