Bridge++  Version 1.5.4
 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 const std::string Force_F_Clover_SF::class_name = "Force_F_Clover_SF";
17 
18 //====================================================================
20 {
21  const string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  double kappa, cSW;
27  std::vector<int> bc;
28  std::vector<double> phi, phipr;
29 
30  int err = 0;
31  err += params.fetch_double("hopping_parameter", kappa);
32  err += params.fetch_double("clover_coefficient", cSW);
33  err += params.fetch_int_vector("boundary_condition", bc);
34  err += params.fetch_double_vector("phi", phi);
35  err += params.fetch_double_vector("phipr", phipr);
36 
37  if (err) {
38  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
39  exit(EXIT_FAILURE);
40  }
41 
42 
43  set_parameters(kappa, cSW, bc, &phi[0], &phipr[0]);
44 }
45 
46 
47 //====================================================================
48 void Force_F_Clover_SF::set_parameters(const double kappa, const double cSW, const std::vector<int> bc,
49  double *phi, double *phipr)
50 {
51  const int Ndim = CommonParameters::Ndim();
52 
53  //- print input parameters
54  vout.general(m_vl, "%s:\n", class_name.c_str());
55  vout.general(m_vl, " kappa = %12.8f\n", kappa);
56  vout.general(m_vl, " cSW = %12.8f\n", cSW);
57  for (int mu = 0; mu < Ndim; ++mu) {
58  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
59  }
60 
61  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
62  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
63  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
64  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
65  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
66  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
67 
68  //- range check
69  // NB. kappa,cSW == 0 is allowed.
70  assert(bc.size() == Ndim);
71  // NB. phi,phipr == 0 is allowed.
72 
73  //- store values
74  m_kappa = kappa;
75  m_cSW = cSW;
76 
77  m_boundary.resize(Ndim);
78  m_boundary = bc;
79 
80  for (int i = 0; i < 3; ++i) {
81  m_phi[i] = phi[i];
82  m_phipr[i] = phipr[i];
83  }
84 
85  //- propagate parameters
88 
90 }
91 
92 
93 //====================================================================
94 void Force_F_Clover_SF::force_udiv(Field& force_, const Field& eta_)
95 {
96  const int Nvol = CommonParameters::Nvol();
97  const int Ndim = CommonParameters::Ndim();
98 
99  Field_F zeta;
100  Field_F eta(eta_);
101 
102  m_fopr_c->set_mode("H");
103  m_fopr_c->mult(zeta, eta);
104 
105  Field_G force(Nvol, Ndim);
106  force_udiv1_impl(force, eta, zeta);
107 
108  Field_G force1(Nvol, Ndim);
109  force_udiv1_impl(force1, zeta, eta);
110 
111  axpy(force, 1.0, force1); // force += force1;
112 
114 
115  copy(force_, force); // force_ = force;
116 }
117 
118 
119 //====================================================================
120 void Force_F_Clover_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
121 {
122  const int Nvol = CommonParameters::Nvol();
123  const int Ndim = CommonParameters::Ndim();
124 
125  Field_G force(Nvol, Ndim);
126  Field_F zeta(zeta_);
127  Field_F eta(eta_);
128 
129  force_udiv1_impl(force, zeta, eta);
130 
131  copy(force_, force); // force_ = force;
132 }
133 
134 
135 //====================================================================
136 void Force_F_Clover_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
137 {
138  const int Nc = CommonParameters::Nc();
139  const int Nd = CommonParameters::Nd();
140  const int Nvol = CommonParameters::Nvol();
141  const int Ndim = CommonParameters::Ndim();
142 
143  force.set(0.0);
144 
145  Field_F zeta1(zeta);
147 
148  m_force_w->force_udiv1(force, zeta, eta);
149 
150  Field_F eta2;
151  m_fopr_c->mult_gm5(eta2, eta);
153 
154  for (int mu = 0; mu < Ndim; ++mu) {
155  for (int nu = 0; nu < Ndim; ++nu) {
156  if (nu == mu) continue;
157 
158  Field_F eta3;
159  m_fopr_c->mult_isigma(eta3, eta2, mu, nu);
160 
161  Field_G Umu;
162  Umu.setpart_ex(0, *m_U, mu);
163 
164  Field_G Unu;
165  Unu.setpart_ex(0, *m_U, nu);
166  if (mu != 3) set_wk.set_boundary_wk(Umu);
167  if (nu != 3) set_wk.set_boundary_wk(Unu);
168 
169  const int ex = 0;
170 
171  // R(1) and R(5)
172  Field_F vt1;
173  mult_Field_Gd(vt1, 0, *m_Cud, index_dir(mu, nu), eta3, ex);
174 
175  Field_G force1;
176  tensorProd_Field_F(force1, zeta1, vt1);
177 
178  Field_G force2;
179  copy(force2, force1); // force2 = force1;
180 
181  // R(2)
182  Field_F vt3;
183  mult_Field_Gd(vt3, 0, Umu, 0, eta3, ex);
184 
186  shift.backward(vt1, vt3, nu);
187 
188  Field_F vt2;
189  shift.backward(vt2, zeta1, nu);
190 
191  Field_G Utmp;
192  shift.backward(Utmp, Unu, mu);
193  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
194 
195  mult_Field_Gn(vt3, 0, Utmp, 0, vt1, ex);
196 
197  Field_F vt4;
198  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
199  tensorProd_Field_F(force1, vt4, vt3);
200  axpy(force2, 1.0, force1); // force2 += force1;
201 
202  // R(4) and R(8)
203  shift.backward(vt1, eta3, mu);
204 
205  Field_F zeta_mu;
206  shift.backward(zeta_mu, zeta1, mu);
207  mult_Field_Gn(vt4, 0, *m_Cud, index_dir(mu, nu), zeta_mu, ex);
208  tensorProd_Field_F(force1, vt4, vt1);
209  axpy(force2, 1.0, force1); // force2 += force1;
210 
211  // R(3)
212  shift.backward(vt1, eta3, nu);
213  mult_Field_Gn(vt3, 0, Unu, 0, vt1, ex);
214  mult_Field_Gn(vt4, 0, Umu, 0, zeta_mu, ex);
215  shift.backward(vt1, vt3, mu);
216  shift.backward(vt2, vt4, nu);
217  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
218  tensorProd_Field_F(force1, vt4, vt1);
219  axpy(force2, 1.0, force1); // force2 += force1;
220 
221  // R(6)
222  shift.backward(Utmp, Unu, mu);
223  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
224 
225  Field_G Utmp2;
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, zeta1, ex);
229  shift.forward(vt3, vt1, nu);
230  shift.forward(vt4, vt2, nu);
231  tensorProd_Field_F(force1, vt4, vt3);
232  axpy(force2, -1.0, force1); // 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  axpy(force2, -1.0, force1); // force2 -= force1;
243 
244  scal(force2, -m_kappa * m_cSW / 8.0); // force2 *= -m_kappa * m_cSW / 8.0;
245  force.addpart_ex(mu, force2, 0);
246  }
247  }
248 }
249 
250 
251 //====================================================================
253 {
254  for (int mu = 0; mu < m_Ndim; ++mu) {
255  for (int nu = 0; nu < m_Ndim; ++nu) {
256  if (nu == mu) continue;
257 
258  Staple_SF staple;
259  staple.set_parameters(m_phi, m_phipr);
260 
261  Field_G_SF Cmu_ud1;
262  staple.upper(Cmu_ud1, *m_U, mu, nu);
263 
264  Field_G_SF Cmu_ud2;
265  staple.lower(Cmu_ud2, *m_U, mu, nu);
266 
267  axpy(Cmu_ud1, -1.0, Cmu_ud2);
268  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
269  }
270  }
271 }
272 
273 
274 //====================================================================
275 //============================================================END=====
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_G_SF.h:33
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:79
double m_phi[3]
SF boundary condition at t=0.
BridgeIO vout
Definition: bridgeIO.cpp:503
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:53
std::vector< int > m_boundary
boundary conditions
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
double m_cSW
clover coefficient
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 general(const char *format,...)
Definition: bridgeIO.cpp:197
Bridge::VerboseLevel m_vl
Definition: force_F.h:69
int shift(void)
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Staple construction.
Definition: staple_SF.h:36
Field_G * m_U
Definition: force_F.h:68
int index_dir(const int mu, const int nu)
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
Class for parameters.
Definition: parameters.h:46
Fopr_Clover_SF * m_fopr_c
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
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:204
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:35
double m_phipr[3]
SF boundary condition at t=Nt.
Wilson-type fermion field.
Definition: field_F.h:37
void upper(Field_G_SF &, const Field_G &, const int, const int)
Definition: staple_SF.cpp:886
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:102
SU(N) gauge field.
Definition: field_G.h:38
void set_parameters(const std::vector< double > &phi, const std::vector< double > &phipr)
Set the parameter by giving vector objects.
Definition: field_G_SF.cpp:245
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 set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:27
void backward(Field &, const Field &, const int mu)
void mult_gm5(Field &v, const Field &w)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
static const std::string class_name
void mult_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:35
double m_kappa
hopping parameter
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void set_parameters(const Parameters &params)
Field_G * m_Cud
for force calculation
void set_boundary_zero(Field &f)
Definition: field_F_SF.h:53
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
void set_parameters(const Parameters &params)
Force_F_Wilson_SF * m_force_w
Methods to shift a field in the lexical site index.
void lower(Field_G_SF &, const Field_G &, const int, const int)
Definition: staple_SF.cpp:921
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void set_parameters(const Parameters &params)
void set_component()
Set building components for force calculation.
void forward(Field &, const Field &, const int mu)