Bridge++  Ver. 2.0.2
force_F_Clover_Nf2.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Clover_Nf2.h"
16 
17 const std::string Force_F_Clover_Nf2::class_name = "Force_F_Clover_Nf2";
18 
19 //====================================================================
20 void Force_F_Clover_Nf2::init(std::string repr)
21 {
22  m_repr = repr;
23 
24  m_fopr_c = new Fopr_Clover(repr);
25  m_force_w = new Force_F_Wilson_Nf2(repr);
26  m_force_csw = new Force_F_CloverTerm(repr);
27 
29 
30  const int Nvol = CommonParameters::Nvol();
32 
33  m_Cud = new Field_G(Nvol, m_Ndim * m_Ndim);
34 }
35 
36 
37 //====================================================================
39 {
40  delete m_Cud;
41  delete m_force_csw;
42  delete m_force_w;
43  delete m_fopr_c;
44 }
45 
46 
47 //====================================================================
49 {
50  std::string vlevel;
51  if (!params.fetch_string("verbose_level", vlevel)) {
52  m_vl = vout.set_verbose_level(vlevel);
53  }
54 
55  //- fetch and check input parameters
56  double kappa, cSW;
57  std::vector<int> bc;
58 
59  int err = 0;
60  err += params.fetch_double("hopping_parameter", kappa);
61  err += params.fetch_double("clover_coefficient", cSW);
62  err += params.fetch_int_vector("boundary_condition", bc);
63 
64  if (err) {
65  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
66  exit(EXIT_FAILURE);
67  }
68 
69 
70  set_parameters(kappa, cSW, bc);
71 }
72 
73 
74 //====================================================================
75 void Force_F_Clover_Nf2::set_parameters(const double kappa,
76  const double cSW,
77  const std::vector<int> bc)
78 {
79  const int Ndim = CommonParameters::Ndim();
80  assert(bc.size() == Ndim);
81 
82  int ith = ThreadManager::get_thread_id();
83 
84  if (ith == 0) {
85  m_kappa = kappa;
86  m_cSW = cSW;
87 
88  m_boundary.resize(Ndim);
89  m_boundary = bc;
90  }
91 
92  //- print input parameters
93  vout.general(m_vl, "%s:\n", class_name.c_str());
94  vout.general(m_vl, " kappa = %12.8f\n", kappa);
95  vout.general(m_vl, " cSW = %12.8f\n", cSW);
96  for (int mu = 0; mu < Ndim; ++mu) {
97  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
98  }
99 
100  //- propagate parameters
101  Parameters params;
102  get_parameters(params);
103 
104  m_fopr_c->set_parameters(params);
105  m_force_w->set_parameters(params);
106  m_force_csw->set_parameters(params);
107 
108  //m_fopr_c->set_parameters(m_kappa, m_cSW, m_boundary);
109  //m_force_w->set_parameters(m_kappa, m_boundary);
110  //m_force_csw->set_parameters(m_kappa, m_cSW, m_boundary);
111 }
112 
113 
114 //====================================================================
116 {
117  params.set_double("hopping_parameter", m_kappa);
118  params.set_double("clover_coefficient", m_cSW);
119  params.set_int_vector("boundary_condition", m_boundary);
120 
121  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
122 }
123 
124 
125 //====================================================================
126 void Force_F_Clover_Nf2::force_udiv(Field& force_, const Field& eta_)
127 {
128  const int Nvol = CommonParameters::Nvol();
129  const int Ndim = CommonParameters::Ndim();
130 
131  Field_F zeta;
132  Field_F eta(eta_);
133 
134  m_fopr_c->H(zeta, eta);
135 
136  Field_G force1(Nvol, Ndim);
137  force_udiv1(force1, eta, zeta);
138  copy(force_, force1); // force_ = force1;
139 
140  force_udiv1(force1, zeta, eta);
141  axpy(force_, 1.0, force1); // force_ += force1;
142 }
143 
144 
145 //====================================================================
146 void Force_F_Clover_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
147 {
148  const int Nvol = CommonParameters::Nvol();
149  const int Ndim = CommonParameters::Ndim();
150 
151  Field_G force(Nvol, Ndim);
152  Field_F zeta(zeta_);
153  Field_F eta(eta_);
154 
155  force_udiv1_impl(force, zeta, eta);
156 
157  copy(force_, force); // force_ = force;
158 }
159 
160 
161 //====================================================================
162 void Force_F_Clover_Nf2::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
163 {
164  const int Nvol = CommonParameters::Nvol();
165  const int Ndim = CommonParameters::Ndim();
166 
167  force.set(0.0);
168 
169  m_force_w->set_mode("H");
170  m_force_w->force_udiv1(force, zeta, eta);
171 
172  Field_G force2(Nvol, Ndim);
173  m_force_csw->force_udiv1(force2, zeta, eta);
174 
175  axpy(force, 1.0, force2); // force += force2;
176 }
177 
178 
179 //====================================================================
181 {
182  for (int mu = 0; mu < m_Ndim; ++mu) {
183  for (int nu = 0; nu < m_Ndim; ++nu) {
184  if (nu == mu) continue;
185 
186  Staple_lex staple;
187 
188  Field_G Cmu_ud1;
189  staple.upper(Cmu_ud1, *m_U, mu, nu);
190 
191  Field_G Cmu_ud2;
192  staple.lower(Cmu_ud2, *m_U, mu, nu);
193  //Cmu_ud -= staple.lower(*m_U, mu, nu);
194 
195  axpy(Cmu_ud1, -1.0, Cmu_ud2);
196  m_Cud->setpart_ex(index_dir(mu, nu), Cmu_ud1, 0);
197  }
198  }
199 }
200 
201 
202 //====================================================================
203 //============================================================END=====
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Fopr_Clover::H
void H(Field &, const Field &)
Definition: fopr_Clover.cpp:323
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
Force_F_Clover_Nf2::m_Cud
Field_G * m_Cud
for force calculation
Definition: force_F_Clover_Nf2.h:49
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
Force_F_Clover_Nf2::m_force_csw
Force_F_CloverTerm * m_force_csw
Clover term force.
Definition: force_F_Clover_Nf2.h:52
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Force_F_Clover_Nf2::index_dir
int index_dir(const int mu, const int nu)
Definition: force_F_Clover_Nf2.h:121
Force_F_Clover_Nf2::force_udiv
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_Clover_Nf2.cpp:126
Force_F_CloverTerm
Force calculation for clover term of clover fermion.
Definition: force_F_CloverTerm.h:38
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Clover_Nf2::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_Clover_Nf2.cpp:146
Force_F_Clover_Nf2::m_fopr_c
Fopr_Clover * m_fopr_c
fermion operator
Definition: force_F_Clover_Nf2.h:50
Fopr_Clover::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Clover.cpp:118
Staple_lex::lower
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:286
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Fopr_Clover
Clover fermion operator.
Definition: fopr_Clover.h:43
Force_F_CloverTerm::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_CloverTerm.cpp:123
Force_F_Clover_Nf2::get_parameters
void get_parameters(Parameters &params) const
Getting parameters of clover fermion force.
Definition: force_F_Clover_Nf2.cpp:115
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
force_F_Wilson_Nf2_Isochemical.h
Force::m_U
Field_G * m_U
Definition: force_F.h:66
Force_F_Clover_Nf2::init
void init(const std::string)
Definition: force_F_Clover_Nf2.cpp:20
Force_F_Clover_Nf2::m_repr
std::string m_repr
gamma matrix representation
Definition: force_F_Clover_Nf2.h:46
Force_F_Clover_Nf2::class_name
static const std::string class_name
Definition: force_F_Clover_Nf2.h:38
Force_F_Clover_Nf2::tidyup
void tidyup()
Definition: force_F_Clover_Nf2.cpp:38
Force::set_mode
virtual void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
Definition: force_F.h:51
Force_F_CloverTerm::set_parameters
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
Definition: force_F_CloverTerm.cpp:19
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Force_F_Clover_Nf2::m_force_w
Force_F_Wilson_Nf2 * m_force_w
Wilson fermion force.
Definition: force_F_Clover_Nf2.h:51
force_F_Clover_Nf2.h
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Staple_lex::upper
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:263
Force_F_Wilson_Nf2::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_Nf2.cpp:19
Staple_lex
Staple construction.
Definition: staple_lex.h:39
Force_F_Clover_Nf2::set_component
void set_component()
Set building components for force calculation.
Definition: force_F_Clover_Nf2.cpp:180
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_F_Clover_Nf2::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
Definition: force_F_Clover_Nf2.cpp:162
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Force_F_Wilson_Nf2
Force for the standard Wilson fermion operator.
Definition: force_F_Wilson_Nf2.h:38
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
Force_F_Clover_Nf2::m_kappa
double m_kappa
hopping parameter
Definition: force_F_Clover_Nf2.h:43
Force_F_Clover_Nf2::set_parameters
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
Definition: force_F_Clover_Nf2.cpp:48
Force_F_Clover_Nf2::m_Ndim
int m_Ndim
spacetime dimension
Definition: force_F_Clover_Nf2.h:48
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Force_F_Clover_Nf2::m_boundary
std::vector< int > m_boundary
boundary conditions
Definition: force_F_Clover_Nf2.h:45
Force_F_Clover_Nf2::m_cSW
double m_cSW
clover coefficient
Definition: force_F_Clover_Nf2.h:44
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_Clover_Nf2::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Clover_Nf2.h:41
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