Bridge++  Ver. 2.0.2
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  std::string vlevel;
22  if (!params.fetch_string("verbose_level", vlevel)) {
23  m_vl = vout.set_verbose_level(vlevel);
24  }
25 
26  //- fetch and check input parameters
27  double kappa;
28  std::vector<int> bc;
29 
30  int err = 0;
31  err += params.fetch_double("hopping_parameter", kappa);
32  err += params.fetch_int_vector("boundary_condition", bc);
33 
34  if (err) {
35  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
36  exit(EXIT_FAILURE);
37  }
38 
39  set_parameters(kappa, bc);
40 }
41 
42 
43 //====================================================================
45 {
46  params.set_double("hopping_parameter", m_kappa);
47  params.set_int_vector("boundary_condition", m_boundary);
48 
49  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
50 }
51 
52 
53 //====================================================================
54 void Force_F_Wilson_Nf2::set_parameters(const double kappa,
55  const std::vector<int> bc)
56 {
57  const int Ndim = CommonParameters::Ndim();
58  assert(bc.size() == Ndim);
59 
60  int ith = ThreadManager::get_thread_id();
61 
62  if (ith == 0) {
63  m_kappa = kappa;
64 
65  m_boundary.resize(Ndim);
66  m_boundary = bc;
67  }
68 
69  //- print input parameters
70  vout.general(m_vl, "%s: set parameters\n", class_name.c_str());
71  vout.general(m_vl, " kappa = %12.8f\n", m_kappa);
72  for (int mu = 0; mu < Ndim; ++mu) {
73  vout.general(m_vl, " boundary[%d] = %2d\n", mu, m_boundary[mu]);
74  }
75 
76  // propagate parameters
78 }
79 
80 
81 //====================================================================
82 void Force_F_Wilson_Nf2::force_udiv(Field& force_, const Field& eta_)
83 {
84  const int Nvol = CommonParameters::Nvol();
85  const int Ndim = CommonParameters::Ndim();
86 
87  Field_F zeta;
88  Field_F eta(eta_);
89 
90  m_fopr_w->set_mode("H");
91  m_fopr_w->mult(zeta, eta);
92 
93  Field_G force1(Nvol, Ndim);
94  force_udiv1_impl(force1, zeta, eta);
95  copy(force_, force1); // force_ = force1;
96 
97  force_udiv1_impl(force1, eta, zeta);
98  axpy(force_, 1.0, force1); // force_ += force1;
99 }
100 
101 
102 //====================================================================
103 void Force_F_Wilson_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
104 {
105  const int Nvol = CommonParameters::Nvol();
106  const int Ndim = CommonParameters::Ndim();
107 
108  Field_G force(Nvol, Ndim);
109  Field_F zeta(zeta_);
110  Field_F eta(eta_);
111 
112  force_udiv1_impl(force, zeta, eta);
113 
114  copy(force_, force); // force_ = force;
115 }
116 
117 
118 //====================================================================
119 void Force_F_Wilson_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
120 {
121  const int Ndim = CommonParameters::Ndim();
122 
123  force.set(0.0);
124 
125  for (int mu = 0; mu < Ndim; ++mu) {
126  Field_F eta2;
127  m_fopr_w->mult_gm5p(mu, eta2, eta);
128 
129  Field_F eta3;
130  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
131 
132  tensorProd_Field_F(force, mu, zeta, eta3);
133  }
134 
135  scal(force, -m_kappa); // force *= -m_kappa;
136 }
137 
138 
139 //====================================================================
140 //============================================================END=====
Org::Fopr_Wilson::set_mode
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr_Wilson_impl.cpp:200
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Force_F_Wilson_Nf2::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_Nf2.cpp:103
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Wilson_Nf2::m_kappa
double m_kappa
Definition: force_F_Wilson_Nf2.h:46
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
mult_Field_Gd
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:76
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
tensorProd_Field_F
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
Force_F_Wilson_Nf2::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Wilson_Nf2.h:44
Force::m_U
Field_G * m_U
Definition: force_F.h:66
Force_F_Wilson_Nf2::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Wilson_Nf2.cpp:44
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Org::Fopr_Wilson::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Wilson_impl.cpp:127
Org::Fopr_Wilson::mult_gm5p
void mult_gm5p(const int mu, Field &v, const Field &w)
Definition: fopr_Wilson_impl.cpp:406
Org::Fopr_Wilson::mult
void mult(Field &v, const Field &w)
multiplies fermion operator to a given field.
Definition: fopr_Wilson_impl.cpp:210
Force_F_Wilson_Nf2::m_fopr_w
Fopr_Wilson * m_fopr_w
Definition: force_F_Wilson_Nf2.h:48
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Force_F_Wilson_Nf2::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Wilson_Nf2.cpp:82
Force_F_Wilson_Nf2::m_boundary
std::vector< int > m_boundary
Definition: force_F_Wilson_Nf2.h:47
Force_F_Wilson_Nf2::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_Nf2.cpp:19
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
force_F_Wilson_Nf2.h
Field
Container of Field-type object.
Definition: field.h:46
Force_F_Wilson_Nf2::class_name
static const std::string class_name
Definition: force_F_Wilson_Nf2.h:41
ThreadManager::get_thread_id
static int get_thread_id()
returns thread id.
Definition: threadManager.cpp:253
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Force_F_Wilson_Nf2::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Definition: force_F_Wilson_Nf2.cpp:119
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154