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