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