Bridge++  Version 1.4.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 
17 const std::string Force_F_Clover_Nf2::class_name = "Force_F_Clover_Nf2";
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 
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 //====================================================================
46 void Force_F_Clover_Nf2::set_parameters(const double kappa, const double cSW,
47  const std::vector<int> bc)
48 {
49  int Ndim = CommonParameters::Ndim();
50 
51  //- print input parameters
52  vout.general(m_vl, "%s:\n", class_name.c_str());
53  vout.general(m_vl, " kappa = %12.8f\n", kappa);
54  vout.general(m_vl, " cSW = %12.8f\n", cSW);
55  for (int mu = 0; mu < Ndim; ++mu) {
56  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
57  }
58 
59  //- range check
60  // NB. kappa,cSW == 0 is allowed.
61  assert(bc.size() == Ndim);
62 
63  //- store values
64  m_kappa = kappa;
65  m_cSW = cSW;
66 
67  m_boundary.resize(Ndim);
68  for (int mu = 0; mu < Ndim; ++mu) {
69  m_boundary[mu] = bc[mu];
70  }
71 
72  //- propagate parameters
74 
77 }
78 
79 
80 //====================================================================
81 void Force_F_Clover_Nf2::init(std::string repr)
82 {
83  m_repr = repr;
84 
85  m_fopr_c = new Fopr_Clover(repr);
86  m_force_w = new Force_F_Wilson_Nf2(repr);
87  m_force_csw = new Force_F_CloverTerm(repr);
88 
90 
91  int Nvol = CommonParameters::Nvol();
93 
94  m_Cud = new Field_G(Nvol, m_Ndim * m_Ndim);
95 }
96 
97 
98 //====================================================================
100 {
101  delete m_Cud;
102  delete m_force_csw;
103  delete m_force_w;
104  delete m_fopr_c;
105 }
106 
107 
108 //====================================================================
109 void Force_F_Clover_Nf2::force_udiv(Field& force_, const Field& eta_)
110 {
111  int Nc = CommonParameters::Nc();
112  int Nvol = CommonParameters::Nvol();
113  int Ndim = CommonParameters::Ndim();
114 
115  Field_G force1(Nvol, Ndim);
116 
117  Field_F zeta(Nvol, 1);
118  Field_F eta(eta_);
119 
120  m_fopr_c->H(zeta, eta);
121 
122  force_udiv1(force1, eta, zeta);
123  copy(force_, force1); // force_ = force1;
124 
125  force_udiv1(force1, zeta, eta);
126  axpy(force_, 1.0, force1); // force_ += force1;
127 }
128 
129 
130 //====================================================================
131 void Force_F_Clover_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
132 {
133  int Nc = CommonParameters::Nc();
134  int Nvol = CommonParameters::Nvol();
135  int Ndim = CommonParameters::Ndim();
136 
137  Field_G force(Nvol, Ndim);
138  Field_F zeta(zeta_);
139  Field_F eta(eta_);
140 
141  force_udiv1_impl(force, zeta, eta);
142 
143  copy(force_, force); // force_ = force;
144 }
145 
146 
147 //====================================================================
148 void Force_F_Clover_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
149 {
150  int Nc = CommonParameters::Nc();
151  int Nd = CommonParameters::Nd();
152  int Nvol = CommonParameters::Nvol();
153  int Ndim = CommonParameters::Ndim();
154 
156  Field_G force2(Nvol, Ndim);
157 
158  force.set(0.0);
159 
160  m_force_w->force_udiv1(force, zeta, eta);
161  m_force_csw->force_udiv1(force2, zeta, eta);
162 
163  axpy(force, 1.0, force2); // force += force2;
164 }
165 
166 
167 //====================================================================
169 {
170  int Nc = CommonParameters::Nc();
171  int Nd = CommonParameters::Nd();
172  int Nvol = CommonParameters::Nvol();
173 
174  Staple_lex staple;
175  Field_G Cmu_ud1(Nvol, 1);
176  Field_G Cmu_ud2(Nvol, 1);
177 
178  for (int mu = 0; mu < m_Ndim; ++mu) {
179  for (int nu = 0; nu < m_Ndim; ++nu) {
180  if (nu == mu) continue;
181 
182  staple.upper(Cmu_ud1, *m_U, mu, nu);
183  staple.lower(Cmu_ud2, *m_U, mu, nu);
184  //Cmu_ud -= staple.lower(*m_U, mu, nu);
185  axpy(Cmu_ud1, -1.0, Cmu_ud2);
186  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
187  }
188  }
189 }
190 
191 
192 //====================================================================
193 //============================================================END=====
double m_kappa
hopping parameter
BridgeIO vout
Definition: bridgeIO.cpp:495
void init(std::string)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
void general(const char *format,...)
Definition: bridgeIO.cpp:195
Bridge::VerboseLevel m_vl
Definition: force_F.h:72
int index_dir(int mu, int nu)
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
Field_G * m_U
Definition: force_F.h:70
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:381
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:180
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:156
Force_F_CloverTerm * m_force_csw
Clover term force.
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:168
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
Methods to shift a field in the lexical site index.
static const std::string class_name
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
Fopr_Clover * m_fopr_c
fermion operator
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)
Definition: fopr_Clover.cpp:74
Force calculation for clover term of clover fermion.