Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
corr2pt_Wilson_SF.cpp
Go to the documentation of this file.
1 
14 #include "corr2pt_Wilson_SF.h"
15 
16 //====================================================================
17 
64 const std::string Corr2pt_Wilson_SF::class_name = "Corr2pt_Wilson_SF";
65 
66 //====================================================================
67 double Corr2pt_Wilson_SF::fAfP(const std::vector<Field_F>& sq1,
68  const std::vector<Field_F>& sq2)
69 {
70  int Lt = CommonParameters::Lt();
71 
72  std::vector<dcomplex> mcorr(Lt);
73  GammaMatrix qn_src, qn_sink;
74 
75  int Lvol = CommonParameters::Lvol();
76  int m_Nc = CommonParameters::Nc();
77  double norm = 0.5 / Lvol * Lt;
78 
79  // double norm=0.5/Lvol*Lt*(2*0.130*2*0.130);
80  // vout.general(m_vl,"norm=%lf\n",norm);
81 
82  vout.general(m_vl, "AO correlator:\n");
83 
84  qn_src = m_gmset->get_GM(m_gmset->GAMMA5);
85  qn_sink = m_gmset->get_GM(m_gmset->GAMMA54);
86 
87  meson_corr(mcorr, qn_sink, qn_src, sq1, sq1);
88 
89  for (int t = 0; t < mcorr.size(); ++t) {
90  vout.general(m_vl, "fA %4d %20.12e %20.12e\n",
91  t, -norm * real(mcorr[t]), -norm * imag(mcorr[t]));
92  }
93 
94 
95  vout.general(m_vl, "PO correlator:\n");
96 
97  qn_src = m_gmset->get_GM(m_gmset->GAMMA5);
98  qn_sink = m_gmset->get_GM(m_gmset->GAMMA5);
99  // qn_src = m_gmset->get_GM(m_gmset->UNITY);
100  // qn_sink = m_gmset->get_GM(m_gmset->UNITY);
101 
102  meson_corr(mcorr, qn_sink, qn_src, sq1, sq1);
103 
104  for (int t = 0; t < mcorr.size(); ++t) {
105  vout.general(m_vl, "fP %4d %20.12e %20.12e\n",
106  t, norm * real(mcorr[t]), norm * imag(mcorr[t]));
107  }
108 
109 
110  vout.general(m_vl, "AO' correlator:\n");
111 
112  qn_src = m_gmset->get_GM(m_gmset->GAMMA5);
113  qn_sink = m_gmset->get_GM(m_gmset->GAMMA54);
114 
115  meson_corr(mcorr, qn_sink, qn_src, sq2, sq2);
116 
117  for (int t = 0; t < mcorr.size(); ++t) {
118  vout.general(m_vl, "fA' %4d %20.12e %20.12e\n",
119  t, norm * real(mcorr[Lt - 1 - t]), norm * imag(mcorr[Lt - 1 - t]));
120  }
121 
122 
123  vout.general(m_vl, "PO' correlator:\n");
124 
125  qn_src = m_gmset->get_GM(m_gmset->GAMMA5);
126  qn_sink = m_gmset->get_GM(m_gmset->GAMMA5);
127  // qn_src = m_gmset->get_GM(m_gmset->UNITY);
128  // qn_sink = m_gmset->get_GM(m_gmset->UNITY);
129 
130  meson_corr(mcorr, qn_sink, qn_src, sq2, sq2);
131 
132  for (int t = 0; t < mcorr.size(); ++t) {
133  vout.general(m_vl, "fP' %4d %20.12e %20.12e\n",
134  t, norm * real(mcorr[Lt - 1 - t]), norm * imag(mcorr[Lt - 1 - t]));
135  }
136 
137 
138  //- NB. use meson correlator at t=1 for a non-trivial check.
139  // double result = real(mcorr[0]);
140  double result = real(mcorr[1]);
141 
142  return result;
143 }
144 
145 
146 //====================================================================
147 double Corr2pt_Wilson_SF::meson_corr(std::vector<dcomplex>& meson,
148  const GammaMatrix& qn_sink,
149  const GammaMatrix& qn_src,
150  const std::vector<Field_F>& sq1,
151  const std::vector<Field_F>& sq2)
152 {
153  int Nc = CommonParameters::Nc();
154  int Nd = CommonParameters::Nd();
155  int Nvol = CommonParameters::Nvol();
156  int Lt = CommonParameters::Lt();
157  int Nx = CommonParameters::Nx();
158  int Ny = CommonParameters::Ny();
159  int Nz = CommonParameters::Nz();
160  int Nt = CommonParameters::Nt();
161 
162  assert(meson.size() == Lt);
163 
164  GammaMatrix gm_src, gm_sink, gm5;
165  gm5 = m_gmset->get_GM(m_gmset->GAMMA5);
166  gm_src = qn_src.mult(gm5);
167  gm_sink = gm5.mult(qn_sink);
168 
169  Index_lex index;
170  valarray<dcomplex> corr_local(Nt);
171  valarray<double> corr_r(Nd), corr_i(Nd);
172 // std::vector<int> s2(Nd);
173 
174  Field corrF(2, Nvol, 2);
175 
176  corr_local = cmplx(0.0, 0.0);
177 
178  for (int c0 = 0; c0 < Nc; ++c0) {
179  for (int d0 = 0; d0 < Nd; ++d0) {
180  int d1 = gm_src.index(d0);
181  // int d1 = qn_src.index(d0);
182 
183  for (int t = 0; t < Nt; ++t) {
184  corr_r = 0.0;
185  corr_i = 0.0;
186  for (int z = 0; z < Nz; ++z) {
187  for (int y = 0; y < Ny; ++y) {
188  for (int x = 0; x < Nx; ++x) {
189  int site = index.site(x, y, z, t);
190 
191  for (int s0 = 0; s0 < Nd; ++s0) {
192  int s1 = gm_sink.index(s0);
193  //int s1 = qn_sink.index(s0);
194 
195  for (int c1 = 0; c1 < Nc; ++c1) {
196  corr_r[s0] += sq1[c0 + Nc * d0].cmp_r(c1, s1, site)
197  * sq2[c0 + Nc * d1].cmp_r(c1, s0, site)
198  + sq1[c0 + Nc * d0].cmp_i(c1, s1, site)
199  * sq2[c0 + Nc * d1].cmp_i(c1, s0, site);
200 
201  corr_i[s0] += sq1[c0 + Nc * d0].cmp_r(c1, s1, site)
202  * sq2[c0 + Nc * d1].cmp_i(c1, s0, site)
203  - sq1[c0 + Nc * d0].cmp_i(c1, s1, site)
204  * sq2[c0 + Nc * d1].cmp_r(c1, s0, site);
205  }
206  }
207  }
208  }
209  }
210  for (int s0 = 0; s0 < Nd; ++s0) {
211  dcomplex gmf = gm_src.value(d0) * gm_sink.value(s0);
212  //dcomplex gmf = qn_src.value(d0)*qn_sink.value(s0);
213  dcomplex corr = cmplx(corr_r[s0], corr_i[s0]);
214  corr_local[t] += gmf * corr;
215  //corr_local[t] += corr;
216  }
217  //vout.general(m_vl,"%d %lf %lf\n",t,real(corr_local[t]),imag(corr_local[t]));
218  }
219  }
220  }
221 
222  std::vector<dcomplex> corr_tmp(Lt);
223 
224  int ipet = Communicator::ipe(3);
225  for (int t = 0; t < Lt; ++t) {
226  corr_tmp[t] = cmplx(0.0, 0.0);
227  }
228  for (int t = 0; t < Nt; ++t) {
229  int t2 = t + ipet * Nt;
230  // vout.general(m_vl,"%d %d\n",t,t2);
231  corr_tmp[t2] = corr_local[t];
232  }
233  for (int t = 0; t < Lt; ++t) {
234  double crr = real(corr_tmp[t]);
235  double cri = imag(corr_tmp[t]);
236  crr = Communicator::reduce_sum(crr);
237  cri = Communicator::reduce_sum(cri);
238  meson[t] = cmplx(crr, cri);
239  // vout.general(m_vl,"%d %lf %lf\n",t,crr,cri);
240  }
241 
242 
243  //- NB. use meson correlator at t=1 for a non-trivial check.
244  // double result = real(mcorr[0]);
245  double result = real(meson[1]);
246 
247 
248  return result;
249 }
250 
251 
252 //====================================================================
253 //============================================================END=====
Bridge::VerboseLevel m_vl
BridgeIO vout
Definition: bridgeIO.cpp:495
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:53
double meson_corr(std::vector< dcomplex > &meson, const GammaMatrix &gm_sink, const GammaMatrix &gm_src, const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
GammaMatrix get_GM(GMspecies spec)
Container of Field-type object.
Definition: field.h:39
static int ipe(const int dir)
logical coordinate of current proc.
static int Lvol()
Gamma Matrix class.
Definition: gammaMatrix.h:44
double fAfP(const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2)
Lexical site index.
Definition: index_lex.h:34
GammaMatrix mult(GammaMatrix) const
Definition: gammaMatrix.cpp:39
GammaMatrixSet * m_gmset
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
static const std::string class_name