Bridge++  Ver. 1.3.x
fopr_Wilson_SF.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_SF.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 
21 #ifdef USE_FACTORY
22 namespace {
23  Fopr *create_object()
24  {
25  return new Fopr_Wilson_SF();
26  }
27 
28 
29  bool init = Fopr::Factory_noarg::Register("Wilson_SF", create_object);
30 }
31 #endif
32 
33 //- parameter entries
34 namespace {
35  void append_entry(Parameters& param)
36  {
37  param.Register_double("hopping_parameter", 0.0);
38  param.Register_int_vector("boundary_condition", std::vector<int>());
39 
40  param.Register_string("verbose_level", "NULL");
41  }
42 
43 
44 #ifdef USE_PARAMETERS_FACTORY
45  bool init_param = ParametersFactory::Register("Fopr.Wilson_SF", append_entry);
46 #endif
47 }
48 //- end
49 
50 //- parameters class
52 //- end
53 
54 const std::string Fopr_Wilson_SF::class_name = "Fopr_Wilson_SF";
55 
56 //====================================================================
58 {
59  const string str_vlevel = params.get_string("verbose_level");
60 
61  m_vl = vout.set_verbose_level(str_vlevel);
62 
63  //- fetch and check input parameters
64  double kappa;
65  std::vector<int> bc;
66 
67  int err = 0;
68  err += params.fetch_double("hopping_parameter", kappa);
69  err += params.fetch_int_vector("boundary_condition", bc);
70 
71  if (err) {
72  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
73  exit(EXIT_FAILURE);
74  }
75 
76  set_parameters(kappa, bc);
77 }
78 
79 
80 //====================================================================
81 void Fopr_Wilson_SF::set_parameters(const double kappa, const std::vector<int> bc)
82 {
83  //- print input parameters
84  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
85  vout.general(m_vl, " kappa = %8.4f\n", kappa);
86  for (int dir = 0; dir < m_Ndim; ++dir) {
87  vout.general(m_vl, " boundary[%d] = %2d\n", dir, bc[dir]);
88  }
89 
90  //- range check
91  // NB. kappa = 0 is allowed.
92  assert(bc.size() == m_Ndim);
93 
94  //- store values
95  m_kappa = kappa;
96 
97  m_boundary.resize(m_Ndim);
98  for (int mu = 0; mu < m_Ndim; ++mu) {
99  m_boundary[mu] = bc[mu];
100  }
101 
102  //- propagate parameters
104 }
105 
106 
107 //====================================================================
109 {
110  Field w2(f.nin(), f.nvol(), f.nex());
111 
112  D(w2, f);
113  mult_gm5(w, w2);
114  D(w2, w);
115  mult_gm5(w, w2);
116 }
117 
118 
119 //====================================================================
120 void Fopr_Wilson_SF::Ddag(Field& w, const Field& f)
121 {
122  Field w2(f.nin(), f.nvol(), f.nex());
123 
124  mult_gm5(w, f);
125  D(w2, w);
126  mult_gm5(w, w2);
127 }
128 
129 
130 //====================================================================
131 void Fopr_Wilson_SF::H(Field& w, const Field& f)
132 {
133  Field w2(f.nin(), f.nvol(), f.nex());
134 
135  D(w2, f);
136  mult_gm5(w, w2);
137 }
138 
139 
140 //====================================================================
141 void Fopr_Wilson_SF::D(Field& w, const Field& f)
142 {
143  Field w2(f);
144 
146  m_fopr_w->D(w, w2);
148 }
149 
150 
151 //====================================================================
152 void Fopr_Wilson_SF::mult_gm5p(int mu, Field_F& v, const Field_F& w)
153 {
154  Field_F w2(w);
155 
157  m_fopr_w->mult_gm5p(mu, v, w2);
159 }
160 
161 
162 //====================================================================
164 {
165  //- Counting of floating point operations.
166  // not implemented, yet.
167 
168  double flop = 0.0;
169 
170  return flop;
171 }
172 
173 
174 //====================================================================
175 //============================================================END=====
void Register_int_vector(const string &, const std::vector< int > &)
Definition: parameters.cpp:344
BridgeIO vout
Definition: bridgeIO.cpp:278
void DdagD(Field &, const Field &)
Fopr_Wilson * m_fopr_w
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
std::vector< int > m_boundary
void general(const char *format,...)
Definition: bridgeIO.cpp:65
void D(Field &w, const Field &v)
Container of Field-type object.
Definition: field.h:39
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:38
void mult_gm5p(int mu, Field_F &v, const Field_F &w)
this function is used for derivatives in force calculation.
void Ddag(Field &, const Field &)
Wilson fermion operator with SF BC.
void D(Field &, const Field &)
Wilson-type fermion field.
Definition: field_F.h:37
static const std::string class_name
int nin() const
Definition: field.h:115
Bridge::VerboseLevel m_vl
Definition: fopr.h:113
void set_parameters(const Parameters &params)
Definition: fopr_Wilson.cpp:65
int nex() const
Definition: field.h:117
void H(Field &, const Field &)
double flop_count()
this returns the number of floating point operations.
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
void mult_gm5p(int mu, Field_F &v, const Field_F &w)
static bool Register(const std::string &realm, const creator_callback &cb)
void set_boundary_zero(Field &f)
Definition: field_F_SF.h:56
void Register_double(const string &, const double)
Definition: parameters.cpp:323
Field_F_SF set_zero
In order to set the boundary field to zero.
Base class of fermion operator family.
Definition: fopr.h:49
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
void mult_gm5(Field &v, const Field &w)
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)