Bridge++  Version 1.5.4
 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 const std::string Force_F_Wilson_Nf2::class_name = "Force_F_Wilson_Nf2";
17 
18 //====================================================================
20 {
21  const string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  double kappa;
27  std::vector<int> bc;
28 
29  int err = 0;
30  err += params.fetch_double("hopping_parameter", kappa);
31  err += params.fetch_int_vector("boundary_condition", bc);
32 
33  if (err) {
34  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
35  exit(EXIT_FAILURE);
36  }
37 
38 
39  set_parameters(kappa, bc);
40 }
41 
42 
43 //====================================================================
44 void Force_F_Wilson_Nf2::set_parameters(const double kappa, const std::vector<int> bc)
45 {
46  const int Ndim = CommonParameters::Ndim();
47 
48  //- print input parameters
49  vout.general(m_vl, "%s:\n", class_name.c_str());
50  vout.general(m_vl, " kappa = %12.8f\n", kappa);
51  for (int mu = 0; mu < Ndim; ++mu) {
52  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
53  }
54 
55  //- range check
56  // NB. kappa == 0 is allowed.
57  assert(bc.size() == Ndim);
58 
59  //- store values
60  m_kappa = kappa;
61 
62  m_boundary.resize(Ndim);
63  m_boundary = bc;
64 
65  //- post-process
67 }
68 
69 
70 //====================================================================
71 void Force_F_Wilson_Nf2::force_udiv(Field& force_, const Field& eta_)
72 {
73  const int Nvol = CommonParameters::Nvol();
74  const int Ndim = CommonParameters::Ndim();
75 
76  Field_F zeta;
77  Field_F eta(eta_);
78 
79  m_fopr_w->set_mode("H");
80  m_fopr_w->mult(zeta, eta);
81 
82  Field_G force1(Nvol, Ndim);
83  force_udiv1_impl(force1, zeta, eta);
84  copy(force_, force1); // force_ = force1;
85 
86  force_udiv1_impl(force1, eta, zeta);
87  axpy(force_, 1.0, force1); // force_ += force1;
88 }
89 
90 
91 //====================================================================
92 void Force_F_Wilson_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
93 {
94  const int Nvol = CommonParameters::Nvol();
95  const int Ndim = CommonParameters::Ndim();
96 
97  Field_G force(Nvol, Ndim);
98  Field_F zeta(zeta_);
99  Field_F eta(eta_);
100 
101  force_udiv1_impl(force, zeta, eta);
102 
103  copy(force_, force); // force_ = force;
104 }
105 
106 
107 //====================================================================
108 void Force_F_Wilson_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
109 {
110  const int Ndim = CommonParameters::Ndim();
111 
112  force.set(0.0);
113 
114  for (int mu = 0; mu < Ndim; ++mu) {
115  Field_F eta2;
116  m_fopr_w->mult_gm5p(mu, eta2, eta);
117 
118  Field_F eta3;
119  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
120 
121  tensorProd_Field_F(force, mu, zeta, eta3);
122  }
123 
124  scal(force, -m_kappa); // force *= -m_kappa;
125 }
126 
127 
128 //====================================================================
129 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
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:79
BridgeIO vout
Definition: bridgeIO.cpp:503
std::vector< int > m_boundary
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Bridge::VerboseLevel m_vl
Definition: force_F.h:69
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Field_G * m_U
Definition: force_F.h:68
Class for parameters.
Definition: parameters.h:46
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
Fopr_Wilson * m_fopr_w
Wilson-type fermion field.
Definition: field_F.h:37
void set_parameters(const Parameters &params)
SU(N) gauge field.
Definition: field_G.h:38
void force_udiv(Field &force, const Field &eta)
const Field_F mult_gm5p(const int mu, const Field_F &w)
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:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void set_parameters(const Parameters &params)
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...