CHROMA
delta_2pt_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct meson 2pt correlators.
3  */
4 
8 #include "barspinmat_w.h"
9 
11 
12 namespace Chroma
13 {
14 
15  // Read parameters
16  void read(XMLReader& xml, const std::string& path, Delta2PtEnv::Params& param)
17  {
18  Delta2PtEnv::Params tmp(xml, path);
19  param = tmp;
20  }
21 
22  // Writer
23  void write(XMLWriter& xml, const std::string& path, const Delta2PtEnv::Params& param)
24  {
25  param.writeXML(xml, path);
26  }
27 
28 
29  //! Delta correlators
30  /*!
31  * \ingroup hadron
32  *
33  * @{
34  */
35  namespace Delta2PtEnv
36  {
37  //! Anonymous namespace
38  namespace
39  {
40 
41  //-------------------- callback functions ---------------------------
42 
43  //! Construct pion correlator
44  HadronContract* mesDeltaCorrs(XMLReader& xml_in,
45  const std::string& path)
46  {
47  return new DeltaCorrs(Params(xml_in, path)); // all gammas
48  }
49 
50 
51  //! Local registration flag
52  bool registered = false;
53 
54  } // end anonymous namespace
55 
56 
57  //! Initialize
59  {
60  }
61 
62 
63  //! Read parameters
64  Params::Params(XMLReader& xml, const std::string& path)
65  {
66  XMLReader paramtop(xml, path);
67 
68  int version;
69  read(paramtop, "version", version);
70 
71  switch (version)
72  {
73  case 1:
74  break;
75 
76  default:
77  QDPIO::cerr << __func__ << ": parameter version " << version
78  << " unsupported." << std::endl;
79  QDP_abort(1);
80  }
81 
82  read(paramtop, "mom2_max", mom2_max);
83  read(paramtop, "avg_equiv_mom", avg_equiv_mom);
84  read(paramtop, "mom_origin", mom_origin);
85  if(paramtop.count("min_contractions") !=0 )
86  read(paramtop, "min_contractions", min_contractions);
87  else
88  min_contractions = false ;
89  if(paramtop.count("parity") !=0 )
90  read(paramtop, "parity", parity);
91  else
92  parity = "all" ;//By default, do both pos and neg parity.
93  read(paramtop, "first_id", first_id);
94  read(paramtop, "second_id", second_id);
95  }
96 
97 
98  // Writer
99  void Params::writeXML(XMLWriter& xml, const std::string& path) const
100  {
101  push(xml, path);
102 
103  int version = 1;
104  write(xml, "version", version);
105 
106  write(xml, "mom2_max", mom2_max);
107  write(xml, "avg_equiv_mom", avg_equiv_mom);
108  write(xml, "mom_origin", mom_origin);
109  write(xml, "min_contractions", min_contractions);
110  write(xml, "parity", parity);
111  write(xml, "first_id", first_id);
112  write(xml, "second_id", second_id);
113 
114  pop(xml);
115  }
116 
117 
118  // Construct all the correlators
119  std::list< Handle<HadronContractResult_t> >
120  DeltaCorrs::operator()(const multi1d<LatticeColorMatrix>& u,
121  const std::string& xml_group,
122  const std::string& id_tag)
123  {
124  START_CODE();
125 
126  QDPIO::cout << "Hadron2Pt: Delta" << std::endl;
127 
128  multi1d<ForwardProp_t> forward_headers(2);
131 
132  multi1d<int> t_srce = getTSrce(forward_headers);
133  int decay_dir = getDecayDir(forward_headers);
134 
135  // Get references to the props
136  const LatticePropagator& quark_prop1 =
137  TheNamedObjMap::Instance().getData<LatticePropagator>(params.first_id);
138  const LatticePropagator& quark_prop2 =
139  TheNamedObjMap::Instance().getData<LatticePropagator>(params.second_id);
140 
141  // Parameters needed for the momentum projection
142  SftMomParams_t sft_params;
143  sft_params.mom2_max = params.mom2_max;
144  sft_params.origin_offset = t_srce;
145  sft_params.mom_offset = params.mom_origin;
146  sft_params.avg_equiv_mom = params.avg_equiv_mom;
147  sft_params.decay_dir = decay_dir;
148 
149  std::list< Handle<Hadron2PtContract_t> > hadron; // holds the contract lattice correlator
150  std::map<std::string,SpinMatrix> Projector ;
151  std::map<std::string,SpinMatrix> Parity ;
152  multi1d<SpinMatrix> SrcDiQuark(Ns) ;
153  multi1d<SpinMatrix> SnkDiQuark(Ns) ;
154  Parity["PosPar"] = BaryonSpinMats::Tunpol();
155  Parity["NegPar"] = BaryonSpinMats::TunpolNegPar();
156  Projector["OnePlusSigma3"] = BaryonSpinMats::TspinUp() ;
157  Projector["OneMinusSigma3"] = BaryonSpinMats::TspinDown() ;
158  Projector["SigmaPlus"] = BaryonSpinMats::T_ig5XpiY();
159  Projector["SigmaMinus"] = BaryonSpinMats::T_ig5XmiY();
160 
161  for(int mu(0);mu<Ns ;mu++)
162  SnkDiQuark[mu] = BaryonSpinMats::Cgmu(mu+1);
163  for(int mu(0);mu<Ns ;mu++)
164  SrcDiQuark[mu] = BaryonSpinMats::CgmuTrans(mu+1);
165 
167  /*
168  If we do all contractions, we ignore the parity parameter.
169  */
170  std::map<std::string,SpinMatrix>::iterator par;
171  std::map<std::string,SpinMatrix>::iterator proj;
172  for ( par=Parity.begin();par != Parity.end(); par++){
173  for ( proj=Projector.begin();proj != Projector.end(); proj++){
174  SpinMatrix T = par->second * proj->second ;// the projector matrix
175  QDPIO::cout<<" Parity: "<<par->first<<std::endl;
176  QDPIO::cout<<" Projector: "<<proj->first<<std::endl;
177  for( int src(0) ;src<Ns;src++)
178  for( int snk(0) ;snk<Ns;snk++){
179  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
180 
182  had->corr = Baryon2PtContractions::sigmast2pt(quark_prop1,
183  quark_prop2,
184  T,SrcDiQuark[src],
185  SnkDiQuark[snk]);
186  push(had->xml, xml_group);
187  write(had->xml, id_tag, "delta");
188  write(had->xml, "SrcDiQuark", src);
189  write(had->xml, "SnkDiQuark", snk);
190  write(had->xml, "Parity", par->first);
191  write(had->xml, "Projector", proj->first);
192  write(had->xml, "PropHeaders", forward_headers);
193 
194  pop(had->xml);
195 
196  hadron.push_back(had);
197  }
198  }
199  }
200 
201  //projector for the spin averaged correlator
202  //only works for zero momentum
203  SpinMatrix g_one = 1.0 ;
204  multi1d< multi1d<SpinMatrix> > ProjGmuGnu(Ns-1) ;
205  for(int s1(0);s1<Ns-1;s1++){
206  ProjGmuGnu[s1].resize(Ns-1) ;
207  for(int s2(0);s2<Ns-1;s2++)
208  ProjGmuGnu[s1][s2] = Gamma(1<<s1) * (Gamma(1<<s2)*g_one) ;
209  }
210 
211  for ( par=Parity.begin();par != Parity.end(); par++){
213  had->corr = 0.0 ;
214  for( int src(0) ;src<Ns-1;src++)
215  for( int snk(0) ;snk<Ns-1;snk++){
216  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
217  SpinMatrix T = (- 1.0/3.0) * ProjGmuGnu[src][snk] ;
218  if(src == snk ) T += g_one ;
219  T = par->second * T ;
220  had->corr += Baryon2PtContractions::sigmast2pt(quark_prop1,
221  quark_prop2,
222  T,SrcDiQuark[src],
223  SnkDiQuark[snk]);
224  }
225  push(had->xml, xml_group);
226  write(had->xml, id_tag, "delta");
227  write(had->xml, "Parity", par->first);
228  write(had->xml, "Projector", "SpinAveraged");
229  write(had->xml, "PropHeaders", forward_headers);
230  pop(had->xml);
231 
232  hadron.push_back(had);
233  }
234  }//Ends if(!params.min_contractions)
235 
236  if(params.min_contractions && (params.parity!="all")){
237  /**
238  Here we need all mu, nu combos for the 1 +/- Sigma3,and
239  just the 02, 20, 12, 21 for the SigmaMinus and SigmaPlus
240  This only does one of the parities, either positive or negative,
241  but default is positive
242  **/
243  std::map<std::string,SpinMatrix>::iterator proj;
244  SpinMatrix par;
245  /**
246  if(params.parity=="Neg")
247  par = Parity["NegPar"];
248  else
249  par = Parity["PosPar"];
250  **/
251  par = Parity[params.parity];
252  QDPIO::cout<<"Parity flag is"<<params.parity<<std::endl;
253  for ( proj=Projector.begin();proj != Projector.end(); proj++){
254  SpinMatrix T = par * proj->second ;// the projector matrix
255  QDPIO::cout<<" Parity: "<<params.parity<<std::endl;
256  QDPIO::cout<<" Projector: "<<proj->first<<std::endl;
257  if((proj->first)=="SigmaPlus"||(proj->first)=="SigmaMinus"){
258  for( int src(0) ;src<Ns-1;src++)
259  for( int snk(0) ;snk<Ns-1;snk++){
260  if((src!=snk) && ((src==2)||(snk==2)) ){
261  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
262 
264  had->corr = Baryon2PtContractions::sigmast2pt(quark_prop1,
265  quark_prop2,
266  T,SrcDiQuark[src],
267  SnkDiQuark[snk]);
268 
269 
270  push(had->xml, xml_group);
271  write(had->xml, id_tag, "delta");
272  write(had->xml, "SrcDiQuark", src);
273  write(had->xml, "SnkDiQuark", snk);
274  write(had->xml, "Parity", "PosPar");
275  write(had->xml, "Projector", proj->first);
276  write(had->xml, "PropHeaders", forward_headers);
277 
278  pop(had->xml);
279 
280  hadron.push_back(had);
281  }
282  }
283  }
284  else{
285  for( int src(0) ;src<Ns-1;src++)
286  for( int snk(0) ;snk<Ns-1;snk++){
287  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
288 
290  had->corr = Baryon2PtContractions::sigmast2pt(quark_prop1,
291  quark_prop2,
292  T,SrcDiQuark[src],
293  SnkDiQuark[snk]);
294 
295 
296  push(had->xml, xml_group);
297  write(had->xml, id_tag, "delta");
298  write(had->xml, "SrcDiQuark", src);
299  write(had->xml, "SnkDiQuark", snk);
300  write(had->xml, "Parity", "PosPar");
301  write(had->xml, "Projector", proj->first);
302  write(had->xml, "PropHeaders", forward_headers);
303 
304  pop(had->xml);
305 
306  hadron.push_back(had);
307  }
308  }
309  }
310 
311  }//Ends if(params.min_contractions)
312 
313  if(params.min_contractions && (params.parity=="all")){
314  /**
315  Here we need all mu, nu combos for the 1 +/- Sigma3,and
316  just the 02, 20, 12, 21 for the SigmaMinus and SigmaPlus
317  This does both positive and negative parities.
318  **/
319  std::map<std::string,SpinMatrix>::iterator par;
320  std::map<std::string,SpinMatrix>::iterator proj;
321  for ( par=Parity.begin();par != Parity.end(); par++){
322  for ( proj=Projector.begin();proj != Projector.end(); proj++){
323  SpinMatrix T = par->second * proj->second ;// the projector matrix
324  QDPIO::cout<<" Parity: "<<par->first<<std::endl;
325  QDPIO::cout<<" Projector: "<<proj->first<<std::endl;
326  if((proj->first)=="SigmaPlus"||(proj->first)=="SigmaMinus"){
327  for( int src(0) ;src<Ns-1;src++)
328  for( int snk(0) ;snk<Ns-1;snk++){
329  if((src!=snk) && ((src==2)||(snk==2)) ){
330  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
331 
333  had->corr = Baryon2PtContractions::sigmast2pt(quark_prop1,
334  quark_prop2,
335  T,SrcDiQuark[src],
336  SnkDiQuark[snk]);
337 
338 
339  push(had->xml, xml_group);
340  write(had->xml, id_tag, "delta");
341  write(had->xml, "SrcDiQuark", src);
342  write(had->xml, "SnkDiQuark", snk);
343  write(had->xml, "Parity", par->first);
344  write(had->xml, "Projector", proj->first);
345  write(had->xml, "PropHeaders", forward_headers);
346  pop(had->xml);
347 
348  hadron.push_back(had);
349  }
350  }
351  }
352  else{
353  for( int src(0) ;src<Ns-1;src++)
354  for( int snk(0) ;snk<Ns-1;snk++){
355  QDPIO::cout<<" Computing C_"<<snk<<src<<std::endl;
356 
358  had->corr = Baryon2PtContractions::sigmast2pt(quark_prop1,
359  quark_prop2,
360  T,SrcDiQuark[src],
361  SnkDiQuark[snk]);
362 
363 
364  push(had->xml, xml_group);
365  write(had->xml, id_tag, "delta");
366  write(had->xml, "SrcDiQuark", src);
367  write(had->xml, "SnkDiQuark", snk);
368  write(had->xml, "Parity", par->first);
369  write(had->xml, "Projector", proj->first);
370  write(had->xml, "PropHeaders", forward_headers);
371 
372  pop(had->xml);
373 
374  hadron.push_back(had);
375  }
376  }
377  }
378  }
379  }//Ends if(params.min_contractions)
380 
381 
382  END_CODE();
383 
384  return this->project(hadron, sft_params);
385  }
386 
387 
388  //! Register all the factories
389  bool registerAll()
390  {
391  bool success = true;
392  if (! registered)
393  {
394  //! Register all the factories
395  success &= Chroma::TheHadronContractFactory::Instance().registerObject(std::string("Delta"), mesDeltaCorrs);
396 
397  registered = true;
398  }
399  return success;
400  }
401 
402  } // end namespace Delta2PtEnv
403 
404  /*! @} */ // end of group io
405 
406 } // end namespace Chroma
407 
408 
409 
Heavy-light baryon 2-pt functions.
Baryon spin and projector matrices.
Decuplet baryon 2pt construction.
Definition: delta_2pt_w.h:46
std::list< Handle< HadronContractResult_t > > operator()(const multi1d< LatticeColorMatrix > &u, const std::string &xml_group, const std::string &id_tag)
Construct the correlators.
Definition: delta_2pt_w.cc:120
virtual std::list< Handle< HadronContractResult_t > > project(const std::list< Handle< Hadron2PtContract_t > > &had_list, const SftMomParams_t &p) const
Convenience function to project onto fixed momenta.
Definition: hadron_2pt.cc:33
Construct hadron correlators.
virtual multi1d< int > getTSrce(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get t_srce from headers.
virtual ForwardProp_t readForwardPropHeader(const std::string &prop_id) const
Convenience function to read propagator.
virtual int getDecayDir(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get decay_dir from headers.
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
int mu
Definition: cool.cc:24
Construct delta 2pt correlators.
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.
LatticeComplex sigmast2pt(const LatticePropagator &quark_propagator_1, const LatticePropagator &quark_propagator_2, const SpinMatrix &T, const SpinMatrix &sp)
Delta 2-pt.
Definition: barhqlq_w.cc:89
Factory for producing hadron correlator objects.
multi1d< int > t_srce
Named object function std::map.
static bool registered
Local registration flag.
SpinMatrix T_ig5XpiY()
T = i \gamma_5 (\gamma_1 + i \gamma_2 )
SpinMatrix Tunpol()
T = (1 + gamma_4) / 2 = (1 + Gamma(8)) / 2.
SpinMatrix Cgmu(int k)
C g_\mu = \gamma_4 \gamma_2 \gamma_\mu.
Definition: barspinmat_w.cc:79
SpinMatrix TunpolNegPar()
T = (1 + gamma_4) / 2 = (1 - Gamma(8)) / 2.
SpinMatrix T_ig5XmiY()
T = i \gamma_5 (\gamma_1 - i \gamma_2 )
SpinMatrix TspinDown()
T = (1 - i \gamma_5 \gamma_3 )/2 = 1/2 *( 1 + iG(11) )
SpinMatrix TspinUp()
T = (1 + i \gamma_5 \gamma_3 )/2 = 1/2 *( 1 - iG(11) )
SpinMatrix CgmuTrans(int k)
C g_\mu = \gamma_4 \gamma_2 transpose(\gamma_\mu)
bool registerAll()
Register all the factories.
Definition: delta_2pt_w.cc:389
multi1d< ForwardProp_t > & forward_headers
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
Simple meson 2pt parameters.
Definition: delta_2pt_w.h:24
void writeXML(XMLWriter &in, const std::string &path) const
Definition: delta_2pt_w.cc:99
multi1d< int > mom_origin
Definition: delta_2pt_w.h:30
The result of hadron 2pt correlators.
Definition: hadron_2pt.h:17
Param struct for SftMom.
Definition: sftmom.h:20