Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Wilson_eo.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_eo.h"
15 
16 const std::string Force_F_Wilson_eo::class_name = "Force_F_Wilson_eo";
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;
27  std::vector<int> bc;
28 
29  int err = 0;
30  err += params.fetch_double("hopping_parameter", kappa);
31  err += params.fetch_int_vector("boundary_condition", bc);
32 
33  if (err) {
34  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
35  exit(EXIT_FAILURE);
36  }
37 
38 
39  set_parameters(kappa, bc);
40 }
41 
42 
43 //====================================================================
44 void Force_F_Wilson_eo::set_parameters(const double kappa, const std::vector<int> bc)
45 {
46  const int Ndim = CommonParameters::Ndim();
47 
48  //- print input parameters
49  vout.general(m_vl, "%s:\n", class_name.c_str());
50  vout.general(m_vl, " kappa = %12.8f\n", kappa);
51  for (int mu = 0; mu < Ndim; ++mu) {
52  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
53  }
54 
55  //- range check
56  // NB. kappa == 0 is allowed.
57  assert(bc.size() == Ndim);
58 
59  //- store values
60  m_kappa = kappa;
61 
62  m_boundary.resize(Ndim);
63  m_boundary = bc;
64 
65  //- post-process
67 }
68 
69 
70 //====================================================================
71 void Force_F_Wilson_eo::force_udiv(Field& force_, const Field& eta_e)
72 {
73  const int Nvol = CommonParameters::Nvol();
74  const int Ndim = CommonParameters::Ndim();
75  const int Nvol2 = Nvol / 2;
76 
77  Field_F eta_o(Nvol2, 1);
78 
79  m_fopr_w->Meo(eta_o, eta_e, 1);
80 
81  Field_F eta;
82  m_index.mergeField(eta, eta_e, eta_o);
83 
84  m_fopr_w->set_mode("H");
85 
86  Field_F zeta_e(Nvol2, 1);
87  m_fopr_w->mult(zeta_e, eta_e);
88 
89  Field_F zeta_o(Nvol2, 1);
90  m_fopr_w->Meo(zeta_o, zeta_e, 1);
91 
92  Field_F zeta;
93  m_index.mergeField(zeta, zeta_e, zeta_o);
94 
95  Field_G force1(Nvol, Ndim);
96  force_udiv1_impl(force1, zeta, eta);
97  copy(force_, force1); // force_ = force1;
98 
99  force_udiv1_impl(force1, eta, zeta);
100  axpy(force_, 1.0, force1); // force_ += force1;
101 }
102 
103 
104 //====================================================================
105 void Force_F_Wilson_eo::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
106 {
107  const int Nvol = CommonParameters::Nvol();
108  const int Ndim = CommonParameters::Ndim();
109 
110  Field_G force(Nvol, Ndim);
111  Field_F zeta(zeta_);
112  Field_F eta(eta_);
113 
114  force_udiv1_impl(force, zeta, eta);
115 
116  copy(force_, force); // force_ = force;
117 }
118 
119 
120 //====================================================================
121 void Force_F_Wilson_eo::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
122 {
123  const int Ndim = CommonParameters::Ndim();
124 
125  force.set(0.0);
126 
127  for (int mu = 0; mu < Ndim; ++mu) {
128  Field_F eta2;
129  m_fopr_w->gm5p(mu, eta2, eta);
130  tensorProd_Field_F(force, mu, zeta, eta2);
131  }
132 
133  scal(force, -m_kappa); // force *= -m_kappa;
134 }
135 
136 
137 //====================================================================
138 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
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
void set_parameters(const Parameters &params)
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Class for parameters.
Definition: parameters.h:46
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
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:171
SU(N) gauge field.
Definition: field_G.h:38
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:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
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 set_parameters(const Parameters &params)
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
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void Meo(Field &, const Field &, const int ieo)