Bridge++  Ver. 1.3.x
force_F_Wilson_eo.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_eo.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using Bridge::vout;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_double("hopping_parameter", 0.0);
27  param.Register_int_vector("boundary_condition", std::vector<int>());
28 
29  param.Register_string("verbose_level", "NULL");
30  }
31 
32 
33 #ifdef USE_PARAMETERS_FACTORY
34  bool init_param = ParametersFactory::Register("Force.F_Wilson_eo", append_entry);
35 #endif
36 }
37 //- end
38 
39 //- parameters class
41 //- end
42 
43 const std::string Force_F_Wilson_eo::class_name = "Force_F_Wilson_eo";
44 
45 //====================================================================
47 {
48  const string str_vlevel = params.get_string("verbose_level");
49 
50  m_vl = vout.set_verbose_level(str_vlevel);
51 
52  //- fetch and check input parameters
53  double kappa;
54  std::vector<int> bc;
55 
56  int err = 0;
57  err += params.fetch_double("hopping_parameter", kappa);
58  err += params.fetch_int_vector("boundary_condition", bc);
59 
60  if (err) {
61  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
62  exit(EXIT_FAILURE);
63  }
64 
65 
66  set_parameters(kappa, bc);
67 }
68 
69 
70 //====================================================================
71 void Force_F_Wilson_eo::set_parameters(double kappa, const std::vector<int> bc)
72 {
73  int Ndim = CommonParameters::Ndim();
74 
75  //- print input parameters
76  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
77  vout.general(m_vl, " kappa = %8.4f\n", kappa);
78  for (int mu = 0; mu < Ndim; ++mu) {
79  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
80  }
81 
82  //- range check
83  // NB. kappa == 0 is allowed.
84  assert(bc.size() == Ndim);
85 
86  //- store values
87  m_kappa = kappa;
88 
89  m_boundary.resize(Ndim);
90  for (int mu = 0; mu < Ndim; ++mu) {
91  m_boundary[mu] = bc[mu];
92  }
93 
94  //- post-process
96 }
97 
98 
99 //====================================================================
100 void Force_F_Wilson_eo::force_udiv(Field& force_, const Field& eta_e)
101 {
102  int Nc = CommonParameters::Nc();
103  int Nd = CommonParameters::Nd();
104  int Nvol = CommonParameters::Nvol();
105  int Ndim = CommonParameters::Ndim();
106  int Nvol2 = Nvol / 2;
107 
108  Field_G force1(Nvol, Ndim);
109 
110  Field_F eta_o(Nvol2, 1);
111  Field_F eta(Nvol, 1);
112 
113  Field_F zeta_e(Nvol2, 1);
114  Field_F zeta_o(Nvol2, 1);
115  Field_F zeta(Nvol, 1);
116 
117  m_fopr_w->Meo(eta_o, eta_e, 1);
118  m_index.mergeField(eta, eta_e, eta_o);
119 
120  m_fopr_w->set_mode("H");
121  m_fopr_w->mult(zeta_e, eta_e);
122  m_fopr_w->Meo(zeta_o, zeta_e, 1);
123  m_index.mergeField(zeta, zeta_e, zeta_o);
124 
125  force_udiv1_impl(force1, zeta, eta);
126  copy(force_, force1); // force_ = force1;
127 
128  force_udiv1_impl(force1, eta, zeta);
129  axpy(force_, 1.0, force1); // force_ += force1;
130 }
131 
132 
133 //====================================================================
134 void Force_F_Wilson_eo::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
135 {
136  int Nvol = CommonParameters::Nvol();
137  int Ndim = CommonParameters::Ndim();
138 
139  Field_G force(Nvol, Ndim);
140  Field_F zeta(zeta_);
141  Field_F eta(eta_);
142 
143  force_udiv1_impl(force, zeta, eta);
144 
145  copy(force_, force); // force_ = force;
146 }
147 
148 
149 //====================================================================
150 void Force_F_Wilson_eo::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
151 {
152  int Nc = CommonParameters::Nc();
153  int Nd = CommonParameters::Nd();
154  int Nvol = CommonParameters::Nvol();
155  int Ndim = CommonParameters::Ndim();
156 
157  Field_F eta2(Nvol, 1);
158 
159  force.set(0.0);
160 
161  for (int mu = 0; mu < Ndim; ++mu) {
162  m_fopr_w->gm5p(mu, eta2, eta);
163  tensorProd_Field_F(force, mu, zeta, eta2);
164  }
165 
166  scal(force, -m_kappa); // force *= -m_kappa;
167 }
168 
169 
170 //====================================================================
171 //============================================================END=====
void Register_int_vector(const string &, const std::vector< int > &)
Definition: parameters.cpp:344
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
BridgeIO vout
Definition: bridgeIO.cpp:278
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument) and set the resultant field to the 1st ar...
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:155
void general(const char *format,...)
Definition: bridgeIO.cpp:65
Bridge::VerboseLevel m_vl
Definition: force.h:72
void set_parameters(const Parameters &params)
Container of Field-type object.
Definition: field.h:39
void set_parameters(const Parameters &params)
Class for parameters.
Definition: parameters.h:38
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
Fopr_Wilson_eo * m_fopr_w
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Wilson-type fermion field.
Definition: field_F.h:37
void mergeField(Field &eo, const Field &e, const Field &o)
Definition: index_eo.cpp:168
SU(N) gauge field.
Definition: field_G.h:38
void gm5p(const int mu, Field &w, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu)
void force_udiv(Field &force, const Field &eta)
static const std::string class_name
std::vector< int > m_boundary
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:48
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:22
static bool Register(const std::string &realm, const creator_callback &cb)
void Meo(Field &, const Field &, const int ieo)
even-odd operatior: ieo=0: even <– odd, ieo=1: odd <– even
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void Register_double(const string &, const double)
Definition: parameters.cpp:323
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:28
int fetch_int_vector(const string &key, std::vector< int > &val) const
Definition: parameters.cpp:176