Bridge++  Version 1.5.4
 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 const std::string Force_F_CloverTerm::class_name = "Force_F_CloverTerm";
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 
29  int err = 0;
30  err += params.fetch_double("hopping_parameter", kappa);
31  err += params.fetch_double("clover_coefficient", cSW);
32  err += params.fetch_int_vector("boundary_condition", bc);
33 
34  if (err) {
35  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
36  exit(EXIT_FAILURE);
37  }
38 
39 
40  set_parameters(kappa, cSW, bc);
41 }
42 
43 
44 //====================================================================
45 void Force_F_CloverTerm::set_parameters(const double kappa, const double cSW, const std::vector<int> bc)
46 {
47  const int Ndim = CommonParameters::Ndim();
48 
49  //- print input parameters
50  vout.general(m_vl, "%s:\n", class_name.c_str());
51  vout.general(m_vl, " kappa = %12.8f\n", kappa);
52  vout.general(m_vl, " cSW = %12.8f\n", cSW);
53  for (int mu = 0; mu < Ndim; ++mu) {
54  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
55  }
56 
57  //- range check
58  // NB. kappa,cSW == 0 is allowed.
59  assert(bc.size() == Ndim);
60 
61  //- store values
62  m_kappa = kappa;
63  m_cSW = cSW;
64 
65  m_boundary.resize(Ndim);
66  m_boundary = bc;
67 }
68 
69 
70 //====================================================================
71 void Force_F_CloverTerm::init(const std::string repr)
72 {
73  m_repr = repr;
74 
76  const int Nvol = CommonParameters::Nvol();
77 
79  m_Cud = new Field_G(Nvol, m_Ndim * m_Ndim);
80 
82 }
83 
84 
85 //====================================================================
87 {
88  delete m_Cud;
89  delete m_fopr_csw;
90 }
91 
92 
93 // override default force_core()
94 //====================================================================
95 void Force_F_CloverTerm::force_core(Field& force, const Field& eta)
96 {
97  vout.crucial(m_vl, "Error at %s: force_core() is not available.\n", class_name.c_str());
98  exit(EXIT_FAILURE);
99 }
100 
101 
102 //====================================================================
104 {
105  vout.crucial(m_vl, "Error at %s: force_udiv() is not available.\n", class_name.c_str());
106  exit(EXIT_FAILURE);
107 }
108 
109 
110 //====================================================================
112  const Field& zeta_, const Field& eta_)
113 {
114  const int Nvol = CommonParameters::Nvol();
115  const int Ndim = CommonParameters::Ndim();
116 
117  Field_G force(Nvol, Ndim);
118  Field_F zeta(zeta_);
119  Field_F eta(eta_);
120 
121  force_udiv1_impl(force, zeta, eta);
122 
123  copy(force_, force); // force_ = force;
124 }
125 
126 
127 //====================================================================
129  const Field_F& zeta, const Field_F& eta)
130 {
131  const int Nc = CommonParameters::Nc();
132  const int Nd = CommonParameters::Nd();
133  const int Nvol = CommonParameters::Nvol();
134  const int Ndim = CommonParameters::Ndim();
135 
136  force.set(0.0);
137 
138  Field_F eta2;
139  m_fopr_csw->mult_gm5(eta2, eta);
140 
141  for (int mu = 0; mu < Ndim; ++mu) {
142  for (int nu = 0; nu < Ndim; ++nu) {
143  if (nu == mu) continue;
144 
145  Field_F eta3;
146  m_fopr_csw->mult_isigma(eta3, eta2, mu, nu);
147 
148  Field_G Umu;
149  Umu.setpart_ex(0, *m_U, mu);
150 
151  Field_G Unu;
152  Unu.setpart_ex(0, *m_U, nu);
153 
154  int ex = 0;
155 
156  // R(1) and R(5)
157  Field_F vt1;
158  mult_Field_Gd(vt1, 0, *m_Cud, index_dir(mu, nu), eta3, ex);
159 
160  Field_G force1;
161  tensorProd_Field_F(force1, zeta, vt1);
162 
163  Field_G force2;
164  copy(force2, force1); // force2 = force1;
165 
166  // R(2)
167  Field_F vt3;
168  mult_Field_Gd(vt3, 0, Umu, 0, eta3, ex);
169 
171  shift.backward(vt1, vt3, nu);
172 
173  Field_F vt2;
174  shift.backward(vt2, zeta, nu);
175 
176  Field_G Utmp;
177  shift.backward(Utmp, Unu, mu);
178 
179  mult_Field_Gn(vt3, 0, Utmp, 0, vt1, ex);
180 
181  Field_F vt4;
182  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
183  tensorProd_Field_F(force1, vt4, vt3);
184  axpy(force2, 1.0, force1); // force2 += force1;
185 
186  // R(4) and R(8)
187  shift.backward(vt1, eta3, mu);
188 
189  Field_F zeta_mu;
190  shift.backward(zeta_mu, zeta, mu);
191  mult_Field_Gn(vt4, 0, *m_Cud, index_dir(mu, nu), zeta_mu, ex);
192  tensorProd_Field_F(force1, vt4, vt1);
193  axpy(force2, 1.0, force1); // force2 += force1;
194 
195  // R(3)
196  shift.backward(vt1, eta3, nu);
197  mult_Field_Gn(vt3, 0, Unu, 0, vt1, ex);
198  mult_Field_Gn(vt4, 0, Umu, 0, zeta_mu, ex);
199  shift.backward(vt1, vt3, mu);
200  shift.backward(vt2, vt4, nu);
201  mult_Field_Gn(vt4, 0, Unu, 0, vt2, ex);
202  tensorProd_Field_F(force1, vt4, vt1);
203  axpy(force2, 1.0, force1); // force2 += force1;
204 
205  // R(6)
206  shift.backward(Utmp, Unu, mu);
207 
208  Field_G Utmp2;
209  mult_Field_Gdd(Utmp2, 0, Utmp, 0, Umu, 0);
210  mult_Field_Gn(vt1, 0, Utmp2, 0, eta3, ex);
211  mult_Field_Gd(vt2, 0, Unu, 0, zeta, ex);
212  shift.forward(vt3, vt1, nu);
213  shift.forward(vt4, vt2, nu);
214  tensorProd_Field_F(force1, vt4, vt3);
215  axpy(force2, -1.0, force1); // force2 -= force1;
216 
217  // R(7)
218  mult_Field_Gd(vt1, 0, Unu, 0, eta3, ex);
219  mult_Field_Gn(vt2, 0, Umu, 0, zeta_mu, ex);
220  shift.backward(vt3, vt1, mu);
221  shift.forward(vt1, vt3, nu);
222  mult_Field_Gd(vt4, 0, Unu, 0, vt2, ex);
223  shift.forward(vt2, vt4, nu);
224  tensorProd_Field_F(force1, vt2, vt1);
225  axpy(force2, -1.0, force1); // force2 -= force1;
226 
227  scal(force2, -m_kappa * m_cSW / 8.0); // force2 *= -m_kappa * m_cSW / 8.0;
228  force.addpart_ex(mu, force2, 0);
229  }
230  }
231 }
232 
233 
234 //====================================================================
236 {
237  const int Nc = CommonParameters::Nc();
238  const int Nd = CommonParameters::Nd();
239  const int Nvol = CommonParameters::Nvol();
240 
241  for (int mu = 0; mu < m_Ndim; ++mu) {
242  for (int nu = 0; nu < m_Ndim; ++nu) {
243  if (nu == mu) continue;
244 
245  Staple_lex staple;
246 
247  Field_G Cmu_ud1;
248  staple.upper(Cmu_ud1, *m_U, mu, nu);
249 
250  Field_G Cmu_ud2;
251  staple.lower(Cmu_ud2, *m_U, mu, nu);
252 
253  axpy(Cmu_ud1, -1.0, Cmu_ud2);
254  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
255  }
256  }
257 }
258 
259 
260 //====================================================================
261 //============================================================END=====
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
BridgeIO vout
Definition: bridgeIO.cpp:503
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Bridge::VerboseLevel m_vl
Definition: force_F.h:69
int shift(void)
Org::Fopr_CloverTerm Fopr_CloverTerm
Clover term operator.
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Field_G * m_U
Definition: force_F.h:68
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
void mult_gm5(Field &v, const Field &w)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
Class for parameters.
Definition: parameters.h:46
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:177
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
Wilson-type fermion field.
Definition: field_F.h:37
int index_dir(const int mu, const int nu)
double m_kappa
hopping parameter
Staple construction.
Definition: staple_lex.h:39
SU(N) gauge field.
Definition: field_G.h:38
std::vector< int > m_boundary
boundary conditions
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 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 upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:151
void init(const std::string)
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)
Definition: field_F_imp.cpp:35
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void set_component()
Set building components for force calculation.
int m_Ndim
spacetime dimension
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
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:32
Fopr_CloverTerm * m_fopr_csw
fermion operator
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
Methods to shift a field in the lexical site index.
double m_cSW
clover coefficient
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
Field_G * m_Cud
for force calculation
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void forward(Field &, const Field &, const int mu)
static const std::string class_name