CHROMA
simple_meson_seqsrc_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct meson sequential sources.
3  */
4 
8 #include "util/ft/sftmom.h"
9 
10 namespace Chroma
11 {
12 
13  // Read parameters
14  void read(XMLReader& xml, const std::string& path, SimpleMesonSeqSourceEnv::Params& param)
15  {
17  param = tmp;
18  }
19 
20  // Writer
21  void write(XMLWriter& xml, const std::string& path, const SimpleMesonSeqSourceEnv::Params& param)
22  {
23  param.writeXML(xml, path);
24  }
25 
26 
27 
28 
29 
30  //! Meson sequential sources
31  /*! \ingroup hadron */
32  namespace SimpleMesonSeqSourceEnv
33  {
34  //! Anonymous namespace
35  namespace
36  {
37  //! Compute final gamma insertion
38  /*!
39  * \ingroup hadron
40  *
41  * \return \f I = $\gamma_5 * \Gamma_f^dag * \gamma_5\$
42  */
43  int sign_g5adjGfg5(int sink_insertion)
44  {
45  int sgn = 1;
46  // The algorithm simply counts bits. If sink_insertion has 1 or 2 bits, there is a
47  // sign change, 0, 3 or 4 bits no sign change.
48  int cnt = 0;
49  if ((sink_insertion & 1) != 0) cnt++;
50  if ((sink_insertion & 2) != 0) cnt++;
51  if ((sink_insertion & 4) != 0) cnt++;
52  if ((sink_insertion & 8) != 0) cnt++;
53 
54  switch (cnt)
55  {
56  case 0:
57  case 3:
58  case 4:
59  sgn = 1;
60  break;
61 
62  case 1:
63  case 2:
64  sgn = -1;
65  break;
66 
67  default:
68  QDPIO::cerr << __func__ << ": internal error - number of bits not supported" << std::endl;
69  QDP_abort(1);
70  }
71 
72  return sgn;
73  }
74 
75 
76  //! Construct the source
77  /*!
78  * \ingroup hadron
79  *
80  * \f$\gamma_5 * \Gamma(gamma_sink)^\dag * \gamma_5 * F\$
81  */
82  LatticePropagator mesA0XSeqSrc(const LatticePropagator& quark_prop, int gamma_sink)
83  {
84  START_CODE();
85 
86  QDPIO::cout << "Simple meson sequential source: gamma_sink = " << gamma_sink << std::endl;
87 
88  // \f$\gamma_5 * \Gamma_f^dag * \gamma_5 * F\$
89 // LatticePropagator fin = Gamma(G5) * adj(Gamma(gamma_sink)) * Gamma(G5) * quark_prop;
90 
91  LatticePropagator fin = sign_g5adjGfg5(gamma_sink) * (Gamma(gamma_sink) * quark_prop);
92 
93  END_CODE();
94 
95  return fin;
96  }
97 
98 
99  //-------------------- callback functions ---------------------------------------
100 
101  //! Construct a0-source a0-sink sequential source
102  /*!
103  * \ingroup hadron
104  *
105  * \return \f$\gamma_5 * \Gamma(0)^dag * \gamma_5 * F\$
106  */
107  HadronSeqSource<LatticePropagator>* mesA0A01SeqSrc(XMLReader& xml_in,
108  const std::string& path)
109  {
110  return new SimpleMesonSeqSource(Params(xml_in, path), 0); // a0 = 1
111  }
112 
113 
114  //! Construct a0-source rho_x_1-sink sequential source
115  /*!
116  * \ingroup hadron
117  *
118  * \return \f$\gamma_5 * \Gamma(1)^dag * \gamma_5 * F\$
119  */
120  HadronSeqSource<LatticePropagator>* mesA0RhoX1SeqSrc(XMLReader& xml_in,
121  const std::string& path)
122  {
123  return new SimpleMesonSeqSource(Params(xml_in, path), 1); // rho_x_1 = gam ma_1
124  }
125 
126 
127  //! Construct a0-source rho_y_1-sink sequential source
128  /*!
129  * \ingroup hadron
130  *
131  * \return \f$\gamma_5 * \Gamma(2)^dag * \gamma_5 * F\$
132  */
133  HadronSeqSource<LatticePropagator>* mesA0RhoY1SeqSrc(XMLReader& xml_in,
134  const std::string& path)
135  {
136  return new SimpleMesonSeqSource(Params(xml_in, path), 2); // rho_y_1 = gamma_2
137  }
138 
139 
140  //! Construct a0-source b1_z_1-sink sequential source
141  /*!
142  * \ingroup hadron
143  *
144  * \return \f$\gamma_5 * \Gamma(3)^dag * \gamma_5 * F\$
145  */
146  HadronSeqSource<LatticePropagator>* mesA0B1Z1SeqSrc(XMLReader& xml_in,
147  const std::string& path)
148  {
149  return new SimpleMesonSeqSource(Params(xml_in, path), 3); // b1_z_1 = gamma_1*gamma_2
150  }
151 
152 
153  //! Construct a0-source rho_z_1-sink sequential source
154  /*!
155  * \ingroup hadron
156  *
157  * \return \f$\gamma_5 * \Gamma(4)^dag * \gamma_5 * F\$
158  */
159  HadronSeqSource<LatticePropagator>* mesA0RhoZ1SeqSrc(XMLReader& xml_in,
160  const std::string& path)
161  {
162  return new SimpleMesonSeqSource(Params(xml_in, path), 4); // rho_z_1 = gamma_3
163  }
164 
165 
166  //! Construct a0-source b1_y_1-sink sequential source
167  /*!
168  * \ingroup hadron
169  *
170  * \return \f$\gamma_5 * \Gamma(5)^dag * \gamma_5 * F\$
171  */
172  HadronSeqSource<LatticePropagator>* mesA01B1Y1SeqSrc(XMLReader& xml_in,
173  const std::string& path)
174  {
175  return new SimpleMesonSeqSource(Params(xml_in, path), 5); // b1_y_1 = gamma_1*gamma_3
176  }
177 
178 
179  //! Construct a0-source b1_x_1-sink sequential source
180  /*!
181  * \ingroup hadron
182  *
183  * \return \f$\gamma_5 * \Gamma(6)^dag * \gamma_5 * F\$
184  */
185  HadronSeqSource<LatticePropagator>* mesA01B1X1SeqSrc(XMLReader& xml_in,
186  const std::string& path)
187  {
188  return new SimpleMesonSeqSource(Params(xml_in, path), 6); // b1_x_1 = gamma_2*gamma_3
189  }
190 
191 
192  //! Construct a0-source pion_2-sink sequential source
193  /*!
194  * \ingroup hadron
195  *
196  * \return \f$\gamma_5 * \Gamma(7)^dag * \gamma_5 * F\$
197  */
198  HadronSeqSource<LatticePropagator>* mesA01Pion2SeqSrc(XMLReader& xml_in,
199  const std::string& path)
200  {
201  return new SimpleMesonSeqSource(Params(xml_in, path), 7); // pion_2 = gamma_4*gamma_5
202  }
203 
204 
205  //! Construct a0-source a0_2-sink sequential source
206  /*!
207  * \ingroup hadron
208  *
209  * \return \f$\gamma_5 * \Gamma(8)^dag * \gamma_5 * F\$
210  */
211  HadronSeqSource<LatticePropagator>* mesA0A02SeqSrc(XMLReader& xml_in,
212  const std::string& path)
213  {
214  return new SimpleMesonSeqSource(Params(xml_in, path), 8); // a0_2 = gamma_4
215  }
216 
217 
218  //! Construct a0-source rho_x_2-sink sequential source
219  /*!
220  * \ingroup hadron
221  *
222  * \return \f$\gamma_5 * \Gamma(9)^dag * \gamma_5 * F\$
223  */
224  HadronSeqSource<LatticePropagator>* mesA0RhoX2SeqSrc(XMLReader& xml_in,
225  const std::string& path)
226  {
227  return new SimpleMesonSeqSource(Params(xml_in, path), 9); // rho_x_2 = gamma_4 * gamma_1
228  }
229 
230 
231  //! Construct a0-source rho_y_2-sink sequential source
232  /*!
233  * \ingroup hadron
234  *
235  * \return \f$\gamma_5 * \Gamma(10)^dag * \gamma_5 * F\$
236  */
237  HadronSeqSource<LatticePropagator>* mesA0RhoY2SeqSrc(XMLReader& xml_in,
238  const std::string& path)
239  {
240  return new SimpleMesonSeqSource(Params(xml_in, path), 10); // rho_y_2 = gamma_4 * gamma_2
241  }
242 
243 
244  //! Construct a0-source a1_z_1-sink sequential source
245  /*!
246  * \ingroup hadron
247  *
248  * \return \f$\gamma_5 * \Gamma(11)^dag * \gamma_5 * F\$
249  */
250  HadronSeqSource<LatticePropagator>* mesA0A1Z1SeqSrc(XMLReader& xml_in,
251  const std::string& path)
252  {
253  return new SimpleMesonSeqSource(Params(xml_in, path), 11); // a1_z_1 = gamma_1 * gamma_2 * gamma_4
254  }
255 
256 
257  //! Construct a0-source rho_z_2-sink sequential source
258  /*!
259  * \ingroup hadron
260  *
261  * \return \f$\gamma_5 * \Gamma(12)^dag * \gamma_5 * F\$
262  */
263  HadronSeqSource<LatticePropagator>* mesA0RhoZ2SeqSrc(XMLReader& xml_in,
264  const std::string& path)
265  {
266  return new SimpleMesonSeqSource(Params(xml_in, path), 12); // rho_z_2 = gamma_4 * gamma_3
267  }
268 
269 
270  //! Construct a0-source a1_y_1-sink sequential source
271  /*!
272  * \ingroup hadron
273  *
274  * \return \f$\gamma_5 * \Gamma(13)^dag * \gamma_5 * F\$
275  */
276  HadronSeqSource<LatticePropagator>* mesA0A1Y1SeqSrc(XMLReader& xml_in,
277  const std::string& path)
278  {
279  return new SimpleMesonSeqSource(Params(xml_in, path), 13); // a1_y_1 = gamma_1 * gamma_3 * gamma_4
280  }
281 
282 
283  //! Construct a0-source a1_x_1-sink sequential source
284  /*!
285  * \ingroup hadron
286  *
287  * \return \f$\gamma_5 * \Gamma(14)^dag * \gamma_5 * F\$
288  */
289  HadronSeqSource<LatticePropagator>* mesA0A1X1SeqSrc(XMLReader& xml_in,
290  const std::string& path)
291  {
292  return new SimpleMesonSeqSource(Params(xml_in, path), 14); // a1_x_1 = gamma_2*gamma_3*gamma_4
293  }
294 
295 
296  //! Construct pion sequential source
297  /*!
298  * \ingroup hadron
299  *
300  * \return \f$\gamma_5 * \Gamma(15)^dag * \gamma_5 * F\$
301  */
302  HadronSeqSource<LatticePropagator>* mesA0Pion1SeqSrc(XMLReader& xml_in,
303  const std::string& path)
304  {
305  return new SimpleMesonSeqSource(Params(xml_in, path), 15); // pion_1 = gamma_5
306  }
307 
308 
309  //! Construct pion-source pion-sink
310  /*!
311  * \ingroup hadron
312  *
313  * \return \f$\gamma_5 * \Gamma(15)^dag * \gamma_5 * F * \gamma_5\$
314  */
315  HadronSeqSource<LatticePropagator>* mesPion1Pion1SeqSrc(XMLReader& xml_in,
316  const std::string& path)
317  {
318  return new PionPionSeqSource(Params(xml_in, path));
319  }
320 
321 
322  //! Local registration flag
323  bool registered = false;
324 
325  } // end anonymous namespace
326 
327 
328  //! Initialize
330  {
331  j_decay = -1;
332  t_sink = -1;
333  sink_mom.resize(Nd-1);
334  sink_mom = 0;
335  }
336 
337 
338  //! Read parameters
339  Params::Params(XMLReader& xml, const std::string& path)
340  {
341  XMLReader paramtop(xml, path);
342 
343  int version;
344  read(paramtop, "version", version);
345 
346  switch (version)
347  {
348  case 1:
349  break;
350 
351  default:
352  QDPIO::cerr << __func__ << ": parameter version " << version
353  << " unsupported." << std::endl;
354  QDP_abort(1);
355  }
356 
357  read(paramtop, "j_decay", j_decay);
358  read(paramtop, "t_sink", t_sink);
359  read(paramtop, "sink_mom", sink_mom);
360  }
361 
362 
363  // Writer
364  void Params::writeXML(XMLWriter& xml, const std::string& path) const
365  {
366  push(xml, path);
367 
368  int version = 1;
369  write(xml, "version", version);
370 
371  write(xml, "j_decay", j_decay);
372  write(xml, "t_sink", t_sink);
373  write(xml, "sink_mom", sink_mom);
374  pop(xml);
375  }
376 
377 
378  //! Construct the source
379  LatticePropagator
380  SimpleMesonSeqSource::operator()(const multi1d<LatticeColorMatrix>& u,
381  const multi1d<ForwardProp_t>& forward_headers,
382  const multi1d<LatticePropagator>& quark_propagators)
383  {
384  START_CODE();
385 
386  QDPIO::cout << "Simple meson sequential source: gamma_sink = " << gamma_sink << std::endl;
388 
389  if (quark_propagators.size() != 1)
390  {
391  QDPIO::cerr << __func__ << ": expect only 1 prop" << std::endl;
392  QDP_abort(1);
393  }
394 
395  // \f$\gamma_5 * \Gamma(gamma_sink)^dag * \gamma_5 * F\$
396 // LatticePropagator tmp = Gamma(G5) * adj(Gamma(gamma_sink)) * Gamma(G5) * quark_propagators[0];
397 
398 // int G5 = Ns*Ns-1;
399  LatticePropagator tmp = mesA0XSeqSrc(quark_propagators[0], gamma_sink);
400  LatticeComplex ph = conj(phases());
401  LatticePropagator fin = project(tmp * ph);
402 
403  END_CODE();
404 
405  return fin;
406  }
407 
408 
409  // Compute the 2-pt at the sink
410  Complex
411  SimpleMesonSeqSource::twoPtSink(const multi1d<LatticeColorMatrix>& u,
412  const multi1d<ForwardProp_t>& forward_headers,
413  const multi1d<LatticePropagator>& quark_propagators,
414  int gamma_insertion)
415  {
417 
418  if (quark_propagators.size() != 2)
419  {
420  QDPIO::cerr << __func__ << ": expect 2 props" << std::endl;
421  QDP_abort(1);
422  }
423 
424  // Construct the meson correlation function
425  LatticeComplex corr_fn =
426  trace(gamma5Herm(quark_propagators[1]) * (Gamma(gamma_sink) *
427  quark_propagators[0] * Gamma(gamma_insertion)));
428 
429  // Extract the sink at the appropriate momenta
430  SftMom sft(0, getTSrce(), getSinkMom(), false, getDecayDir());
431  multi2d<DComplex> hsum;
432  hsum = sft.sft(corr_fn);
433 
434  return hsum[0][getTSink()];
435  }
436 
437 
438  //! Construct the source
439  LatticePropagator
440  PionPionSeqSource::operator()(const multi1d<LatticeColorMatrix>& u,
441  const multi1d<ForwardProp_t>& forward_headers,
442  const multi1d<LatticePropagator>& quark_propagators)
443  {
444  START_CODE();
445 
446  QDPIO::cout << "Pion-Pion meson sequential source" << std::endl;
448 
449  if (quark_propagators.size() != 1)
450  {
451  QDPIO::cerr << __func__ << ": expect only 1 prop" << std::endl;
452  QDP_abort(1);
453  }
454 
455  // \f$\gamma_5 * \Gamma(gamma_sink)^dag * \gamma_5 * F * \gamma_5\$
456 // LatticePropagator tmp = Gamma(G5) * adj(Gamma(gamma_sink)) * Gamma(G5) * quark_propagators[0];
457 
458  int G5 = Ns*Ns-1;
459  LatticePropagator tmp = mesA0XSeqSrc(quark_propagators[0], G5) * Gamma(G5);
460  LatticeComplex ph = conj(phases());
461  LatticePropagator fin = project(tmp * ph);
462 
463  END_CODE();
464 
465  return fin;
466  }
467 
468 
469  // Compute the 2-pt at the sink
470  Complex
471  PionPionSeqSource::twoPtSink(const multi1d<LatticeColorMatrix>& u,
472  const multi1d<ForwardProp_t>& forward_headers,
473  const multi1d<LatticePropagator>& quark_propagators,
474  int gamma_insertion)
475  {
477 
478  if (quark_propagators.size() != 2)
479  {
480  QDPIO::cerr << __func__ << ": expect 2 props" << std::endl;
481  QDP_abort(1);
482  }
483 
484  // Convert gamma_insertion to old convention
485  int gamma_i = gamma_insertion ^ unsigned(Ns*Ns-1);
486  QDPIO::cout << __func__ << ": gamma_i=" << gamma_i << std::endl;
487 
488  // Construct the meson correlation function
489  LatticeComplex corr_fn =
490  trace(gamma5Herm(quark_propagators[1]) * (Gamma(Ns*Ns-1) *
491  quark_propagators[0] * Gamma(gamma_i)));
492 
493  // Extract the sink at the appropriate momenta
494  SftMom sft(0, getTSrce(), getSinkMom(), false, getDecayDir());
495  multi2d<DComplex> hsum;
496  hsum = sft.sft(corr_fn);
497 
498  return hsum[0][getTSink()];
499  }
500 
501 
502  //! Register all the factories
503  bool registerAll()
504  {
505  bool success = true;
506  if (! registered)
507  {
508  //! Register all the factories
509  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-a0"),
510  mesA0A01SeqSrc);
511 
512  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_x_1"),
513  mesA0RhoX1SeqSrc);
514 
515  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_y_1"),
516  mesA0RhoY1SeqSrc);
517 
518  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-b1_z"),
519  mesA0B1Z1SeqSrc);
520 
521  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_z_1"),
522  mesA0RhoZ1SeqSrc);
523 
524  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-b1_y"),
525  mesA01B1Y1SeqSrc);
526 
527  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-b1_x"),
528  mesA01B1X1SeqSrc);
529 
530  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-pion_2"),
531  mesA01Pion2SeqSrc);
532 
533  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-a0_2"),
534  mesA0A02SeqSrc);
535 
536  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_x_2"),
537  mesA0RhoX2SeqSrc);
538 
539  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_y_2"),
540  mesA0RhoY2SeqSrc);
541 
542  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-a1_z"),
543  mesA0A1Z1SeqSrc);
544 
545  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-rho_z_2"),
546  mesA0RhoZ2SeqSrc);
547 
548  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-a1_y"),
549  mesA0A1Y1SeqSrc);
550 
551  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-a1_x"),
552  mesA0A1X1SeqSrc);
553 
554  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("a0-pion_1"),
555  mesA0Pion1SeqSrc);
556 
557  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("pion_1-pion_1"),
558  mesPion1Pion1SeqSrc);
559 
560  // keep for historical purposes
561  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("pion"),
562  mesPion1Pion1SeqSrc);
563 
564  registered = true;
565  }
566  return success;
567  }
568 
569  } // end namespace SimpleMesonSeqSourceEnv
570 
571 } // end namespace Chroma
572 
573 
574 
virtual const multi1d< int > & getSinkMom() const=0
Get sink_mom.
virtual int getDecayDir() const=0
Get decay_dir.
virtual Complex twoPtSink(const multi1d< LatticeColorMatrix > &u, const multi1d< ForwardProp_t > &forward_headers, const multi1d< LatticePropagator > &forward_props, int gamma_insertion)=0
Compute the 2-pt at the sink.
virtual multi1d< int > & getTSrce()=0
Set t_srce.
virtual LatticePropagator project(const LatticePropagator &src_prop_tmp) const
Project onto a definite time-slice.
virtual LatticeComplex phases() const
Construct phases.
virtual int getTSink() const=0
Get t_sink.
virtual void setTSrce(const multi1d< ForwardProp_t > &forward_headers)
Convenience function to yank the source location from the forward prop headers.
virtual LatticePropagator operator()(const multi1d< LatticeColorMatrix > &u, const multi1d< ForwardProp_t > &forward_headers, const multi1d< LatticePropagator > &forward_props)=0
Construct the source.
Simple meson sequential source construction.
static T & Instance()
Definition: singleton.h:432
Gamma5 hermiticity.
LatticePropagator gamma5Herm(const LatticePropagator &source_prop)
Return gamma_5*adj(source)*gamma_f.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Nd
Definition: meslate.cc:74
static bool registered
Local registration flag.
multi1d< ForwardProp_t > & forward_headers
multi1d< LatticePropagator > & quark_propagators
Register all the factories bool registerAll()
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
Factory for producing quark prop sinks.
Fourier transform phase factor support.
Construct meson sequential sources.
Simple meson sequential source parameters.
void writeXML(XMLWriter &in, const std::string &path) const