CHROMA
photon_seqsrc_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct a photon sequential sources via LSZ reduction
3  */
4 
7 
8 namespace Chroma
9 {
10 
11  // Read parameters
12  void read(XMLReader& xml, const std::string& path, PhotonRhoSeqSourceEnv::Params& param)
13  {
15  param = tmp;
16  }
17 
18  // Writer
19  void write(XMLWriter& xml, const std::string& path, const PhotonRhoSeqSourceEnv::Params& param)
20  {
21  param.writeXML(xml, path);
22  }
23 
24 
25 
26 
27 
28  //! Meson sequential sources
29  /*! \ingroup hadron */
30  namespace PhotonRhoSeqSourceEnv
31  {
32  //! Anonymous namespace
33  namespace
34  {
35  //! Construct pion-photon sequential source
36  /*!
37  * \ingroup hadron
38  */
39  HadronSeqSource<LatticePropagator>* mesPionPhotonSeqSrc(XMLReader& xml_in,
40  const std::string& path)
41  {
42  return new PhotonRhoSeqSource(Params(xml_in, path));
43  }
44 
45  //! Construct pion-point_split_photon sequential source
46  /*!
47  * \ingroup hadron
48  */
49  HadronSeqSource<LatticePropagator>* mesPionPointSplitPhotonSeqSrc(XMLReader& xml_in,
50  const std::string& path)
51  {
52  return new PointSplitPhotonRhoSeqSource(Params(xml_in, path));
53  }
54 
55 
56  //! Local registration flag
57  bool registered = false;
58 
59  } // end anonymous namespace
60 
61 
62  //! Initialize
64  {
65  Q_sq = zero;
66  c_sq = 1.0;
67  xi = 1.0;
68  pol_dir = -1;
69  j_decay = -1;
70  t_sink = -1;
71  t_sink_start = -1;
72  t_sink_end = -1;
73  sink_mom.resize(Nd-1);
74  sink_mom = 0;
75  }
76 
77 
78  //! Read parameters
79  Params::Params(XMLReader& xml, const std::string& path)
80  {
81  XMLReader paramtop(xml, path);
82 
83  int version;
84  read(paramtop, "version", version);
85 
86  switch (version)
87  {
88  case 1:
89  break;
90 
91  default:
92  QDPIO::cerr << __func__ << ": parameter version " << version
93  << " unsupported." << std::endl;
94  QDP_abort(1);
95  }
96 
97  read(paramtop, "Q_sq", Q_sq);
98  read(paramtop, "c_sq", c_sq);
99  read(paramtop, "xi", xi);
100  read(paramtop, "pol_dir", pol_dir);
101  read(paramtop, "j_decay", j_decay);
102  read(paramtop, "sink_mom", sink_mom);
103  read(paramtop, "t_sink_start", t_sink_start);
104  read(paramtop, "t_sink_end", t_sink_end);
105  }
106 
107 
108  // Writer
109  void Params::writeXML(XMLWriter& xml, const std::string& path) const
110  {
111  push(xml, path);
112 
113  int version = 1;
114  write(xml, "version", version);
115 
116  write(xml, "Q_sq", Q_sq);
117  write(xml, "c_sq", c_sq);
118  write(xml, "xi", xi);
119  write(xml, "pol_dir", pol_dir);
120  write(xml, "j_decay", j_decay);
121  write(xml, "t_sink_start", t_sink_start);
122  write(xml, "t_sink_end", t_sink_end);
123  write(xml, "t_sink", t_sink);
124  write(xml, "sink_mom", sink_mom);
125  pop(xml);
126  }
127 
128 
129  //! Construct the source
130  LatticePropagator
131  PhotonRhoSeqSource::operator()(const multi1d<LatticeColorMatrix>& u,
132  const multi1d<ForwardProp_t>& forward_headers,
133  const multi1d<LatticePropagator>& quark_propagators)
134  {
135  START_CODE();
136 
137  QDPIO::cout << "Photon sequential source " << std::endl;
139 
140  if (quark_propagators.size() != 1)
141  {
142  QDPIO::cerr << __func__ << ": expect only 1 prop" << std::endl;
143  QDP_abort(1);
144  }
145 
146  if (params.j_decay < 0 || params.j_decay >= Nd)
147  {
148  QDPIO::cerr << __func__ << ": j_decay out of bounds: j_decay = " << params.j_decay << std::endl;
149  QDP_abort(1);
150  }
151 
152  if (params.pol_dir < 0 || params.pol_dir >= Nd)
153  {
154  QDPIO::cerr << __func__ << ": pol_dir out of bounds: pol_dir = " << params.pol_dir << std::endl;
155  QDP_abort(1);
156  }
157 
158  // Initial sequential source
159  LatticePropagator seq_src_tmp;
160  {
161  int G5 = Ns*Ns-1;
162  LatticePropagator tmp = adj(quark_propagators[0]) * Gamma(G5) * Gamma(1 << params.pol_dir);
163 
164  // Now take hermitian conjugate and multiply on both sides with gamma_5 = Gamma(15)
165  seq_src_tmp = Gamma(15) * adj(tmp) * Gamma(15);
166  }
167 
168  // Compute 4-std::vector correction of sink phase and energy exp
169  LatticeComplex exp_p_dot_x;
170  LatticeBoolean mask;
171  {
172  LatticeReal p_dot_x = zero;
173  multi1d<Real> pp_f(Nd-1);
174  for(int mu=0, j=0; mu < Nd; mu++)
175  {
176  if (mu != params.j_decay)
177  {
178  pp_f[j] = params.sink_mom[j] * twopi / Real(Layout::lattSize()[mu]);
179 
180  if (params.sink_mom[j] != 0)
181  p_dot_x += (Layout::latticeCoordinate(mu) - getTSrce()[mu]) * pp_f[j];
182 
183  j++;
184  }
185  }
186 
187  // Spatial contribution is solely a phase
188  exp_p_dot_x = cmplx(cos(p_dot_x),sin(p_dot_x));
189 
190  // Photon energy determined from virtuality, \f$Q_f^2 = c^2|\vec{p_f}|^2 - \omega_f^2\f$
191  Real omega;
192  {
193  Real norm2_ppf = zero;
194  for(int i=0; i < pp_f.size(); ++i)
195  norm2_ppf += pp_f[i] * pp_f[i];
196 
197  Real c_sq = params.c_sq;
198  Real xi = params.xi;
199  Real xi_sq = xi * xi;
200 
201  omega = sqrt( Real(c_sq/xi_sq)*norm2_ppf - params.Q_sq );
202  }
203  QDPIO::cout << __func__ << ": omega= " << omega << std::endl;
204 
205  // Multiply in exp from time dependence of 4-std::vector
206  // Note positive sign of omega
207  exp_p_dot_x *= exp(omega * Layout::latticeCoordinate(params.j_decay));
208 
209  // Zap any regions in time outside integration region
210  mask = where((Layout::latticeCoordinate(params.j_decay) >= params.t_sink_start) &&
211  (Layout::latticeCoordinate(params.j_decay) <= params.t_sink_end),
212  true, false);
213  }
214 
215 
216  // Multiply in by exp(4-std::vector)
217  LatticePropagator fin = where(mask,
218  exp_p_dot_x * seq_src_tmp,
219  LatticePropagator(zero));
220 
221  END_CODE();
222 
223  return fin;
224  }
225 
226 
227  //! Construct the source
228  LatticePropagator
229  PointSplitPhotonRhoSeqSource::operator()(const multi1d<LatticeColorMatrix>& u,
230  const multi1d<ForwardProp_t>& forward_headers,
231  const multi1d<LatticePropagator>& quark_propagators)
232  {
233  START_CODE();
234 
235  QDPIO::cout << "Point split photon sequential source " << std::endl;
237 
238  if (quark_propagators.size() != 1)
239  {
240  QDPIO::cerr << __func__ << ": expect only 1 prop" << std::endl;
241  QDP_abort(1);
242  }
243 
244  if (params.j_decay < 0 || params.j_decay >= Nd)
245  {
246  QDPIO::cerr << __func__ << ": j_decay out of bounds: j_decay = " << params.j_decay << std::endl;
247  QDP_abort(1);
248  }
249 
250  if (params.pol_dir < 0 || params.pol_dir >= Nd)
251  {
252  QDPIO::cerr << __func__ << ": pol_dir out of bounds: pol_dir = " << params.pol_dir << std::endl;
253  QDP_abort(1);
254  }
255 
256  // Initial sequential source
257  LatticePropagator seq_src_f, seq_src_b;
258  {
259  // Spin projectors
260  SpinMatrix P_plus, P_minus;
261  {
262  SpinMatrix g_one = 1.0;
263  int jd = 1 << params.pol_dir;
264 
265  P_plus = 0.5*(g_one + (Gamma(jd) * g_one));
266  P_minus = 0.5*(g_one - (Gamma(jd) * g_one));
267  }
268  int dir = params.pol_dir;
269 
270  seq_src_f = P_minus * (u[dir] * shift(quark_propagators[0], FORWARD, dir));
271  seq_src_b = P_plus * shift(adj(u[dir]) * quark_propagators[0], BACKWARD, dir);
272  }
273 
274  // Compute 4-std::vector correction of sink phase and energy exp
275  LatticeComplex exp_p_dot_x_f, exp_p_dot_x_b;
276  {
277  LatticeReal p_dot_x = zero;
278  multi1d<Real> pp_f(Nd-1);
279  for(int mu=0, j=0; mu < Nd; mu++)
280  {
281  if (mu != params.j_decay)
282  {
283  pp_f[j] = params.sink_mom[j] * twopi / Real(Layout::lattSize()[mu]);
284 
285  if (params.sink_mom[j] != 0)
286  p_dot_x += (Layout::latticeCoordinate(mu) - getTSrce()[mu]) * pp_f[j];
287 
288  j++;
289  }
290  }
291 
292  // Spatial contribution is solely a phase
293  LatticeComplex exp_p_dot_x = cmplx(cos(p_dot_x),sin(p_dot_x));
294 
295  // Photon energy determined from virtuality, \f$Q_f^2 = c^2|\vec{p_f}|^2 - \omega_f^2\f$
296  Real omega;
297  {
298  Real norm2_ppf = zero;
299  for(int i=0; i < pp_f.size(); ++i)
300  norm2_ppf += pp_f[i] * pp_f[i];
301 
302  Real c_sq = params.c_sq;
303  Real xi = params.xi;
304  Real xi_sq = xi * xi;
305 
306  omega = sqrt( Real(c_sq/xi_sq)*norm2_ppf - params.Q_sq );
307  }
308  QDPIO::cout << __func__ << ": omega= " << omega << std::endl;
309 
310  // Multiply in exp from time dependence of 4-std::vector
311  // Note positive sign of omega
312  exp_p_dot_x *= exp(omega * Layout::latticeCoordinate(params.j_decay));
313 
314  // Zap any regions in time outside integration region
315  exp_p_dot_x_f = where((Layout::latticeCoordinate(params.j_decay) >= params.t_sink_start) &&
316  (Layout::latticeCoordinate(params.j_decay) <= params.t_sink_end),
317  exp_p_dot_x, LatticeComplex(zero));
318 
319  exp_p_dot_x_b = exp_p_dot_x_f;
320 
321  if (params.pol_dir != params.j_decay)
322  {
323  if (params.sink_mom[params.pol_dir] != 0)
324  {
325  Real pp_f = - params.sink_mom[params.pol_dir] * twopi / Real(Layout::lattSize()[params.pol_dir]);
326  exp_p_dot_x_b *= cmplx(cos(pp_f),sin(pp_f));
327  }
328  }
329  else
330  {
331  exp_p_dot_x_b *= exp(-omega);
332  }
333  }
334 
335 
336  // Multiply in by exp(4-std::vector)
337  int G5 = Ns*Ns-1;
338  LatticePropagator fin = (exp_p_dot_x_f * seq_src_f - exp_p_dot_x_b * seq_src_b) * Gamma(G5);
339 
340  END_CODE();
341 
342  return fin;
343  }
344 
345 
346  //! Register all the factories
347  bool registerAll()
348  {
349  bool success = true;
350  if (! registered)
351  {
352  //! Register all the factories
353  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("PION-PHOTON"),
354  mesPionPhotonSeqSrc);
355 
356  //! Register all the factories
357  success &= Chroma::TheWilsonHadronSeqSourceFactory::Instance().registerObject(std::string("PION-POINT_SPLIT_PHOTON"),
358  mesPionPointSplitPhotonSeqSrc);
359 
360  registered = true;
361  }
362  return success;
363  }
364 
365  } // end namespace PhotonRhoSeqSourceEnv
366 
367 } // end namespace Chroma
368 
369 
370 
virtual void setTSrce(const multi1d< ForwardProp_t > &forward_headers)
Convenience function to yank the source location from the forward prop headers.
Construct the source LatticePropagator operator()(const multi1d< LatticeColorMatrix > &u, const multi1d< ForwardProp_t > &forward_headers, const multi1d< LatticePropagator > &forward_props)
Construct the source.
Set t_srce multi1d< int > & getTSrce()
Set t_srce.
Construct the source LatticePropagator operator()(const multi1d< LatticeColorMatrix > &u, const multi1d< ForwardProp_t > &forward_headers, const multi1d< LatticePropagator > &forward_props)
Construct the source.
Set t_srce multi1d< int > & getTSrce()
Set t_srce.
static T & Instance()
Definition: singleton.h:432
int mu
Definition: cool.cc:24
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.
unsigned j
Definition: ldumul_w.cc:35
int j_decay
Definition: meslate.cc:22
Nd
Definition: meslate.cc:74
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
multi1d< ForwardProp_t > & forward_headers
multi1d< LatticePropagator > & quark_propagators
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")
int i
Definition: pbg5p_w.cc:55
const Real twopi
Definition: chromabase.h:55
Complex omega
Definition: invbicg.cc:97
pop(xml_out)
START_CODE()
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
Construct a photon sequential sources via LSZ reduction.
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Factory for producing quark prop sinks.
Construct a photon sequential sources via LSZ reduction.
void writeXML(XMLWriter &in, const std::string &path) const