Bridge++  Ver. 2.0.2
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  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;
28  std::vector<int> bc;
29 
30  int err = 0;
31  err += params.fetch_double("hopping_parameter", kappa);
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, bc);
41 }
42 
43 
44 //====================================================================
46 {
47  params.set_double("hopping_parameter", m_kappa);
48  params.set_int_vector("boundary_condition", m_boundary);
49 
50  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
51 }
52 
53 
54 //====================================================================
55 void Force_F_Wilson_eo::set_parameters(const double kappa, const std::vector<int> bc)
56 {
57  const int Ndim = CommonParameters::Ndim();
58 
59  //- print input parameters
60  vout.general(m_vl, "%s:\n", class_name.c_str());
61  vout.general(m_vl, " kappa = %12.8f\n", kappa);
62  for (int mu = 0; mu < Ndim; ++mu) {
63  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
64  }
65 
66  //- range check
67  // NB. kappa == 0 is allowed.
68  assert(bc.size() == Ndim);
69 
70  //- store values
71  m_kappa = kappa;
72 
73  m_boundary.resize(Ndim);
74  m_boundary = bc;
75 
76  //- post-process
78 }
79 
80 
81 //====================================================================
82 void Force_F_Wilson_eo::force_udiv(Field& force_, const Field& eta_e)
83 {
84  const int Nvol = CommonParameters::Nvol();
85  const int Ndim = CommonParameters::Ndim();
86  const int Nvol2 = Nvol / 2;
87 
88  Field_F eta_o(Nvol2, 1);
89 
90  m_fopr_w->Meo(eta_o, eta_e, 1);
91 
92  Field_F eta;
93  m_index.mergeField(eta, eta_e, eta_o);
94 
95  m_fopr_w->set_mode("H");
96 
97  Field_F zeta_e(Nvol2, 1);
98  m_fopr_w->mult(zeta_e, eta_e);
99 
100  Field_F zeta_o(Nvol2, 1);
101  m_fopr_w->Meo(zeta_o, zeta_e, 1);
102 
103  Field_F zeta;
104  m_index.mergeField(zeta, zeta_e, zeta_o);
105 
106  Field_G force1(Nvol, Ndim);
107  force_udiv1_impl(force1, zeta, eta);
108  copy(force_, force1); // force_ = force1;
109 
110  force_udiv1_impl(force1, eta, zeta);
111  axpy(force_, 1.0, force1); // force_ += force1;
112 }
113 
114 
115 //====================================================================
116 void Force_F_Wilson_eo::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
117 {
118  const int Nvol = CommonParameters::Nvol();
119  const int Ndim = CommonParameters::Ndim();
120 
121  Field_G force(Nvol, Ndim);
122  Field_F zeta(zeta_);
123  Field_F eta(eta_);
124 
125  force_udiv1_impl(force, zeta, eta);
126 
127  copy(force_, force); // force_ = force;
128 }
129 
130 
131 //====================================================================
132 void Force_F_Wilson_eo::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
133 {
134  const int Ndim = CommonParameters::Ndim();
135 
136  force.set(0.0);
137 
138  for (int mu = 0; mu < Ndim; ++mu) {
139  Field_F eta2;
140  m_fopr_w->gm5p(mu, eta2, eta);
141  tensorProd_Field_F(force, mu, zeta, eta2);
142  }
143 
144  scal(force, -m_kappa); // force *= -m_kappa;
145 }
146 
147 
148 //====================================================================
149 //============================================================END=====
Force_F_Wilson_eo::m_boundary
std::vector< int > m_boundary
Definition: force_F_Wilson_eo.h:49
Force_F_Wilson_eo::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_eo.cpp:116
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_Wilson_eo::m_fopr_w
Fopr_Wilson_eo * m_fopr_w
Definition: force_F_Wilson_eo.h:50
Force_F_Wilson_eo::m_kappa
double m_kappa
Definition: force_F_Wilson_eo.h:48
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Wilson_eo::m_index
Index_eo m_index
Definition: force_F_Wilson_eo.h:54
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Force_F_Wilson_eo::class_name
static const std::string class_name
Definition: force_F_Wilson_eo.h:41
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_F_Wilson_eo::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Wilson_eo.h:44
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Force_F_Wilson_eo::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Definition: force_F_Wilson_eo.cpp:132
Force_F_Wilson_eo::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Wilson_eo.cpp:82
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
force_F_Wilson_eo.h
Index_eo::mergeField
void mergeField(Field &eo, const Field &e, const Field &o)
Definition: index_eo.cpp:262
Org::Fopr_Wilson_eo::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Wilson_eo_impl.cpp:136
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_F_Wilson_eo::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_eo.cpp:19
Org::Fopr_Wilson_eo::gm5p
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu)
Definition: fopr_Wilson_eo_impl.cpp:480
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
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
Org::Fopr_Wilson_eo::Meo
void Meo(Field &, const Field &, const int ieo)
Definition: fopr_Wilson_eo_impl.cpp:434
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Org::Fopr_Wilson_eo::mult
void mult(Field &, const Field &)
multiplies fermion operator to a given field (2nd argument)
Definition: fopr_Wilson_eo_impl.cpp:225
Force_F_Wilson_eo::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Wilson_eo.cpp:45
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Org::Fopr_Wilson_eo::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr_Wilson_eo_impl.cpp:213
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
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