Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 using std::valarray;
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::valarray<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_SF", append_entry);
35 #endif
36 }
37 //- end
38 
39 //- parameters class
41 //- end
42 
43 const std::string Force_F_Wilson_SF::class_name = "Force_F_Wilson_SF";
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  valarray<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  abort();
63  }
64 
65 
66  set_parameters(kappa, bc);
67 }
68 
69 
70 //====================================================================
71 void Force_F_Wilson_SF::set_parameters(double kappa, const valarray<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  //- propagate parameters
96 }
97 
98 
99 //====================================================================
100 void Force_F_Wilson_SF::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 force(Nvol, Ndim);
108  Field_G force1(Nvol, Ndim);
109 
110  Field_F zeta(Nvol, 1);
111  Field_F eta(eta_);
112 
113  m_fopr_w->set_mode("H");
114  m_fopr_w->mult(zeta, eta);
115 
116  force_udiv1_impl(force, zeta, eta);
117 
118  force_udiv1_impl(force1, eta, zeta);
119  force += force1;
120 
121  Field_G_SF set_wk;
122  set_wk.set_boundary_spatial_link_zero(force);
123 
124  force_ = force;
125 }
126 
127 
128 //====================================================================
129 void Force_F_Wilson_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
130 {
131  int Nvol = CommonParameters::Nvol();
132  int Ndim = CommonParameters::Ndim();
133 
134  Field_G force(Nvol, Ndim);
135  Field_F zeta(zeta_);
136  Field_F eta(eta_);
137 
138  force_udiv1_impl(force, zeta, eta);
139 
140  force_ = force;
141 }
142 
143 
144 //====================================================================
145 void Force_F_Wilson_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
146 {
147  int Nc = CommonParameters::Nc();
148  int Nd = CommonParameters::Nd();
149  int Nvol = CommonParameters::Nvol();
150  int Ndim = CommonParameters::Ndim();
151 
152 // Field_G force(Nvol, Ndim);
153  force = 0.0;
154 
155 // Field_G force1(Nvol, 1);
156  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
157 
158  for (int mu = 0; mu < Ndim; ++mu) {
159  eta2 = m_fopr_w->mult_gm5p(mu, eta);
160  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
161 // tensorProd_Field_F(force1, zeta, eta3);
162 // force.setpart_ex(mu, force1, 0);
163  tensorProd_Field_F(force, mu, zeta, eta3);
164  }
165 
166  force *= -m_kappa;
167 }
168 
169 
170 //====================================================================
171 //============================================================END=====
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
BridgeIO vout
Definition: bridgeIO.cpp:207
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
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:38
Bridge::VerboseLevel m_vl
Definition: force.h:76
Container of Field-type object.
Definition: field.h:37
Class for parameters.
Definition: parameters.h:40
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
Wilson-type fermion field.
Definition: field_F.h:37
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
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:36
Fopr_Wilson_SF * m_fopr_w
static const std::string class_name
std::valarray< int > m_boundary
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
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)
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:324
void Register_int_vector(const string &, const std::valarray< int > &)
Definition: parameters.cpp:345
const Field_F mult_gm5p(int mu, const Field_F &w)
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void set_parameters(const Parameters &params)