Bridge++  Version 1.4.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 
17 const std::string Force_F_Clover_SF::class_name = "Force_F_Clover_SF";
18 
19 //====================================================================
21 {
22  const string str_vlevel = params.get_string("verbose_level");
23 
24  m_vl = vout.set_verbose_level(str_vlevel);
25 
26  //- fetch and check input parameters
27  double kappa, cSW;
28  std::vector<int> bc;
29  std::vector<double> phi, phipr;
30 
31  int err = 0;
32  err += params.fetch_double("hopping_parameter", kappa);
33  err += params.fetch_double("clover_coefficient", cSW);
34  err += params.fetch_int_vector("boundary_condition", bc);
35  err += params.fetch_double_vector("phi", phi);
36  err += params.fetch_double_vector("phipr", phipr);
37 
38  if (err) {
39  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43 
44  set_parameters(kappa, cSW, bc, &phi[0], &phipr[0]);
45 }
46 
47 
48 //====================================================================
49 void Force_F_Clover_SF::set_parameters(double kappa, double cSW, const std::vector<int> bc,
50  double *phi, double *phipr)
51 {
52  int Ndim = CommonParameters::Ndim();
53 
54  //- print input parameters
55  vout.general(m_vl, "%s:\n", class_name.c_str());
56  vout.general(m_vl, " kappa = %12.8f\n", kappa);
57  vout.general(m_vl, " cSW = %12.8f\n", cSW);
58  for (int mu = 0; mu < Ndim; ++mu) {
59  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
60  }
61 
62  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
63  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
64  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
65  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
66  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
67  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
68 
69  //- range check
70  // NB. kappa,cSW == 0 is allowed.
71  assert(bc.size() == Ndim);
72  // NB. phi,phipr == 0 is allowed.
73 
74  //- store values
75  m_kappa = kappa;
76  m_cSW = cSW;
77 
78  for (int i = 0; i < 3; ++i) {
79  m_phi[i] = phi[i];
80  m_phipr[i] = phipr[i];
81  }
82 
83  m_boundary.resize(Ndim);
84  for (int mu = 0; mu < Ndim; ++mu) {
85  m_boundary[mu] = bc[mu];
86  }
87 
88  //- propagate parameters
91 
93 }
94 
95 
96 //====================================================================
97 void Force_F_Clover_SF::force_udiv(Field& force_, const Field& eta_)
98 {
99  int Nc = CommonParameters::Nc();
100  int Nvol = CommonParameters::Nvol();
101  int Ndim = CommonParameters::Ndim();
102 
103  Field_G force(Nvol, Ndim);
104  Field_G force1(Nvol, Ndim);
105  Field_F zeta(Nvol, 1);
106  Field_F eta(eta_);
107 
108  m_fopr_c->set_mode("H");
109  m_fopr_c->mult(zeta, eta);
110 
111  force_udiv1_impl(force, eta, zeta);
112  force_udiv1_impl(force1, zeta, eta);
113  axpy(force, 1.0, force1); // force += force1;
114 
116 
117  copy(force_, force); // force_ = force;
118 }
119 
120 
121 //====================================================================
122 void Force_F_Clover_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
123 {
124  int Nc = CommonParameters::Nc();
125  int Nvol = CommonParameters::Nvol();
126  int Ndim = CommonParameters::Ndim();
127 
128  Field_G force(Nvol, Ndim);
129  Field_F zeta(zeta_);
130  Field_F eta(eta_);
131 
132  force_udiv1_impl(force, zeta, eta);
133 
134  copy(force_, force); // force_ = force;
135 }
136 
137 
138 //====================================================================
139 void Force_F_Clover_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
140 {
141  int Nc = CommonParameters::Nc();
142  int Nd = CommonParameters::Nd();
143  int Nvol = CommonParameters::Nvol();
144  int Ndim = CommonParameters::Ndim();
145 
147 
148  Field_G force1(Nvol, 1), force2(Nvol, 1);
149  Field_G Umu(Nvol, 1), Unu(Nvol, 1), Utmp(Nvol, 1), Utmp2(Nvol, 1);
150  Field_F vt1(Nvol, 1), vt2(Nvol, 1), vt3(Nvol, 1), vt4(Nvol, 1);
151  Field_F zeta_mu(Nvol, 1);
152 
153  Mat_SU_N ut(Nc);
154  Vec_SU_N vec1(Nc), vec2(Nc);
155 
156  Field_F zeta1(zeta);
157  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
158 
159  force.set(0.0);
160 
162 
163  m_force_w->force_udiv1(force, zeta, eta);
164 
165  m_fopr_c->mult_gm5(eta2, eta);
167 
168  for (int mu = 0; mu < Ndim; ++mu) {
169  for (int nu = 0; nu < Ndim; ++nu) {
170  if (nu == mu) continue;
171 
172  m_fopr_c->mult_isigma(eta3, eta2, mu, nu);
173 
174  Umu.setpart_ex(0, *m_U, mu);
175  Unu.setpart_ex(0, *m_U, nu);
176  if (mu != 3) set_wk.set_boundary_wk(Umu);
177  if (nu != 3) set_wk.set_boundary_wk(Unu);
178 
179  int ex = 0;
180 
181  // R(1) and R(5)
182  mult_Field_Gd(vt1, 0, *m_Cud, index_dir(mu, nu), eta3, ex);
183  tensorProd_Field_F(force1, zeta1, vt1);
184  copy(force2, force1); // force2 = force1;
185 
186  // R(2)
187  mult_Field_Gd(vt3, 0, Umu, 0, eta3, ex);
188  shift.backward(vt1, vt3, nu);
189  shift.backward(vt2, zeta1, nu);
190  shift.backward(Utmp, Unu, mu);
191  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
192  mult_Field_Gn(vt3, 0, Utmp, 0, vt1, ex);
193  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
194  tensorProd_Field_F(force1, vt4, vt3);
195  axpy(force2, 1.0, force1); // force2 += force1;
196 
197  // R(4) and R(8)
198  shift.backward(vt1, eta3, mu);
199  shift.backward(zeta_mu, zeta1, mu);
200  mult_Field_Gn(vt4, 0, *m_Cud, index_dir(mu, nu), zeta_mu, ex);
201  tensorProd_Field_F(force1, vt4, vt1);
202  axpy(force2, 1.0, force1); // force2 += force1;
203 
204  // R(3)
205  shift.backward(vt1, eta3, nu);
206  mult_Field_Gn(vt3, 0, Unu, 0, vt1, ex);
207  mult_Field_Gn(vt4, 0, Umu, 0, zeta_mu, ex);
208  shift.backward(vt1, vt3, mu);
209  shift.backward(vt2, vt4, nu);
210  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
211  tensorProd_Field_F(force1, vt4, vt1);
212  axpy(force2, 1.0, force1); // force2 += force1;
213 
214  // R(6)
215  shift.backward(Utmp, Unu, mu);
216  if (mu == 3) set_wk.set_boundary_wkpr(Utmp);
217  mult_Field_Gdd(Utmp2, 0, Utmp, 0, Umu, 0);
218  mult_Field_Gn(vt1, 0, Utmp2, 0, eta3, ex);
219  mult_Field_Gd(vt2, 0, Unu, 0, zeta1, ex);
220  shift.forward(vt3, vt1, nu);
221  shift.forward(vt4, vt2, nu);
222  tensorProd_Field_F(force1, vt4, vt3);
223  axpy(force2, -1.0, force1); // force2 -= force1;
224 
225  // R(7)
226  mult_Field_Gd(vt1, 0, Unu, 0, eta3, ex);
227  mult_Field_Gn(vt2, 0, Umu, 0, zeta_mu, ex);
228  shift.backward(vt3, vt1, mu);
229  shift.forward(vt1, vt3, nu);
230  mult_Field_Gd(vt4, 0, Unu, 0, vt2, ex);
231  shift.forward(vt2, vt4, nu);
232  tensorProd_Field_F(force1, vt2, vt1);
233  axpy(force2, -1.0, force1); // force2 -= force1;
234 
235  scal(force2, -m_kappa * m_cSW / 8.0); // force2 *= -m_kappa * m_cSW / 8.0;
236  force.addpart_ex(mu, force2, 0);
237  }
238  }
239 }
240 
241 
242 //====================================================================
244 {
245  int Nc = CommonParameters::Nc();
246  int Nd = CommonParameters::Nd();
247  int Nvol = CommonParameters::Nvol();
248 
249  Field_G_SF Cmu_ud1(Nvol, 1);
250  Field_G_SF Cmu_ud2(Nvol, 1);
251 
252  Staple_SF staple;
253 
254  staple.set_parameters(m_phi, m_phipr);
255 
256  for (int mu = 0; mu < m_Ndim; ++mu) {
257  for (int nu = 0; nu < m_Ndim; ++nu) {
258  if (nu == mu) continue;
259 
260  staple.upper(Cmu_ud1, *m_U, mu, nu);
261  staple.lower(Cmu_ud2, *m_U, mu, nu);
262  axpy(Cmu_ud1, -1.0, Cmu_ud2);
263  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
264  }
265  }
266 }
267 
268 
269 //====================================================================
270 //============================================================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:282
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:83
double m_phi[3]
SF boundary condition at t=0.
BridgeIO vout
Definition: bridgeIO.cpp:495
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:55
std::vector< int > m_boundary
boundary conditions
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:275
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
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 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:195
Bridge::VerboseLevel m_vl
Definition: force_F.h:72
int shift(void)
Container of Field-type object.
Definition: field.h:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
Staple construction.
Definition: staple_SF.h:38
Field_G * m_U
Definition: force_F.h:70
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:381
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:193
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:39
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:818
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:104
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:247
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:29
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
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)
Definition: field_F_imp.cpp:39
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:168
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_parameters(const Parameters &params)
Field_G * m_Cud
for force calculation
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
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:846
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
string get_string(const string &key) const
Definition: parameters.cpp:116
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
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)