CHROMA
qqbar_w.cc
Go to the documentation of this file.
1 // $Id: qqbar_w.cc,v 3.3 2008-12-21 21:22:37 edwards Exp $
2 // $Log: qqbar_w.cc,v $
3 // Revision 3.3 2008-12-21 21:22:37 edwards
4 // Some code cleanups. Put in chroma namespace. Moved around the chromabase.h
5 // include.
6 //
7 // Revision 3.2 2008/03/29 03:40:20 kostas
8 // added std::vector mesons
9 //
10 // Revision 3.1 2007/02/22 21:11:49 bjoo
11 // Removed Ordered and Unordered Subsets and Sets. Now just have Subsets and Sets -not Unordered or Ordered - passes regressions with suitable QDP where QDP has SSE disabled
12 //
13 // Revision 3.0 2006/04/03 04:59:00 edwards
14 // Major overhaul of fermion and gauge action interface. Basically,
15 // all fermacts and gaugeacts now carry out <T,P,Q> template parameters. These are
16 // the fermion type, the "P" - conjugate momenta, and "Q" - generalized coordinates
17 // in the sense of Hamilton's equations. The fermbc's have been rationalized to never
18 // be over multi1d<T>. The "createState" within the FermionAction is now fixed meaning
19 // the "u" fields are now from the coordinate type. There are now "ConnectState" that
20 // derive into FermState<T,P,Q> and GaugeState<P,Q>.
21 //
22 // Revision 2.1 2005/12/27 20:41:41 kostas
23 // added NPLQCD code
24 //
25 // constructs 2 quark propagators contracted at the sink
26 //
27 
28 #include "chromabase.h"
29 #include "util/ft/sftmom.h"
30 #include "qqbar_w.h"
31 
32 namespace Chroma
33 {
34 
35  //! Meson-Meson 4-pt functions
36  /*!
37  * \ingroup hadron
38  *
39  * This routine is specific to Wilson fermions!
40  *
41  * Construct meson-meson propagators
42  * The two propagators can be identical or different.
43  *
44  * \param qqbar -- the 2-quark propagator ( Write )
45  * \param quark_prop_1 -- first quark propagator ( Read )
46  * \param quark_prop_2 -- second (anti-) quark propagator ( Read )
47  * \param t0 -- timeslice coordinate of the source ( Read )
48  * \param phases -- object holds list of momenta and Fourier phases ( Read )
49  *
50  * ____
51  * \ +
52  *qqbar(p,t)=> [g5 q2(t_src;t + t_src,x) g5] g5 q1(t+t_src,x;t_src) * exp(ipx)
53  * /
54  * ----
55  * x
56  */
57 
58 /*** chroma bug
59  void compute_qqbar( multi2d<DPropagator>& qqbar,
60  const LatticePropagator& quark_prop_1,
61  const LatticePropagator& quark_prop_2,
62  const SftMom& phases,
63  int t0)
64  {
65  START_CODE();
66 
67  QDPIO::cout<<"Starting the qqbar code\n";
68 
69  // Length of lattice in decay direction
70  Set sft_set(phases.getSet()) ;
71  int length(sft_set.numSubsets());
72  QDPIO::cout<<"Time length: "<<length<<std::endl ;
73 
74  // Construct the anti-quark propagator from quark_prop_2
75  int G5 = Ns*Ns-1;
76  LatticePropagator anti_quark_prop = Gamma(G5) * quark_prop_2 * Gamma(G5);
77 
78  LatticePropagator quarkloop;
79 
80  quarkloop = adj(anti_quark_prop)*Gamma(G5) *quark_prop_1 ;
81 
82  multi1d<DPropagator> foo(length);
83  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num){
84  foo = sumMulti(phases[mom_num]*quarkloop, sft_set);
85  for(int t = 0; t < length; ++t){
86  int t_eff = (t - t0 + length) % length;
87  qqbar[mom_num][t_eff]= foo[t] ;
88  }
89  }
90 
91  QDPIO::cout<<"Finished the qqbar code\n";
92 
93  END_CODE();
94  }
95 ***/
96 
97 /*** bug work around ***/
98  void compute_qqbar( multi2d<DPropagator>& qqbar,
99  const LatticePropagator& quark_prop_1,
100  const LatticePropagator& quark_prop_2,
101  const SftMom& phases,
102  int t0)
103  {
104  START_CODE();
105 
106  QDPIO::cout<<"Starting the qqbar code\n";
107 
108  // Length of lattice in decay direction
109  Set sft_set(phases.getSet()) ;
110  int length(sft_set.numSubsets());
111  //QDPIO::cout<<"Time length: "<<length<<std::endl ;
112 
113  // Construct the anti-quark propagator from quark_prop_2
114  int G5 = Ns*Ns-1;
115  LatticePropagator anti_quark_prop = Gamma(G5) * quark_prop_2 * Gamma(G5);
116 
117  LatticePropagator quarkloop;
118  LatticeSpinMatrix sm ;
119  LatticeColorMatrix cm ;
120 
121  quarkloop = adj(anti_quark_prop)*Gamma(G5) *quark_prop_1 ;
122  LatticeComplex cc;
123  multi2d<DPropagator> foo(phases.numMom(),length);
124  multi2d<DColorMatrix> dcm(phases.numMom(),length);
125 
126  for(int s1(0);s1<Ns;s1++)
127  for(int s2(0);s2<Ns;s2++){
128  cm = peekSpin(quarkloop,s1,s2);
129  for(int c1(0);c1<Nc;c1++)
130  for(int c2(0);c2<Nc;c2++){
131  cc = peekColor(cm,c1,c2);
132  multi2d<DComplex> fcc(phases.sft(cc));
133  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num){
134  for(int t = 0; t < length; ++t){
135  pokeColor(dcm[mom_num][t],fcc[mom_num][t],c1,c2);
136  }
137  }
138  }
139  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num)
140  for(int t = 0; t < length; ++t)
141  pokeSpin(foo[mom_num][t],dcm[mom_num][t],s1,s2);
142  }
143 
144  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num){
145  for(int t = 0; t < length; ++t){
146  // QDPIO::cout<<mom_num<<" "<<t<<" "<<trace(foo[mom_num][t]*Gamma(G5))<<std::endl;
147  int t_eff = (t - t0 + length) % length;
148  qqbar[mom_num][t_eff]= foo[mom_num][t] ;
149  }
150  }
151 
152  QDPIO::cout<<"Finished the qqbar code\n";
153 
154  END_CODE();
155  }
156 
157  /*** bug work around ***/
158  //New code that allows the std::vector mesons
159  void compute_qqbar( multi2d<DPropagator>& qqbar,const int gg,
160  const LatticePropagator& quark_prop_1,
161  const LatticePropagator& quark_prop_2,
162  const SftMom& phases,
163  int t0)
164  {
165  START_CODE();
166 
167  QDPIO::cout<<"Starting the qqbar code\n";
168 
169  // Length of lattice in decay direction
170  Set sft_set(phases.getSet()) ;
171  int length(sft_set.numSubsets());
172  //QDPIO::cout<<"Time length: "<<length<<std::endl ;
173 
174  // Construct the anti-quark propagator from quark_prop_2
175  int G5 = Ns*Ns-1;
176  LatticePropagator anti_quark_prop = Gamma(G5) * quark_prop_2 * Gamma(G5);
177 
178  LatticePropagator quarkloop;
179  LatticeSpinMatrix sm ;
180  LatticeColorMatrix cm ;
181 
182  quarkloop = adj(anti_quark_prop)*Gamma(gg) *quark_prop_1 ;
183  LatticeComplex cc;
184  multi2d<DPropagator> foo(phases.numMom(),length);
185  multi2d<DColorMatrix> dcm(phases.numMom(),length);
186 
187  for(int s1(0);s1<Ns;s1++)
188  for(int s2(0);s2<Ns;s2++){
189  cm = peekSpin(quarkloop,s1,s2);
190  for(int c1(0);c1<Nc;c1++)
191  for(int c2(0);c2<Nc;c2++){
192  cc = peekColor(cm,c1,c2);
193  multi2d<DComplex> fcc(phases.sft(cc));
194  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num){
195  for(int t = 0; t < length; ++t){
196  pokeColor(dcm[mom_num][t],fcc[mom_num][t],c1,c2);
197  }
198  }
199  }
200  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num)
201  for(int t = 0; t < length; ++t)
202  pokeSpin(foo[mom_num][t],dcm[mom_num][t],s1,s2);
203  }
204 
205  for (int mom_num(0); mom_num < phases.numMom(); ++mom_num){
206  for(int t = 0; t < length; ++t){
207  // QDPIO::cout<<mom_num<<" "<<t<<" "<<trace(foo[mom_num][t]*Gamma(G5))<<std::endl;
208  int t_eff = (t - t0 + length) % length;
209  qqbar[mom_num][t_eff]= foo[mom_num][t] ;
210  }
211  }
212 
213  QDPIO::cout<<"Finished the qqbar code with Gamma("<<gg<<")\n";
214 
215  END_CODE();
216  }
217 
218 
219 
220  void write_qqbar(QDPFileWriter& to,
221  multi2d<DPropagator>& qqbar,
222  const SftMom& phases,
223  std::string type,
224  std::string sink){
225 
226  for(int p(0) ; p<phases.numMom();p++){
227  XMLBufferWriter record_xml;
228  push(record_xml, "qqbar_desc");//write out the momemtum of each bit
229  write(record_xml, "mom", phases.numToMom(p));
230  write(record_xml, "type", type);
231  write(record_xml, "sink", sink);
232  pop(record_xml);
233 
234  write(to,record_xml,qqbar[p]);
235 
236  }
237 
238  }
239 
240 } // namespace Chroma
241 
Primary include file for CHROMA library code.
Fourier transform phase factor support.
Definition: sftmom.h:35
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
const Set & getSet() const
The set to be used in sumMulti.
Definition: sftmom.h:57
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void compute_qqbar(multi2d< DPropagator > &qqbar, const LatticePropagator &quark_prop_1, const LatticePropagator &quark_prop_2, const SftMom &phases, int t0)
Meson-Meson 4-pt functions.
Definition: qqbar_w.cc:98
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void write_qqbar(QDPFileWriter &to, multi2d< DPropagator > &qqbar, const SftMom &phases, std::string type, std::string sink)
Definition: qqbar_w.cc:220
int G5
Definition: pbg5p_w.cc:57
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
constructs 2 quark propagators contracted at the sink
Fourier transform phase factor support.