Bridge++  Ver. 1.3.x
force_F_Wilson_Nf2.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_Nf2.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_Nf2", append_entry);
35 #endif
36 }
37 //- end
38 
39 //- parameters class
41 //- end
42 
43 const std::string Force_F_Wilson_Nf2::class_name = "Force_F_Wilson_Nf2";
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_Nf2::set_parameters(const 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_Nf2::force_udiv(Field& force_, const Field& eta_)
101 {
102  int Nc = CommonParameters::Nc();
103  int Nd = CommonParameters::Nd();
104  int Nvol = CommonParameters::Nvol();
105  int Ndim = CommonParameters::Ndim();
106 
107  Field_G force1(Nvol, Ndim);
108  Field_F zeta(Nvol, 1);
109  Field_F eta(eta_);
110 
111  m_fopr_w->set_mode("H");
112  m_fopr_w->mult(zeta, eta);
113 
114  force_udiv1_impl(force1, zeta, eta);
115  copy(force_, force1); // force_ = force1;
116 
117  force_udiv1_impl(force1, eta, zeta);
118  axpy(force_, 1.0, force1); // force_ += force1;
119 }
120 
121 
122 //====================================================================
123 void Force_F_Wilson_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
124 {
125  int Nvol = CommonParameters::Nvol();
126  int Ndim = CommonParameters::Ndim();
127 
128  Field_G force(Nvol, Ndim);
129  Field_F zeta(zeta_);
130  Field_F eta(eta_);
131 
132  force_udiv1_impl(force, zeta, eta);
133 
134  copy(force_, force); // force_ = force;
135 }
136 
137 
138 //====================================================================
139 void Force_F_Wilson_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
140 {
141  int Nc = CommonParameters::Nc();
142  int Nd = CommonParameters::Nd();
143  int Nvol = CommonParameters::Nvol();
144  int Ndim = CommonParameters::Ndim();
145 
146  Field_F eta2(Nvol, 1);
147  Field_F eta3(Nvol, 1);
148 
149  force.set(0.0);
150 
151  for (int mu = 0; mu < Ndim; ++mu) {
152  m_fopr_w->mult_gm5p(mu, eta2, eta);
153  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
154  tensorProd_Field_F(force, mu, zeta, eta3);
155  }
156 
157  scal(force, -m_kappa); // force *= -m_kappa;
158 }
159 
160 
161 //====================================================================
162 //============================================================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
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:83
BridgeIO vout
Definition: bridgeIO.cpp:278
std::vector< int > m_boundary
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
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
Container of Field-type object.
Definition: field.h:39
Field_G * m_U
Definition: force.h:70
Class for parameters.
Definition: parameters.h:38
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
void mult_gm5p(int mu, Field_F &v, const Field_F &w)
this function is used for derivatives in force calculation.
Fopr_Wilson * m_fopr_w
Wilson-type fermion field.
Definition: field_F.h:37
SU(N) gauge field.
Definition: field_G.h:38
void force_udiv(Field &force, const Field &eta)
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
void set_parameters(const Parameters &params)
Definition: fopr_Wilson.cpp:65
static const std::string class_name
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
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 crucial(const char *format,...)
Definition: bridgeIO.cpp:48
void set_parameters(const Parameters &params)
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:22
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
static bool Register(const std::string &realm, const creator_callback &cb)
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