Bridge++  Version 1.5.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_IMP_INCLUDED
15 #define FOPR_WILSON_IMPL_IMP_INCLUDED
16 
17 //#include "Fopr/fopr_Wilson.h"
18 #include "Fopr/fopr.h"
19 
20 #include "Field/shiftField_lex.h"
21 #include "Tools/gammaMatrixSet.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_boundary_each_node;
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  Fopr_Wilson() { init("Dirac"); }
77  Fopr_Wilson(const std::string repr) { init(repr); }
78 
80 
81  void init(const std::string repr);
82 
83  void tidyup();
84 
85  void set_parameters(const Parameters& params);
86  void set_parameters(const double kappa, const std::vector<int> bc);
87 
88  void set_config(Field *U)
89  { m_U = (Field_G *)U; }
90 
92  { return set_config(U.get()); }
93 
94  void set_mode(const std::string mode);
95 
96  std::string get_mode() const;
97 
98  inline void mult(Field& v, const Field& f)
99  { (this->*m_mult)(v, f); }
100 
101  inline void mult_dag(Field& v, const Field& f)
102  { (this->*m_mult_dag)(v, f); }
103 
104  inline void mult_gm5(Field& v, const Field& f)
105  { (this->*m_gm5)(v, f); }
106 
107  inline void D(Field& v, const Field& f)
108  { (this->*m_D)(v, f); }
109 
110  inline void Ddag(Field& w, const Field& f)
111  {
112  mult_gm5(w, f);
113  D(m_w1, w);
114  mult_gm5(w, m_w1);
115  }
116 
117  inline void DdagD(Field& w, const Field& f)
118  {
119  D(m_w1, f);
120 
121  // Ddag(w, m_w1);
122  mult_gm5(w, m_w1);
123  D(m_w1, w);
124  mult_gm5(w, m_w1);
125  }
126 
127  inline void DDdag(Field& w, const Field& f)
128  {
129  // Ddag(m_w1, f);
130  mult_gm5(m_w1, f);
131  D(w, m_w1);
132  mult_gm5(m_w1, w);
133 
134  D(w, m_w1);
135  }
136 
137  inline void H(Field& w, const Field& f)
138  {
139  D(m_w1, f);
140  mult_gm5(w, m_w1);
141  }
142 
143  inline void mult_undef(Field&, const Field& f)
144  {
145  vout.crucial(m_vl, "Error at Fopr_Wilson: mode undefined.\n");
146  exit(EXIT_FAILURE);
147  }
148 
149  inline void D_ex(Field& v, const int ex1,
150  const Field& f, const int ex2)
151  { (this->*m_D_ex)(v, ex1, f, ex2); }
152 
153  const Field_F mult_gm5p(const int mu, const Field_F& w)
154  {
155  mult_gm5p(mu, m_w1, w);
156  return (Field_F)m_w1;
157  }
158 
159  void mult_gm5p(const int mu, Field&, const Field&);
160 
161  // void gm5p(Field_F& v, const int mu, const Field_F& w);
162 
163  void proj_chiral(Field& w, const int ex1,
164  const Field& v, const int ex2, const int ipm);
165 
166  void mult_up(const int mu, Field&, const Field&);
167  void mult_dn(const int mu, Field&, const Field&);
168 
170  { return CommonParameters::Nvol(); }
171  int field_nin()
172  { return 2 * CommonParameters::Nc() * CommonParameters::Nd(); }
173  int field_nex()
174  { return 1; }
175 
176  double flop_count();
177 
178  private:
179  // prohibit copy
182 
183  void (Fopr_Wilson::*m_mult)(Field&, const Field&);
184  void (Fopr_Wilson::*m_mult_dag)(Field&, const Field&);
185  void (Fopr_Wilson::*m_D)(Field&, const Field&);
186  void (Fopr_Wilson::*m_gm5)(Field&, const Field&);
187  void (Fopr_Wilson::*m_mult_tp)(Field&, const Field&);
188  void (Fopr_Wilson::*m_mult_tm)(Field&, const Field&);
189  void (Fopr_Wilson::*m_D_ex)(Field&, const int,
190  const Field&, const int);
191 
192  void D_chiral(Field&, const Field&);
193  void D_dirac(Field&, const Field&);
194  void gm5_chiral(Field&, const Field&);
195  void gm5_dirac(Field&, const Field&);
196 
197  void D_ex_chiral(Field&, const int ex1, const Field&, const int ex2);
198  void D_ex_dirac(Field&, const int ex1, const Field&, const int ex2);
199 
200  void mult_p(const int mu, Field_F&, const Field_F&);
201  void mult_m(const int mu, Field_F&, const Field_F&);
202 
203  void mult_xp(Field&, const Field&);
204  void mult_xm(Field&, const Field&);
205  void mult_yp(Field&, const Field&);
206  void mult_ym(Field&, const Field&);
207  void mult_zp(Field&, const Field&);
208  void mult_zm(Field&, const Field&);
209 
210  void mult_tp_dirac(Field&, const Field&);
211  void mult_tm_dirac(Field&, const Field&);
212  void mult_tp_chiral(Field&, const Field&);
213  void mult_tm_chiral(Field&, const Field&);
214 
215  void daypx(Field&, const double, const Field&);
216  void clear(Field&);
217 
218  // member data for threading
219  int m_Mz, m_Mt;
222 
223  struct mult_arg
224  {
225  int isite;
227  int kz0, kz1, kt0, kt1;
228  };
229  std::vector<mult_arg> m_arg;
230 
231  // member functions for threading
232  void setup_thread();
233  void mult_xp1_thread(const int, double *, const double *);
234  void mult_xp2_thread(const int, double *, const double *);
235  void mult_xpb_thread(const int, double *, const double *);
236  void mult_xm1_thread(const int, double *, const double *);
237  void mult_xm2_thread(const int, double *, const double *);
238  void mult_xmb_thread(const int, double *, const double *);
239 
240  void mult_yp1_thread(const int, double *, const double *);
241  void mult_yp2_thread(const int, double *, const double *);
242  void mult_ypb_thread(const int, double *, const double *);
243  void mult_ym1_thread(const int, double *, const double *);
244  void mult_ym2_thread(const int, double *, const double *);
245  void mult_ymb_thread(const int, double *, const double *);
246 
247  void mult_zp1_thread(const int, double *, const double *);
248  void mult_zp2_thread(const int, double *, const double *);
249  void mult_zpb_thread(const int, double *, const double *);
250  void mult_zm1_thread(const int, double *, const double *);
251  void mult_zm2_thread(const int, double *, const double *);
252  void mult_zmb_thread(const int, double *, const double *);
253 
254  void mult_tp1_dirac_thread(const int, double *, const double *);
255  void mult_tp2_dirac_thread(const int, double *, const double *);
256  void mult_tpb_dirac_thread(const int, double *, const double *);
257  void mult_tm1_dirac_thread(const int, double *, const double *);
258  void mult_tm2_dirac_thread(const int, double *, const double *);
259  void mult_tmb_dirac_thread(const int, double *, const double *);
260 
261  void mult_tp1_chiral_thread(const int, double *, const double *);
262  void mult_tp2_chiral_thread(const int, double *, const double *);
263  void mult_tpb_chiral_thread(const int, double *, const double *);
264  void mult_tm1_chiral_thread(const int, double *, const double *);
265  void mult_tm2_chiral_thread(const int, double *, const double *);
266  void mult_tmb_chiral_thread(const int, double *, const double *);
267 
268  void daypx_thread(const int, double *, const double, const double *);
269 
270  void clear_thread(const int, double *);
271 
272  void gm5_dirac_thread(const int, double *, const double *);
273  void gm5_chiral_thread(const int, double *, const double *);
274 
275  // for derivatives
276  void mult_xpu(Field&, const Field&);
277  void mult_ypu(Field&, const Field&);
278  void mult_zpu(Field&, const Field&);
279  void mult_tpu_dirac(Field&, const Field&);
280  void mult_tpu_chiral(Field&, const Field&);
281 
282 #ifdef USE_FACTORY
283  private:
284  static Fopr *create_object()
285  {
286  return new Fopr_Wilson();
287  }
288 
289  static Fopr *create_object_with_repr(const std::string& repr)
290  {
291  return new Fopr_Wilson(repr);
292  }
293 
294  public:
295  static bool register_factory()
296  {
297  bool init1 = Fopr::Factory_noarg::Register("Wilson/Imp", create_object);
298  bool init2 = Fopr::Factory_string::Register("Wilson/Imp", create_object_with_repr);
299 
300  return init1 && init2;
301  }
302 #endif
303  };
304 }
305 #endif /* FOPR_WILSON_IMPL_IMP_INCLUDED */
void mult_tp_dirac(Field &, const Field &)
void mult_ypb_thread(const int, double *, const double *)
void Ddag(Field &w, const Field &f)
double flop_count()
returns the flop in giga unit
BridgeIO vout
Definition: bridgeIO.cpp:503
void mult_yp2_thread(const int, double *, const double *)
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 set_config(unique_ptr< Field_G > &U)
std::string m_repr
void init(const std::string repr)
void mult_xmb_thread(const int, double *, const double *)
void(Fopr_Wilson::* m_mult)(Field &, const Field &)
void mult_m(const int mu, Field_F &, const Field_F &)
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_tmb_chiral_thread(const int, double *, const double *)
void D_dirac(Field &, const Field &)
void(Fopr_Wilson::* m_mult_tp)(Field &, const Field &)
void mult_zpu(Field &, const Field &)
void mult_yp(Field &, const Field &)
void mult_yp1_thread(const int, double *, const double *)
void mult_xpb_thread(const int, double *, const double *)
Container of Field-type object.
Definition: field.h:45
void gm5_chiral(Field &, const Field &)
std::vector< double > m_boundary_each_node
b.c. for each node.
void mult_tm_chiral(Field &, const Field &)
void D(Field &v, const Field &f)
void mult_tp1_chiral_thread(const int, double *, const double *)
double * vcp1_xp
arrays for data transfer.
Bridge::VerboseLevel m_vl
void clear_thread(const int, 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_tpb_chiral_thread(const 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_tpb_dirac_thread(const int, double *, const double *)
void mult_zm2_thread(const 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 mult_tp1_dirac_thread(const int, double *, const double *)
void mult_zp2_thread(const int, double *, const double *)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_xm1_thread(const int, double *, const double *)
void gm5_chiral_thread(const int, double *, const double *)
void mult_xp2_thread(const int, double *, const double *)
SU(N) gauge field.
Definition: field_G.h:38
void mult_zmb_thread(const int, double *, const double *)
void mult_ymb_thread(const int, double *, const double *)
const Field_F mult_gm5p(const int mu, const Field_F &w)
void mult_tp_chiral(Field &, const Field &)
void daypx_thread(const int, double *, const double, const double *)
std::vector< int > m_boundary
boundary condition.
void D_chiral(Field &, const Field &)
void mult_tm2_dirac_thread(const int, double *, const double *)
void mult_tm1_chiral_thread(const int, double *, const double *)
void mult_xp1_thread(const 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 mult_tmb_dirac_thread(const int, double *, const double *)
void mult_tm1_dirac_thread(const int, double *, const double *)
void mult_tp2_dirac_thread(const int, double *, const double *)
int field_nex()
returns the external d.o.f. for which the fermion operator is defined.
void gm5_dirac_thread(const int, double *, const double *)
void mult_zm1_thread(const int, double *, const double *)
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 &)
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Fopr_Wilson(const Fopr_Wilson &)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_p(const int mu, Field_F &, const Field_F &)
void mult_undef(Field &, const Field &f)
void mult_tm2_chiral_thread(const int, double *, const double *)
Fopr_Wilson(const std::string repr)
void set_config(Field *U)
setting pointer to the gauge configuration.
VerboseLevel
Definition: bridgeIO.h:42
void mult_ym(Field &, const Field &)
void mult_up(const int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void mult_dn(const int mu, Field &, const Field &)
void mult_ym2_thread(const int, double *, const double *)
void mult_tp2_chiral_thread(const int, double *, const 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(Fopr_Wilson::* m_mult_tm)(Field &, const Field &)
std::string get_mode() const
only for Fopr_Overlap
void mult_xm2_thread(const int, double *, const double *)
void mult_zp1_thread(const int, double *, const double *)
Base class of fermion operator family.
Definition: fopr.h:46
void mult_xp(Field &, const Field &)
void mult_dag(Field &v, const Field &f)
hermitian conjugate of mult(Field&, const Field&).
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_zm(Field &, const Field &)
Fopr_Wilson & operator=(const Fopr_Wilson &)
void mult_zpb_thread(const int, double *, const double *)
Field m_w2
temporary fields.
void mult_ym1_thread(const int, double *, const double *)
void mult_xpu(Field &, const Field &)
void daypx(Field &, const double, const Field &)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
static const std::string class_name