Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_impl.h
Go to the documentation of this file.
1 
14 #ifndef FOPR_WILSON_IMPL_INCLUDED
15 #define FOPR_WILSON_IMPL_INCLUDED
16 
17 //#include "Fopr/fopr_Wilson.h"
18 #include "Fopr/fopr.h"
19 
20 #include "Tools/gammaMatrixSet.h"
21 #include "Field/shiftField_lex.h"
22 
23 #include "IO/bridgeIO.h"
24 using Bridge::vout;
25 
27 
42 namespace Imp {
43  class Fopr_Wilson : public Fopr
44  {
45  public:
46  static const std::string class_name;
47 
48  private:
49  // lattice parameters
50  int m_Nc, m_Nd, m_Nvc, m_Ndf;
51  int m_Nx, m_Ny, m_Nz, m_Nt;
52  int m_Nvol, m_Ndim;
53 
54  // physical parameters
55  double m_kappa;
56  std::vector<int> m_boundary;
57  std::vector<double> m_boundary2;
58 
59  const Field_G *m_U;
60  std::vector<GammaMatrix> m_GM;
61 
63 
64  std::string m_mode;
65  std::string m_repr;
66 
68 
70  double *vcp1_xp, *vcp2_xp, *vcp1_xm, *vcp2_xm;
71  double *vcp1_yp, *vcp2_yp, *vcp1_ym, *vcp2_ym;
72  double *vcp1_zp, *vcp2_zp, *vcp1_zm, *vcp2_zm;
73  double *vcp1_tp, *vcp2_tp, *vcp1_tm, *vcp2_tm;
74 
75  public:
76 
77  Fopr_Wilson() { init("Dirac"); }
78 
79  Fopr_Wilson(std::string repr) { init(repr); }
80 
82 
83  void init(std::string repr);
84 
85  void tidyup();
86 
87  void set_parameters(const Parameters& params);
88  void set_parameters(const double kappa, const std::vector<int> bc);
89 
90  void set_config(Field *U)
91  { m_U = (Field_G *)U; }
92 
94  { return set_config(U.get()); }
95 
96  void set_mode(std::string mode);
97 
98  std::string get_mode() const;
99 
100  inline void mult(Field& v, const Field& f)
101  { (this->*m_mult)(v, f); }
102 
103  inline void mult_dag(Field& v, const Field& f)
104  { (this->*m_mult_dag)(v, f); }
105 
106  inline void mult_gm5(Field& v, const Field& f)
107  { (this->*m_gm5)(v, f); }
108 
109  inline void D(Field& v, const Field& f)
110  { (this->*m_D)(v, f); }
111 
112  inline void Ddag(Field& w, const Field& f)
113  {
114  mult_gm5(w, f);
115  D(m_w1, w);
116  mult_gm5(w, m_w1);
117  }
118 
119  inline void DdagD(Field& w, const Field& f)
120  {
121  D(m_w1, f);
122 
123  // Ddag(w, m_w1);
124  mult_gm5(w, m_w1);
125  D(m_w1, w);
126  mult_gm5(w, m_w1);
127  }
128 
129  inline void DDdag(Field& w, const Field& f)
130  {
131  // Ddag(m_w1, f);
132  mult_gm5(m_w1, f);
133  D(w, m_w1);
134  mult_gm5(m_w1, w);
135 
136  D(w, m_w1);
137  }
138 
139  inline void H(Field& w, const Field& f)
140  {
141  D(m_w1, f);
142  mult_gm5(w, m_w1);
143  }
144 
145  inline void mult_undef(Field&, const Field& f)
146  {
147  vout.crucial(m_vl, "Error at Fopr_Wilson: mode undefined.\n");
148  exit(EXIT_FAILURE);
149  }
150 
151  inline void D_ex(Field& v, const int ex1,
152  const Field& f, const int ex2)
153  { (this->*m_D_ex)(v, ex1, f, ex2); }
154 
155  const Field_F mult_gm5p(int mu, const Field_F& w)
156  {
157  mult_gm5p(mu, m_w1, w);
158  return (Field_F)m_w1;
159  }
160 
161  void mult_gm5p(int mu, Field&, const Field&);
162 
163  // void gm5p(Field_F& v, const int mu, const Field_F& w);
164 
165  void proj_chiral(Field& w, const int ex1,
166  const Field& v, const int ex2, const int ipm);
167 
168  void mult_up(int mu, Field&, const Field&);
169  void mult_dn(int mu, Field&, const Field&);
170 
172  { return CommonParameters::Nvol(); }
173  int field_nin()
174  { return 2 * CommonParameters::Nc() * CommonParameters::Nd(); }
175  int field_nex()
176  { return 1; }
177 
178  double flop_count();
179 
180  inline void fprop_normalize(Field& v)
181  { scal(v, 2.0 * m_kappa); } //v *= (2.0 * m_kappa);
182 
183  inline void fopr_normalize(Field& v)
184  { scal(v, 1.0 / (2.0 * m_kappa)); } //v *= 1.0 / (2.0 * m_kappa);
185 
186  // const double get_fprop_normfactor(){ return 2.0 * m_kappa; }
187  // const double get_fopr_normfactor(){ return 1.0/(2.0 * m_kappa); }
188 
189  private:
190 
191  // prohibit copy
194 
195  void (Fopr_Wilson::*m_mult)(Field&, const Field&);
196  void (Fopr_Wilson::*m_mult_dag)(Field&, const Field&);
197  void (Fopr_Wilson::*m_D)(Field&, const Field&);
198  void (Fopr_Wilson::*m_gm5)(Field&, const Field&);
199  void (Fopr_Wilson::*m_mult_tp)(Field&, const Field&);
200  void (Fopr_Wilson::*m_mult_tm)(Field&, const Field&);
201  void (Fopr_Wilson::*m_D_ex)(Field&, const int,
202  const Field&, const int);
203 
204  void D_chiral(Field&, const Field&);
205  void D_dirac(Field&, const Field&);
206  void gm5_chiral(Field&, const Field&);
207  void gm5_dirac(Field&, const Field&);
208 
209  void D_ex_chiral(Field&, const int ex1, const Field&, const int ex2);
210  void D_ex_dirac(Field&, const int ex1, const Field&, const int ex2);
211 
212  void mult_p(int mu, Field_F&, const Field_F&);
213  void mult_m(int mu, Field_F&, const Field_F&);
214 
215  void mult_xp(Field&, const Field&);
216  void mult_xm(Field&, const Field&);
217  void mult_yp(Field&, const Field&);
218  void mult_ym(Field&, const Field&);
219  void mult_zp(Field&, const Field&);
220  void mult_zm(Field&, const Field&);
221 
222  void mult_tp_dirac(Field&, const Field&);
223  void mult_tm_dirac(Field&, const Field&);
224  void mult_tp_chiral(Field&, const Field&);
225  void mult_tm_chiral(Field&, const Field&);
226 
227  void daypx(Field&, double, const Field&);
228  void clear(Field&);
229 
230  // member data for threading
231  int m_Mz, m_Mt;
234 
235  struct mult_arg
236  {
237  int isite;
239  int kz0, kz1, kt0, kt1;
240  };
241  std::vector<mult_arg> m_arg;
242 
243  // member functions for threading
244  void setup_thread();
245  void mult_xp1_thread(int, double *, const double *);
246  void mult_xp2_thread(int, double *, const double *);
247  void mult_xpb_thread(int, double *, const double *);
248  void mult_xm1_thread(int, double *, const double *);
249  void mult_xm2_thread(int, double *, const double *);
250  void mult_xmb_thread(int, double *, const double *);
251  void mult_yp1_thread(int, double *, const double *);
252  void mult_yp2_thread(int, double *, const double *);
253  void mult_ypb_thread(int, double *, const double *);
254  void mult_ym1_thread(int, double *, const double *);
255  void mult_ym2_thread(int, double *, const double *);
256  void mult_ymb_thread(int, double *, const double *);
257  void mult_zp1_thread(int, double *, const double *);
258  void mult_zp2_thread(int, double *, const double *);
259  void mult_zpb_thread(int, double *, const double *);
260  void mult_zm1_thread(int, double *, const double *);
261  void mult_zm2_thread(int, double *, const double *);
262  void mult_zmb_thread(int, double *, const double *);
263  void mult_tp1_dirac_thread(int, double *, const double *);
264  void mult_tp2_dirac_thread(int, double *, const double *);
265  void mult_tpb_dirac_thread(int, double *, const double *);
266  void mult_tm1_dirac_thread(int, double *, const double *);
267  void mult_tm2_dirac_thread(int, double *, const double *);
268  void mult_tmb_dirac_thread(int, double *, const double *);
269  void mult_tp1_chiral_thread(int, double *, const double *);
270  void mult_tp2_chiral_thread(int, double *, const double *);
271  void mult_tpb_chiral_thread(int, double *, const double *);
272  void mult_tm1_chiral_thread(int, double *, const double *);
273  void mult_tm2_chiral_thread(int, double *, const double *);
274  void mult_tmb_chiral_thread(int, double *, const double *);
275  void daypx_thread(int, double *, double, const double *);
276  void clear_thread(int, double *);
277  void gm5_dirac_thread(int, double *, const double *);
278  void gm5_chiral_thread(int, double *, const double *);
279 
280  // for derivatives
281  void mult_xpu(Field&, const Field&);
282  void mult_ypu(Field&, const Field&);
283  void mult_zpu(Field&, const Field&);
284  void mult_tpu_dirac(Field&, const Field&);
285  void mult_tpu_chiral(Field&, const Field&);
286  };
287 }
288 #endif
void mult_tp_dirac(Field &, const Field &)
void mult_zm1_thread(int, double *, const double *)
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
void mult_zpb_thread(int, double *, const double *)
void Ddag(Field &w, const Field &f)
void mult_ymb_thread(int, double *, const double *)
double flop_count()
returns the flops per site.
BridgeIO vout
Definition: bridgeIO.cpp:495
void mult_zp(Field &, const Field &)
void DDdag(Field &w, const Field &f)
void(Fopr_Wilson::* m_mult_dag)(Field &, const Field &)
int field_nin()
returns the on-site d.o.f. for which the fermion operator is defined.
void mult_tp2_chiral_thread(int, double *, const double *)
void set_config(unique_ptr< Field_G > &U)
std::string m_repr
void(Fopr_Wilson::* m_mult)(Field &, const Field &)
void proj_chiral(Field &w, const int ex1, const Field &v, const int ex2, const int ipm)
void(Fopr_Wilson::* m_gm5)(Field &, const Field &)
void mult_ym2_thread(int, double *, const double *)
void mult_zmb_thread(int, double *, const double *)
void D_dirac(Field &, const Field &)
void mult_xpb_thread(int, double *, const double *)
void(Fopr_Wilson::* m_mult_tp)(Field &, const Field &)
void mult_zpu(Field &, const Field &)
void mult_yp(Field &, const Field &)
void mult_p(int mu, Field_F &, const Field_F &)
Container of Field-type object.
Definition: field.h:39
void gm5_chiral(Field &, const Field &)
void mult_tm1_chiral_thread(int, double *, const double *)
void mult_tm_chiral(Field &, const Field &)
void D(Field &v, const Field &f)
const Field_F mult_gm5p(int mu, const Field_F &w)
double * vcp1_xp
arrays for data transfer.
Bridge::VerboseLevel m_vl
void gm5_chiral_thread(int, double *, const double *)
void mult_ypb_thread(int, double *, const double *)
void gm5_dirac(Field &, const Field &)
void(Fopr_Wilson::* m_D_ex)(Field &, const int, const Field &, const int)
const Field_G * m_U
gauge configuration.
void mult_tm1_dirac_thread(int, double *, const double *)
Class for parameters.
Definition: parameters.h:46
void(Fopr_Wilson::* m_D)(Field &, const Field &)
void mult_xm(Field &, const Field &)
void set_parameters(const Parameters &params)
void mult_tp1_chiral_thread(int, double *, const double *)
void D_ex(Field &v, const int ex1, const Field &f, const int ex2)
void mult_tpu_dirac(Field &, const Field &)
void gm5_dirac_thread(int, double *, const double *)
void mult_tmb_chiral_thread(int, double *, const double *)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_zp1_thread(int, double *, const double *)
void daypx(Field &, double, const Field &)
void mult_up(int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
SU(N) gauge field.
Definition: field_G.h:38
void mult_ym1_thread(int, double *, const double *)
void mult_tp_chiral(Field &, const Field &)
void daypx_thread(int, double *, double, const double *)
std::vector< int > m_boundary
boundary condition.
void D_chiral(Field &, const Field &)
void mult_xp1_thread(int, double *, const double *)
void mult_tpb_chiral_thread(int, double *, const double *)
void mult_tm2_dirac_thread(int, double *, const double *)
pointer get() const
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
std::vector< mult_arg > m_arg
void init(std::string repr)
int field_nex()
returns the external d.o.f. for which the fermion operator is defined.
std::string m_mode
void mult_ypu(Field &, const Field &)
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
void mult_tm_dirac(Field &, const Field &)
Fopr_Wilson(const Fopr_Wilson &)
void mult_m(int mu, Field_F &, const Field_F &)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_zp2_thread(int, double *, const double *)
std::vector< double > m_boundary2
b.c. for each node.
void mult_undef(Field &, const Field &f)
void mult_tm2_chiral_thread(int, double *, const double *)
void set_config(Field *U)
setting pointer to the gauge configuration.
void mult_tp2_dirac_thread(int, double *, const double *)
VerboseLevel
Definition: bridgeIO.h:42
void mult_ym(Field &, const Field &)
void mult_xm2_thread(int, double *, const double *)
void clear_thread(int, double *)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
void DdagD(Field &w, const Field &f)
int field_nvol()
returns the volume for which the fermion operator is defined.
void mult_tpu_chiral(Field &, const Field &)
void H(Field &w, const Field &f)
void mult_yp2_thread(int, double *, const double *)
void mult_xm1_thread(int, double *, const double *)
void(Fopr_Wilson::* m_mult_tm)(Field &, const Field &)
std::string get_mode() const
only for Fopr_Overlap
void fprop_normalize(Field &v)
void mult_tpb_dirac_thread(int, double *, const double *)
Base class of fermion operator family.
Definition: fopr.h:47
void mult_xp(Field &, const Field &)
void mult_dag(Field &v, const Field &f)
hermitian conjugate of mult(Field&, const Field&).
void mult_xmb_thread(int, double *, const double *)
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_zm(Field &, const Field &)
void mult_zm2_thread(int, double *, const double *)
Fopr_Wilson & operator=(const Fopr_Wilson &)
void mult_dn(int mu, Field &, const Field &)
Field m_w2
temporary fields.
void mult_tp1_dirac_thread(int, double *, const double *)
void fopr_normalize(Field &v)
void mult_xpu(Field &, const Field &)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_yp1_thread(int, double *, const double *)
void mult_tmb_dirac_thread(int, double *, const double *)
Fopr_Wilson(std::string repr)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
static const std::string class_name
void mult_xp2_thread(int, double *, const double *)