CHROMA
hadron_seqsource.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct hadron sequential sources
3  */
4 
5 #include "util/ft/single_phase.h"
8 
9 namespace Chroma
10 {
11 
12  //! Anonymous namespace
13  /*! @ingroup hadron */
14  namespace
15  {
16  //! Construct hadron sequential sources
17  /*! @ingroup hadron */
18  template<typename T>
19  T hadSeqSourceProject(const T& source_prop,
20  int t_sink, int j_decay)
21  {
22  START_CODE();
23 
24  if (j_decay < 0 || j_decay >= Nd)
25  {
26  QDPIO::cerr << __func__ << ": j_decay out of bounds" << std::endl;
27  QDP_abort(1);
28  }
29 
30  /*
31  * Now mask out all but sink time slice
32  */
33  T seq_src_prop = where(Layout::latticeCoordinate(j_decay) == t_sink,
34  source_prop,
35  T(zero));
36 
37  END_CODE();
38 
39  return seq_src_prop;
40  }
41 
42 
43  //! Get source location
44  multi1d<int>
45  hadSeqSourceGetTSrce(const multi1d<ForwardProp_t>& forward_headers)
46  {
47  multi1d<int> t_srce = forward_headers[0].source_header.getTSrce();
48 
49  for(int loop=1; loop < forward_headers.size(); ++loop)
50  {
51  multi1d<int> t_srce_b = forward_headers[loop].source_header.getTSrce();
52 
53  // Bummer, I wish qdp++ had a multi1d.operator!=()
54  bool same = true;
55  for(int i=0; i < t_srce.size(); ++i)
56  {
57  if (t_srce_b[i] != t_srce[i])
58  same = false;
59  }
60 
61  if (! same)
62  {
63  QDPIO::cerr << __func__ << ": the t_srce in the forward props are not all equal"
64  << std::endl;
65  QDP_abort(1);
66  }
67  }
68 
69  return t_srce;
70  }
71 
72 
73  }
74 
75 
76  // Default versions
77  template<>
78  Complex
79  HadronSeqSource<LatticePropagator>::tieBack(const multi1d<LatticeColorMatrix>& u,
80  const SequentialProp_t& seqprop_header,
81  const LatticePropagator& seqprop,
82  int gamma_insertion)
83  {
84  getTSrce() = hadSeqSourceGetTSrce(seqprop_header.forward_props);
85  LatticeComplex tr = trace(gamma5Herm(seqprop) * Gamma(gamma_insertion));
86  Complex seq_src_value = peekSite(tr, getTSrce());
87  return seq_src_value;
88  }
89 
90 
91  // Default versions
92  template<>
93  LatticePropagator
95  {
96  return hadSeqSourceProject<LatticePropagator>(src_prop_tmp,
97  getTSink(), getDecayDir());
98  }
99 
100 
101  // Default versions
102  template<>
103  LatticeComplex
105  {
106  return singlePhase(getTSrce(), getSinkMom(), getDecayDir());
107  }
108 
109 
110  // Default versions
111  template<>
112  void
114  {
115  getTSrce() = hadSeqSourceGetTSrce(forward_headers);
116  }
117 
118  // Any other fermion types, like staggered can go here
119 
120 
121 } // end namespace Chroma
Construct hadron sequential sources.
virtual Complex tieBack(const multi1d< LatticeColorMatrix > &u, const SequentialProp_t &seqprop_header, const T &seqprop, int gamma_insertion)
Evaluate the seqprop back at the source - this is the 2-pt at the sink.
Gamma5 hermiticity.
LatticePropagator gamma5Herm(const LatticePropagator &source_prop)
Return gamma_5*adj(source)*gamma_f.
LatticeComplex singlePhase(const multi1d< int > &t_srce, const multi1d< int > &sink_mom, int j_decay)
A single exp(ip.x) phase used in hadron construction.
Definition: single_phase.cc:13
Construct hadron sequential sources.
multi1d< int > t_srce
int j_decay
Definition: meslate.cc:22
Nd
Definition: meslate.cc:74
multi1d< ForwardProp_t > & forward_headers
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::T T
int i
Definition: pbg5p_w.cc:55
START_CODE()
Double zero
Definition: invbicg.cc:106
Compute a single phase factor.
Mega structure holding a full sequential prop.
Definition: qprop_io.h:140
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:144
LatticeFermion T
Definition: t_clover.cc:11