Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Clover_Nf2.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Clover_Nf2.h"
15 
16 const std::string Force_F_Clover_Nf2::class_name = "Force_F_Clover_Nf2";
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_Clover_Nf2::set_parameters(const double kappa, const double cSW,
46  const std::vector<int> bc)
47 {
48  const int Ndim = CommonParameters::Ndim();
49 
50  //- print input parameters
51  vout.general(m_vl, "%s:\n", class_name.c_str());
52  vout.general(m_vl, " kappa = %12.8f\n", kappa);
53  vout.general(m_vl, " cSW = %12.8f\n", cSW);
54  for (int mu = 0; mu < Ndim; ++mu) {
55  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
56  }
57 
58  //- range check
59  // NB. kappa,cSW == 0 is allowed.
60  assert(bc.size() == Ndim);
61 
62  //- store values
63  m_kappa = kappa;
64  m_cSW = cSW;
65 
66  m_boundary.resize(Ndim);
67  m_boundary = bc;
68 
69  //- propagate parameters
71 
74 }
75 
76 
77 //====================================================================
78 void Force_F_Clover_Nf2::init(std::string repr)
79 {
80  m_repr = repr;
81 
82  m_fopr_c = new Fopr_Clover(repr);
83  m_force_w = new Force_F_Wilson_Nf2(repr);
84  m_force_csw = new Force_F_CloverTerm(repr);
85 
87 
88  const int Nvol = CommonParameters::Nvol();
90 
91  m_Cud = new Field_G(Nvol, m_Ndim * m_Ndim);
92 }
93 
94 
95 //====================================================================
97 {
98  delete m_Cud;
99  delete m_force_csw;
100  delete m_force_w;
101  delete m_fopr_c;
102 }
103 
104 
105 //====================================================================
106 void Force_F_Clover_Nf2::force_udiv(Field& force_, const Field& eta_)
107 {
108  const int Nvol = CommonParameters::Nvol();
109  const int Ndim = CommonParameters::Ndim();
110 
111  Field_F zeta;
112  Field_F eta(eta_);
113 
114  m_fopr_c->H(zeta, eta);
115 
116  Field_G force1(Nvol, Ndim);
117  force_udiv1(force1, eta, zeta);
118  copy(force_, force1); // force_ = force1;
119 
120  force_udiv1(force1, zeta, eta);
121  axpy(force_, 1.0, force1); // force_ += force1;
122 }
123 
124 
125 //====================================================================
126 void Force_F_Clover_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
127 {
128  const int Nvol = CommonParameters::Nvol();
129  const int Ndim = CommonParameters::Ndim();
130 
131  Field_G force(Nvol, Ndim);
132  Field_F zeta(zeta_);
133  Field_F eta(eta_);
134 
135  force_udiv1_impl(force, zeta, eta);
136 
137  copy(force_, force); // force_ = force;
138 }
139 
140 
141 //====================================================================
142 void Force_F_Clover_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
143 {
144  const int Nvol = CommonParameters::Nvol();
145  const int Ndim = CommonParameters::Ndim();
146 
147  force.set(0.0);
148 
149  m_force_w->force_udiv1(force, zeta, eta);
150 
151  Field_G force2(Nvol, Ndim);
152  m_force_csw->force_udiv1(force2, zeta, eta);
153 
154  axpy(force, 1.0, force2); // force += force2;
155 }
156 
157 
158 //====================================================================
160 {
161  for (int mu = 0; mu < m_Ndim; ++mu) {
162  for (int nu = 0; nu < m_Ndim; ++nu) {
163  if (nu == mu) continue;
164 
165  Staple_lex staple;
166 
167  Field_G Cmu_ud1;
168  staple.upper(Cmu_ud1, *m_U, mu, nu);
169 
170  Field_G Cmu_ud2;
171  staple.lower(Cmu_ud2, *m_U, mu, nu);
172  //Cmu_ud -= staple.lower(*m_U, mu, nu);
173 
174  axpy(Cmu_ud1, -1.0, Cmu_ud2);
175  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
176  }
177  }
178 }
179 
180 
181 //====================================================================
182 //============================================================END=====
int index_dir(const int mu, const int nu)
double m_kappa
hopping parameter
BridgeIO vout
Definition: bridgeIO.cpp:503
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
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.
double m_cSW
clover coefficient
Class for parameters.
Definition: parameters.h:46
int m_Ndim
spacetime dimension
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 H(Field &, const Field &)
Wilson-type fermion field.
Definition: field_F.h:37
Clover fermion operator.
Definition: fopr_Clover.h:42
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
std::vector< int > m_boundary
boundary conditions
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
Staple construction.
Definition: staple_lex.h:39
SU(N) gauge field.
Definition: field_G.h:38
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
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
Force_F_CloverTerm * m_force_csw
Clover term force.
void init(const std::string)
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void set_parameters(const Parameters &params)
Force for the standard Wilson fermion operator.
Field_G * m_Cud
for force calculation
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
void set_component()
Set building components for force calculation.
Force_F_Wilson_Nf2 * m_force_w
Wilson fermion force.
std::string m_repr
gamma matrix representation
static const std::string class_name
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
Fopr_Clover * m_fopr_c
fermion operator
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)
Definition: fopr_Clover.cpp:56
Force calculation for clover term of clover fermion.