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