CHROMA
wallff_w.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Structures for wall-sink/source form-factors
4  *
5  * Form factors constructed from a quark and a wall sink
6  */
7 
8 #include "chromabase.h"
9 #include "meas/hadron/wallff_w.h"
10 
11 namespace Chroma {
12 
13 
14 //! Compute nonlocal current propagator
15 /*!
16  * \ingroup hadron
17  *
18  * The form of J_mu = (1/2)*[psibar(x+mu)*U^dag_mu*(1+gamma_mu)*psi(x) -
19  * psibar(x)*U_mu*(1-gamma_mu)*psi(x+mu)]
20  *
21  * \param u gauge fields ( Read )
22  * \param mu direction ( Read )
23  * \param forw_prop forward propagator ( Read )
24  * \param anti_prop anti-quark version of forward propagator ( Read )
25  *
26  * \return nonlocal current propagator
27  */
28 LatticePropagator nonlocalCurrentProp(const multi1d<LatticeColorMatrix>& u,
29  int mu,
30  const LatticePropagator& forw_prop,
31  const LatticePropagator& anti_prop)
32 {
33  int gamma_value = 1 << mu;
34 
35  LatticePropagator S = 0.5*(shift(anti_prop, FORWARD, mu) * adj(u[mu])
36  * (forw_prop + Gamma(gamma_value)*forw_prop)
37  - anti_prop * u[mu] * shift(forw_prop - Gamma(gamma_value)*forw_prop, FORWARD, mu));
38 
39  return S;
40 }
41 
42 
43 //! Do slow SFT over hadron correlator data
44 /*!
45  * \ingroup hadron
46  *
47  * \param momenta momenta structure ( Modify )
48  * \param corr_local_fn contracted local current insertion ( Read )
49  * \param corr_nonlocal_fn contracted nonlocal current insertion ( Read )
50  * \param phases fourier transform phase factors ( Read )
51  * \param compute_nonlocal compute the nonlocal current stuff?? ( Read )
52  * \param t0 time-slice of the source ( Read )
53  */
54 void wallFormFacSft(multi1d<WallFormFac_momenta_t>& momenta,
55  const LatticeComplex& corr_local_fn,
56  const LatticeComplex& corr_nonlocal_fn,
57  const SftMom& phases,
58  bool compute_nonlocal,
59  int t0)
60 {
61  START_CODE();
62 
63  momenta.resize(phases.numMom()); // hold momenta output
64 
65  // Length of lattice in decay direction and 3pt correlations fcns
66  int length = phases.numSubsets();
67 
68  multi2d<DComplex> hsum_local = phases.sft(corr_local_fn);
69  multi2d<DComplex> hsum_nonlocal;
70  if (compute_nonlocal)
71  hsum_nonlocal = phases.sft(corr_nonlocal_fn);
72 
73  // Loop over insertion momenta
74  for(int inser_mom_num=0; inser_mom_num < phases.numMom(); ++inser_mom_num)
75  {
76  momenta[inser_mom_num].inser_mom_num = inser_mom_num;
77  momenta[inser_mom_num].inser_mom = phases.numToMom(inser_mom_num);
78 
79  multi1d<Complex> local_cur3ptfn(length); // always compute
80  multi1d<Complex> nonlocal_cur3ptfn;
81  if (compute_nonlocal)
82  nonlocal_cur3ptfn.resize(length); // possibly compute
83 
84  for (int t=0; t < length; ++t)
85  {
86  int t_eff = (t - t0 + length) % length;
87 
88  local_cur3ptfn[t_eff] = Complex(hsum_local[inser_mom_num][t]);
89  if (compute_nonlocal)
90  nonlocal_cur3ptfn[t_eff] = Complex(hsum_nonlocal[inser_mom_num][t]);
91  } // end for(t)
92 
93  momenta[inser_mom_num].local_current = local_cur3ptfn;
94  momenta[inser_mom_num].nonlocal_current = nonlocal_cur3ptfn;
95 
96  } // end for(inser_mom_num)
97 
98  END_CODE();
99 }
100 
101 
102 // Writers
103 //! Wallformfac momenta writer
104 void write(XMLWriter& xml, const std::string& path, const WallFormFac_momenta_t& header)
105 {
106  push(xml, path);
107 
108  write(xml, "inser_mom_num", header.inser_mom_num);
109  write(xml, "inser_mom", header.inser_mom);
110  write(xml, "local_cur3ptfn", header.local_current);
111 
112  if (header.nonlocal_current.size() > 0)
113  write(xml, "nonlocal_cur3ptfn", header.nonlocal_current);
114 
115  pop(xml);
116 }
117 
118 //! Wallformfac insertion writer
119 void write(XMLWriter& xml, const std::string& path, const WallFormFac_insertion_t& header)
120 {
121  push(xml, path);
122 
123  write(xml, "gamma_ctr", header.gamma_ctr);
124  write(xml, "mu", header.mu);
125  write(xml, "gamma_value", header.gamma_value);
126  write(xml, "Momenta", header.momenta);
127 
128  pop(xml);
129 }
130 
131 //! Wallformfac projector writer
132 void write(XMLWriter& xml, const std::string& path, const WallFormFac_projector_t& header)
133 {
134  push(xml, path);
135 
136  write(xml, "proj_ctr", header.proj_ctr);
137  write(xml, "proj_name", header.proj_name);
138  write(xml, "Insertion", header.insertion);
139 
140  pop(xml);
141 }
142 
143 //! Wallformfac lorentz writer
144 void write(XMLWriter& xml, const std::string& path, const WallFormFac_lorentz_t& header)
145 {
146  push(xml, path);
147 
148  write(xml, "lorentz_ctr", header.lorentz_ctr);
149  write(xml, "snk_gamma", header.snk_gamma);
150  write(xml, "src_gamma", header.src_gamma);
151  write(xml, "Projector", header.projector);
152 
153  pop(xml);
154 }
155 
156 //! Wallformfac formfac writer
157 void write(XMLWriter& xml, const std::string& path, const WallFormFac_formfac_t& header)
158 {
159  push(xml, path);
160 
161  write(xml, "formfac_ctr", header.formfac_ctr);
162  write(xml, "formfac_name", header.formfac_name);
163  write(xml, "Lorentz", header.lorentz);
164 
165  pop(xml);
166 }
167 
168 //! Wallformfac quark writer
169 void write(XMLWriter& xml, const std::string& path, const WallFormFac_quark_t& header)
170 {
171  push(xml, path);
172 
173  write(xml, "quark_ctr", header.quark_ctr);
174  write(xml, "quark_name", header.quark_name);
175  write(xml, "FormFac", header.formfac);
176 
177  pop(xml);
178 }
179 
180 //! WallFormFac writer
181 void write(XMLWriter& xml, const std::string& path, const WallFormFac_formfacs_t& header)
182 {
183  push(xml, path);
184 
185  write(xml, "subroutine", header.subroutine);
186  write(xml, "Quark", header.quark);
187 
188  pop(xml);
189 }
190 
191 
192 //! Wallformfac momenta writer
193 void write(BinaryWriter& bin, const WallFormFac_momenta_t& header)
194 {
195  int magic = 20301;
196  write(bin, magic);
197  write(bin, header.inser_mom_num);
198  write(bin, header.inser_mom);
199  write(bin, header.local_current);
200  write(bin, header.nonlocal_current);
201 }
202 
203 //! Wallformfac insertion writer
204 void write(BinaryWriter& bin, const WallFormFac_insertion_t& header)
205 {
206  write(bin, header.gamma_ctr);
207  write(bin, header.mu);
208  write(bin, header.gamma_value);
209  write(bin, header.momenta);
210 }
211 
212 //! Wallformfac projector writer
213 void write(BinaryWriter& bin, const WallFormFac_projector_t& header)
214 {
215  write(bin, header.proj_ctr);
216  write(bin, header.proj_name);
217  write(bin, header.insertion);
218 }
219 
220 //! Wallformfac lorentz writer
221 void write(BinaryWriter& bin, const WallFormFac_lorentz_t& header)
222 {
223  write(bin, header.lorentz_ctr);
224  write(bin, header.snk_gamma);
225  write(bin, header.src_gamma);
226  write(bin, header.projector);
227 }
228 
229 //! Wallformfac formfac writer
230 void write(BinaryWriter& bin, const WallFormFac_formfac_t& header)
231 {
232  write(bin, header.formfac_ctr);
233  write(bin, header.formfac_name);
234  write(bin, header.lorentz);
235 }
236 
237 //! Wallformfac quark writer
238 void write(BinaryWriter& bin, const WallFormFac_quark_t& header)
239 {
240  write(bin, header.quark_ctr);
241  write(bin, header.quark_name);
242  write(bin, header.formfac);
243 }
244 
245 //! WallFormFac writer
246 void write(BinaryWriter& bin, const WallFormFac_formfacs_t& header)
247 {
248  write(bin, header.subroutine);
249  write(bin, header.quark);
250 }
251 
252 } // end namespace Chroma
Primary include file for CHROMA library code.
Fourier transform phase factor support.
Definition: sftmom.h:35
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
multi1d< int > numToMom(int mom_num) const
Convert momenta id to actual array of momenta.
Definition: sftmom.h:78
multi2d< DComplex > sft(const LatticeComplex &cf) const
Do a sumMulti(cf*phases,getSet())
Definition: sftmom.cc:524
int numMom() const
Number of momenta.
Definition: sftmom.h:60
int mu
Definition: cool.cc:24
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void wallFormFacSft(multi1d< WallFormFac_momenta_t > &momenta, const LatticeComplex &corr_local_fn, const LatticeComplex &corr_nonlocal_fn, const SftMom &phases, bool compute_nonlocal, int t0)
Do slow SFT over hadron correlator data.
Definition: wallff_w.cc:54
LatticePropagator nonlocalCurrentProp(const multi1d< LatticeColorMatrix > &u, int mu, const LatticePropagator &forw_prop, const LatticePropagator &anti_prop)
Compute nonlocal current propagator.
Definition: wallff_w.cc:28
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
#define FORWARD
Definition: primitives.h:82
multi1d< WallFormFac_lorentz_t > lorentz
Definition: wallff_w.h:51
multi1d< WallFormFac_quark_t > quark
Definition: wallff_w.h:64
multi1d< WallFormFac_momenta_t > momenta
Definition: wallff_w.h:29
multi1d< WallFormFac_projector_t > projector
Definition: wallff_w.h:44
Structures to hold form-factors.
Definition: wallff_w.h:17
multi1d< Complex > nonlocal_current
Definition: wallff_w.h:21
multi1d< Complex > local_current
Definition: wallff_w.h:20
multi1d< int > inser_mom
Definition: wallff_w.h:19
multi1d< WallFormFac_insertion_t > insertion
Definition: wallff_w.h:36
multi1d< WallFormFac_formfac_t > formfac
Definition: wallff_w.h:58
Structures for wall-sink/source form-factors.