Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::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_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  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_Nf2::set_parameters(const 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  //- 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  force_ = force1;
116 
117  force_udiv1_impl(force1, eta, zeta);
118  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  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_G force(Nvol, Ndim);
147  force = 0.0;
148 
149 // Field_G force1(Nvol, 1);
150  Field_F eta2(Nvol, 1);
151  Field_F eta3(Nvol, 1);
152 
153  for (int mu = 0; mu < Ndim; ++mu) {
154  eta2 = m_fopr_w->mult_gm5p(mu, eta);
155  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
156 // m_fopr_w->gm5p(eta3, mu, eta);
157 
158 // tensorProd_Field_F(force1, zeta, eta3);
159 // force.setpart_ex(mu, force1, 0);
160  tensorProd_Field_F(force, mu, zeta, eta3);
161  }
162 
163  force *= -m_kappa;
164 }
165 
166 
167 //====================================================================
168 //============================================================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 general(const char *format,...)
Definition: bridgeIO.cpp:38
Bridge::VerboseLevel m_vl
Definition: force.h:76
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
Definition: fopr_Wilson.h:75
Container of Field-type object.
Definition: field.h:37
Field_G * m_U
Definition: force.h:74
std::valarray< int > m_boundary
Class for parameters.
Definition: parameters.h:40
Fopr_Wilson * m_fopr_w
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
const Field_F mult_gm5p(int mu, const Field_F &w)
this function is used for derivatives in force calculation.
Wilson-type fermion field.
Definition: field_F.h:37
SU(N) gauge field.
Definition: field_G.h:36
void force_udiv(Field &force, const Field &eta)
void set_parameters(const Parameters &params)
Definition: fopr_Wilson.cpp:48
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 crucial(const char *format,...)
Definition: bridgeIO.cpp:26
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...
Definition: fopr_Wilson.cpp:91
static bool Register(const std::string &realm, const creator_callback &cb)
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
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