Bridge++  Ver. 2.0.2
force_F_Wilson_TwistedMass_Nf2.cpp
Go to the documentation of this file.
1 
15 
16 const std::string Force_F_Wilson_TwistedMass_Nf2::class_name = "Force_F_Wilson_TwistedMass_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, tw_mass;
28  std::vector<int> bc;
29 
30  int err = 0;
31  err += params.fetch_double("hopping_parameter", kappa);
32  err += params.fetch_double("twisted_mass", tw_mass);
33  err += params.fetch_int_vector("boundary_condition", bc);
34 
35  if (err) {
36  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
37  exit(EXIT_FAILURE);
38  }
39 
40 
41  set_parameters(kappa, tw_mass, bc);
42 }
43 
44 
45 //====================================================================
47 {
48  params.set_double("hopping_parameter", m_kappa);
49  params.set_double("twisted_mass", m_tw_mass);
50  params.set_int_vector("boundary_condition", m_boundary);
51 
52  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
53 }
54 
55 
56 //====================================================================
57 void Force_F_Wilson_TwistedMass_Nf2::set_parameters(const double kappa, const double tw_mass,
58  const std::vector<int> bc)
59 {
60  const int Ndim = CommonParameters::Ndim();
61 
62  //- print input parameters
63  vout.general(m_vl, "%s:\n", class_name.c_str());
64  vout.general(m_vl, " kappa = %12.8f\n", kappa);
65  vout.general(m_vl, " tw_mass = %12.8f\n", tw_mass);
66  for (int mu = 0; mu < Ndim; ++mu) {
67  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
68  }
69 
70  //- range check
71  // NB. kappa,tw_mass == 0 is allowed.
72  assert(bc.size() == Ndim);
73 
74  //- store values
75  m_kappa = kappa;
76  m_tw_mass = tw_mass;
77 
78  m_boundary.resize(Ndim);
79  m_boundary = bc;
80 
81  //- post-process
83 }
84 
85 
86 //====================================================================
88 {
89  const int Nvol = CommonParameters::Nvol();
90  const int Ndim = CommonParameters::Ndim();
91 
92  Field_F zeta;
93  Field_F eta(eta_);
94 
95  m_fopr_tw->set_mode("H");
96  m_fopr_tw->mult(zeta, eta);
97 
98  Field_G force1(Nvol, Ndim);
99  force_udiv1(force1, zeta, eta);
100  copy(force_, force1); // force_ = force1;
101 
102  force_udiv1(force1, eta, zeta);
103  axpy(force_, 1.0, force1); // force_ += force1;
104 }
105 
106 
107 //====================================================================
108 void Force_F_Wilson_TwistedMass_Nf2::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
109 {
110  const int Nvol = CommonParameters::Nvol();
111  const int Ndim = CommonParameters::Ndim();
112 
113  Field_G force(Nvol, Ndim);
114  Field_F zeta(zeta_);
115  Field_F eta(eta_);
116 
117  force_udiv1_impl(force, zeta, eta);
118 
119  copy(force_, force); // force_ = force;
120 }
121 
122 
123 //====================================================================
125 {
126  const int Ndim = CommonParameters::Ndim();
127 
128  force.set(0.0);
129 
130  for (int mu = 0; mu < Ndim; ++mu) {
131  Field_F eta2;
132  m_fopr_tw->mult_gm5p(mu, eta2, eta);
133 
134  Field_F eta3;
135  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
136 
137  tensorProd_Field_F(force, mu, zeta, eta3);
138  }
139 
140  scal(force, -m_kappa); // force *= -m_kappa;
141 }
142 
143 
144 //====================================================================
145 //============================================================END=====
Force_F_Wilson_TwistedMass_Nf2::class_name
static const std::string class_name
Definition: force_F_Wilson_TwistedMass_Nf2.h:42
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
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_TwistedMass_Nf2.h
Force_F_Wilson_TwistedMass_Nf2::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Wilson_TwistedMass_Nf2.h:45
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
Force_F_Wilson_TwistedMass_Nf2::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Wilson_TwistedMass_Nf2.cpp:87
Force_F_Wilson_TwistedMass_Nf2::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_TwistedMass_Nf2.cpp:108
Force_F_Wilson_TwistedMass_Nf2::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Definition: force_F_Wilson_TwistedMass_Nf2.cpp:124
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
AFopr_Wilson_TwistedMass::mult_gm5p
void mult_gm5p(const int mu, AFIELD &v, const AFIELD &w)
Definition: afopr_Wilson_TwistedMass-tmpl.h:288
AFopr_Wilson_TwistedMass::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Wilson_TwistedMass-tmpl.h:131
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Force_F_Wilson_TwistedMass_Nf2::m_kappa
double m_kappa
Definition: force_F_Wilson_TwistedMass_Nf2.h:47
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
AFopr_Wilson_TwistedMass::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Wilson_TwistedMass-tmpl.h:226
Force_F_Wilson_TwistedMass_Nf2::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_TwistedMass_Nf2.cpp:19
Force_F_Wilson_TwistedMass_Nf2::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Wilson_TwistedMass_Nf2.cpp:46
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_F_Wilson_TwistedMass_Nf2::m_boundary
std::vector< int > m_boundary
Definition: force_F_Wilson_TwistedMass_Nf2.h:49
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
Force_F_Wilson_TwistedMass_Nf2::m_tw_mass
double m_tw_mass
Definition: force_F_Wilson_TwistedMass_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_Wilson_TwistedMass_Nf2::m_fopr_tw
Fopr_Wilson_TwistedMass * m_fopr_tw
Definition: force_F_Wilson_TwistedMass_Nf2.h:50
Field_G
SU(N) gauge field.
Definition: field_G.h:38
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
AFopr_Wilson_TwistedMass::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Wilson_TwistedMass-tmpl.h:274