Bridge++  Ver. 2.0.2
force_F_Wilson_SF.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_SF.h"
15 
16 const std::string Force_F_Wilson_SF::class_name = "Force_F_Wilson_SF";
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 
40  set_parameters(kappa, bc);
41 }
42 
43 
44 //====================================================================
46 {
47  params.set_double("hopping_parameter", m_kappa);
48  params.set_int_vector("boundary_condition", m_boundary);
49 
50  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
51 }
52 
53 
54 //====================================================================
55 void Force_F_Wilson_SF::set_parameters(const double kappa, const std::vector<int> bc)
56 {
57  const int Ndim = CommonParameters::Ndim();
58 
59  //- print input parameters
60  vout.general(m_vl, "%s:\n", class_name.c_str());
61  vout.general(m_vl, " kappa = %12.8f\n", kappa);
62  for (int mu = 0; mu < Ndim; ++mu) {
63  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
64  }
65 
66  //- range check
67  // NB. kappa == 0 is allowed.
68  assert(bc.size() == Ndim);
69 
70  //- store values
71  m_kappa = kappa;
72 
73  m_boundary.resize(Ndim);
74  m_boundary = bc;
75 
76  //- propagate parameters
78 }
79 
80 
81 //====================================================================
82 void Force_F_Wilson_SF::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 force(Nvol, Ndim);
94  force_udiv1_impl(force, zeta, eta);
95 
96  Field_G force1(Nvol, Ndim);
97  force_udiv1_impl(force1, eta, zeta);
98  axpy(force, 1.0, force1); // force += force1;
99 
101 
102  copy(force_, force); // force_ = force;
103 }
104 
105 
106 //====================================================================
107 void Force_F_Wilson_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
108 {
109  const int Nvol = CommonParameters::Nvol();
110  const int Ndim = CommonParameters::Ndim();
111 
112  Field_G force(Nvol, Ndim);
113  Field_F zeta(zeta_);
114  Field_F eta(eta_);
115 
116  force_udiv1_impl(force, zeta, eta);
117 
118  copy(force_, force); // force_ = force;
119 }
120 
121 
122 //====================================================================
123 void Force_F_Wilson_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
124 {
125  const int Ndim = CommonParameters::Ndim();
126 
127  force.set(0.0);
128 
129  for (int mu = 0; mu < Ndim; ++mu) {
130  Field_F eta2;
131  m_fopr_w->mult_gm5p(mu, eta2, eta);
132 
133  Field_F eta3;
134  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
135 
136  tensorProd_Field_F(force, mu, zeta, eta3);
137  }
138 
139  scal(force, -m_kappa); // force *= -m_kappa;
140 }
141 
142 
143 //====================================================================
144 //============================================================END=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Fopr_Wilson_SF::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_SF.cpp:231
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Fopr_Wilson_SF::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Wilson_SF.cpp:65
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
force_F_Wilson_SF.h
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
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::m_U
Field_G * m_U
Definition: force_F.h:66
Force_F_Wilson_SF::m_boundary
std::vector< int > m_boundary
Definition: force_F_Wilson_SF.h:50
Fopr_Wilson_SF::mult_gm5p
void mult_gm5p(const int mu, Field &v, const Field &w)
Definition: fopr_Wilson_SF.cpp:290
Force_F_Wilson_SF::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_SF.cpp:107
Force_F_Wilson_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_SF.cpp:19
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Fopr_Wilson_SF::mult
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field.
Definition: fopr_Wilson_SF.cpp:153
Force_F_Wilson_SF::m_fopr_w
Fopr_Wilson_SF * m_fopr_w
Definition: force_F_Wilson_SF.h:51
Force_F_Wilson_SF::m_kappa
double m_kappa
Definition: force_F_Wilson_SF.h:49
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Field_SF::set_boundary_spatial_link_zero
void set_boundary_spatial_link_zero(Field_G &u)
Definition: field_SF.cpp:151
Force_F_Wilson_SF::class_name
static const std::string class_name
Definition: force_F_Wilson_SF.h:42
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_F_Wilson_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Wilson_SF.h:45
Force_F_Wilson_SF::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Definition: force_F_Wilson_SF.cpp:123
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
Field
Container of Field-type object.
Definition: field.h:46
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Force_F_Wilson_SF::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Wilson_SF.cpp:82
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Force_F_Wilson_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Wilson_SF.cpp:45
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