Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_TMWilson_Nf2.cpp
Go to the documentation of this file.
1 
14 #include "force_F_TMWilson_Nf2.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using std::valarray;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_double("hopping_parameter", 0.0);
27  param.Register_double("twisted_mass", 0.0);
28  param.Register_int_vector("boundary_condition", std::valarray<int>());
29 
30  param.Register_string("verbose_level", "NULL");
31  }
32 
33 
34 #ifdef USE_PARAMETERS_FACTORY
35  bool init_param = ParametersFactory::Register("Force.F_TMWilson_Nf2", append_entry);
36 #endif
37 }
38 //- end
39 
40 //- parameters class
42 //- end
43 
44 //====================================================================
46 {
47  const string str_vlevel = params.get_string("verbose_level");
48 
49  m_vl = vout.set_verbose_level(str_vlevel);
50 
51  //- fetch and check input parameters
52  double kappa, tw_mass;
53  valarray<int> bc;
54 
55  int err = 0;
56  err += params.fetch_double("hopping_parameter", kappa);
57  err += params.fetch_double("twisted_mass", tw_mass);
58  err += params.fetch_int_vector("boundary_condition", bc);
59 
60  if (err) {
61  vout.crucial(m_vl, "Force_F_TMWilson: fetch error, input parameter not found.\n");
62  abort();
63  }
64 
65 
66  set_parameters(kappa, tw_mass, bc);
67 }
68 
69 
70 //====================================================================
71 void Force_F_TMWilson_Nf2::set_parameters(const double kappa, const double tw_mass,
72  const valarray<int> bc)
73 {
74  int Ndim = CommonParameters::Ndim();
75 
76  //- print input parameters
77  vout.general(m_vl, "Parameters of twisted mass fermion operator:\n");
78  vout.general(m_vl, " kappa = %8.4f\n", kappa);
79  vout.general(m_vl, " tw_mass = %8.4f\n", tw_mass);
80  for (int mu = 0; mu < Ndim; ++mu) {
81  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
82  }
83 
84  //- range check
85  // NB. kappa,tw_mass == 0 is allowed.
86  assert(bc.size() == Ndim);
87 
88  //- store values
89  m_kappa = kappa;
90  m_tw_mass = tw_mass;
91 
92  m_boundary.resize(Ndim);
93  for (int mu = 0; mu < Ndim; ++mu) {
94  m_boundary[mu] = bc[mu];
95  }
96 
97  //- post-process
99 }
100 
101 
102 //====================================================================
104 {
105  int Nc = CommonParameters::Nc();
106  int Nvol = CommonParameters::Nvol();
107  int Ndim = CommonParameters::Ndim();
108  int NinG = 2 * Nc * Nc;
109 
110  Field_G force(Nvol, Ndim);
111  Field_G force1(Nvol, Ndim);
112  Mat_SU_N ut(Nc);
113 
114 
115  force1 = force_udiv(eta);
116 
117  for (int mu = 0; mu < Ndim; ++mu) {
118  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
119  force.at_Field_G(mu);
120  }
121  force *= -2.0;
122 
123  return (Field)force;
124 }
125 
126 
127 //====================================================================
129  const Field& eta)
130 {
131  int Nc = CommonParameters::Nc();
132  int Nvol = CommonParameters::Nvol();
133  int Ndim = CommonParameters::Ndim();
134  int NinG = 2 * Nc * Nc;
135 
136  Field_G force(Nvol, Ndim);
137  Field_G force1(Nvol, Ndim);
138  Mat_SU_N ut(Nc);
139 
140  force1 = force_udiv1(zeta, eta);
141 
142  for (int mu = 0; mu < Ndim; ++mu) {
143  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
144  force.at_Field_G(mu);
145  }
146  force *= -2.0;
147 
148  return (Field)force;
149 }
150 
151 
152 //====================================================================
154 {
155  int Nc = CommonParameters::Nc();
156  int Nd = CommonParameters::Nd();
157  int Nvol = CommonParameters::Nvol();
158  int Ndim = CommonParameters::Ndim();
159 
160  Field_G force(Nvol, Ndim);
161  Field_G force1(Nvol, Ndim);
162 
163  Field_F zeta(Nvol, 1);
164 
165  m_fopr_tw->set_mode("H");
166  zeta = (Field_F)m_fopr_tw->mult(eta);
167 
168  force = (Field_G)force_udiv1(zeta, (Field_F)eta);
169  force1 = (Field_G)force_udiv1((Field_F)eta, zeta);
170  force += force1;
171 
172  return (Field)force;
173 }
174 
175 
176 //====================================================================
178  const Field& eta)
179 {
180  return force_udiv1((Field_F)zeta, (Field_F)eta);
181 }
182 
183 
184 //====================================================================
186  const Field_F& eta)
187 {
188  int Nc = CommonParameters::Nc();
189  int Nd = CommonParameters::Nd();
190  int Nvol = CommonParameters::Nvol();
191  int Ndim = CommonParameters::Ndim();
192 
193  Field_G force(Nvol, Ndim);
194  Field_G force1(Nvol, 1);
195 
196  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
197  Mat_SU_N ut(Nc), ut2(Nc);
198  double utr, uti;
199 
200  for (int mu = 0; mu < Ndim; ++mu) {
201  eta2 = m_fopr_tw->mult_gm5p(mu, eta);
202  eta3.mult_Field_Gd(0, *m_U, mu, eta2, 0);
203  tensorProd_Field_F(force1, zeta, eta3);
204  force.setpart_ex(mu, force1, 0);
205  }
206 
207  force *= -m_kappa;
208 
209  return (Field)force;
210 }
211 
212 
213 //====================================================================
214 //============================================================END=====