CHROMA
qqq_w.cc
Go to the documentation of this file.
1 // $Id: qqq_w.cc,v 3.3 2009-03-19 17:17:20 mcneile Exp $
2 // $Log: qqq_w.cc,v $
3 // Revision 3.3 2009-03-19 17:17:20 mcneile
4 // Added guard code so that chroma compiles with Nc <> 3
5 //
6 // Revision 3.2 2008/12/21 21:22:37 edwards
7 // Some code cleanups. Put in chroma namespace. Moved around the chromabase.h
8 // include.
9 //
10 // Revision 3.1 2008/09/09 20:30:42 kostas
11 // added Decuplet to NPLQCD code
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 3 quark propagators contracted at the sink
26 //
27 
28 
29 #include "chromabase.h"
30 #include "util/ft/sftmom.h"
31 #include "util/ferm/transf.h"
32 #include "barspinmat_w.h"
33 #include "qqq_w.h"
34 
35 namespace Chroma
36 {
37  //! Baryon-Baryon 2-pt functions (C\gamma_5 diquark)
38  /*!
39  * \ingroup hadron
40  *
41  * This routine is specific to Wilson fermions!
42  *
43  */
44  void compute_qqq(multi2d<ThreeQuarks>& qqq,
45  const LatticePropagator& q1,
46  const LatticePropagator& q2,
47  const LatticePropagator& q3,
48  const SftMom& phases,
49  int t0, int bc_spec)
50  {
51 
52  START_CODE();
53  if ( Nc != 3 ){ /* Code is specific to Ns=4 and Nc=3. */
54  QDPIO::cerr<<" code only works for Nc=3 and Ns=4\n";
55  QDP_abort(111) ;
56  }
57 #if QDP_NC == 3
58 
59 
60  QDPIO::cout<<"Starting the qqq code\n";
61 
62  // Length of lattice in decay direction
63  int length = phases.numSubsets();
64  //int j_decay = phases.getDir();
65  int num_mom = phases.numMom();
66 
67  multi2d<LatticeFermion> f1(Ns,Nc) ;
68 
69  { //save a little memory usage
70  // C gamma_5 = Gamma(5)
71  //LatticePropagator c5qc5 = Gamma(5)*q1*Gamma(5) ;
72  //c5qc5=-c5qc5 ;
73  //I may want to only multiply c5 only in the sink
74  //this way the qqq object will be more versatile...
75  //for(QuarkIndex i;i.NotEnd();++i)
76  // PropToFerm(c5qc5, f1[i.s][i.c] ,i.c,i.s) ;
77 
78  LatticePropagator c5q = Gamma(5)*q1 ;
79  for(QuarkIndex i;i.NotEnd();++i)
80  PropToFerm(c5q, f1[i.s][i.c] ,i.c,i.s) ;
81  }
82 
83  multi2d<LatticeFermion> f2(Ns,Nc) ;
84  multi2d<LatticeFermion> f3(Ns,Nc) ;
85  for(QuarkIndex i;i.NotEnd();++i){
86  PropToFerm(q2, f2[i.s][i.c] ,i.c,i.s) ;
87  PropToFerm(q3, f3[i.s][i.c] ,i.c,i.s) ;
88  }
89 
90  LatticeComplex cc ;
91  multi2d<DComplex> foo(num_mom,length) ;
92  for(int s4(0);s4<Ns;s4++) //sink spin index of the 3rd quark
93  for(QuarkIndex i3;i3.NotEnd();++i3)
94  for(QuarkIndex i2;i2.NotEnd();++i2)
95  for(QuarkIndex i1;i1.NotEnd();++i1){
96  //cout<<"QuarkIndex iterator: "<<i1.s<<" "<<i1.c<<std::endl;
97  cc=0.0;
98  // s is the sink spin index of the 1 and 2 quark
99  // that participate in the diquark
100  for(int s(0);s<Ns;s++) //contract the diquark on the sink
101  cc += colorContract(peekSpin(f1[i1.s][i1.c],s ),
102  peekSpin(f2[i2.s][i2.c],s ),
103  peekSpin(f3[i3.s][i3.c],s4));
104 
105  foo = phases.sft(cc);
106  for(int sink_mom_num(0); sink_mom_num < num_mom; sink_mom_num++)
107  for(int t = 0; t < length; ++t){
108  //shift source to 0 and take care of the antiperiodic BC
109  //sign flip for the baryon
110  int t_eff = (t - t0 + length) % length;
111  qqq[sink_mom_num][t_eff](i1,i2,i3,s4) =
112  (bc_spec < 0 && (t_eff+t0) >= length) ? -foo[sink_mom_num][t] :
113  foo[sink_mom_num][t] ;
114  //cout<<t<<" "<<qqq[sink_mom_num][t](i1,i2,i3,s4)<<std::endl ;
115  }
116  //cout<<i1.s<<" "<<qqq[0][0](i1,i2,i3,s4)<<std::endl ;
117  }
118 
119  QDPIO::cout<<"Finished the qqq code\n";
120 
121 #endif
122  END_CODE();
123 
124  }
125 
126  void compute_qqq(multi2d<ThreeQuarks>& qqq, const int k, // k = 1 2 3 4(time)
127  const LatticePropagator& q1,
128  const LatticePropagator& q2,
129  const LatticePropagator& q3,
130  const SftMom& phases,
131  int t0, int bc_spec
132  ){
133 
134  START_CODE();
135  if ( Nc != 3 ){ /* Code is specific to Ns=4 and Nc=3. */
136  QDPIO::cerr<<" code only works for Nc=3 and Ns=4\n";
137  QDP_abort(111) ;
138  }
139 #if QDP_NC == 3
140 
141 
142  QDPIO::cout<<"Starting the qqq code\n";
143 
144  // Length of lattice in decay direction
145  int length = phases.numSubsets();
146  //int j_decay = phases.getDir();
147  int num_mom = phases.numMom();
148 
149  multi2d<LatticeFermion> f1(Ns,Nc) ;
150 
151  {
152  LatticePropagator c5q = BaryonSpinMats::Cgmu(k)*q1 ;
153  for(QuarkIndex i;i.NotEnd();++i)
154  PropToFerm(c5q, f1[i.s][i.c] ,i.c,i.s) ;
155  }
156 
157  multi2d<LatticeFermion> f2(Ns,Nc) ;
158  multi2d<LatticeFermion> f3(Ns,Nc) ;
159  for(QuarkIndex i;i.NotEnd();++i){
160  PropToFerm(q2, f2[i.s][i.c] ,i.c,i.s) ;
161  PropToFerm(q3, f3[i.s][i.c] ,i.c,i.s) ;
162  }
163 
164  LatticeComplex cc ;
165  multi2d<DComplex> foo(num_mom,length) ;
166  for(int s4(0);s4<Ns;s4++) //sink spin index of the 3rd quark
167  for(QuarkIndex i3;i3.NotEnd();++i3)
168  for(QuarkIndex i2;i2.NotEnd();++i2)
169  for(QuarkIndex i1;i1.NotEnd();++i1){
170  //cout<<"QuarkIndex iterator: "<<i1.s<<" "<<i1.c<<std::endl;
171  cc=0.0;
172  // s is the sink spin index of the 1 and 2 quark
173  // that participate in the diquark
174  for(int s(0);s<Ns;s++) //contract the diquark on the sink
175  cc += colorContract(peekSpin(f1[i1.s][i1.c],s ),
176  peekSpin(f2[i2.s][i2.c],s ),
177  peekSpin(f3[i3.s][i3.c],s4));
178 
179  foo = phases.sft(cc);
180  for(int sink_mom_num(0); sink_mom_num < num_mom; sink_mom_num++)
181  for(int t = 0; t < length; ++t){
182  //shift source to 0 and take care of the antiperiodic BC
183  //sign flip for the baryon
184  int t_eff = (t - t0 + length) % length;
185  qqq[sink_mom_num][t_eff](i1,i2,i3,s4) =
186  (bc_spec < 0 && (t_eff+t0) >= length) ? -foo[sink_mom_num][t] :
187  foo[sink_mom_num][t] ;
188  //cout<<t<<" "<<qqq[sink_mom_num][t](i1,i2,i3,s4)<<std::endl ;
189  }
190  //cout<<i1.s<<" "<<qqq[0][0](i1,i2,i3,s4)<<std::endl ;
191  }
192 
193  QDPIO::cout<<"Finished the qqq code\n";
194 
195 #endif
196  END_CODE();
197 
198  }
199 
200  void write_qqq(QDPFileWriter& to,
201  multi2d<ThreeQuarks>& qqq,
202  const SftMom& phases,
203  std::string type,
204  std::string sink){
205 
206  for(int p(0) ; p<phases.numMom();p++){
207  XMLBufferWriter record_xml;
208  push(record_xml, "qqq_desc");//write out the momemtum of each bit
209  write(record_xml, "mom", phases.numToMom(p));
210  write(record_xml, "type", type);
211  write(record_xml, "sink", sink);
212  pop(record_xml);
213 
214  multi1d<DComplex> data(phases.numSubsets()*qqq[p][0].handle().size());
215  int k(0);
216  for(int t(0);t<phases.numSubsets();t++)
217  for(int j(0);j<qqq[p][t].Size();j++)
218  data[k++] = qqq[p][t][j] ;
219 
220  write(to,record_xml,data);
221  }
222 
223  }
224 
225 } //Chroma namespace
226 
Baryon spin and projector matrices.
Primary include file for CHROMA library code.
bool NotEnd()
Definition: qqq_w.h:41
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
void PropToFerm(const LatticePropagatorF &b, LatticeFermionF &a, int color_index, int spin_index)
Extract a LatticeFermion from a LatticePropagator.
Definition: transf.cc:226
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void compute_qqq(multi2d< ThreeQuarks > &qqq, const LatticePropagator &q1, const LatticePropagator &q2, const LatticePropagator &q3, const SftMom &phases, int t0, int bc_spec)
Baryon-Baryon 2-pt functions (C\gamma_5 diquark)
Definition: qqq_w.cc:44
int bc_spec
unsigned j
Definition: ldumul_w.cc:35
int t
Definition: meslate.cc:37
SpinMatrix Cgmu(int k)
C g_\mu = \gamma_4 \gamma_2 \gamma_\mu.
Definition: barspinmat_w.cc:79
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
void write_qqq(QDPFileWriter &to, multi2d< ThreeQuarks > &qqq, const SftMom &phases, std::string type, std::string sink)
Definition: qqq_w.cc:200
pop(xml_out)
START_CODE()
int k
Definition: invbicg.cc:119
multi1d< LatticeFermion > s(Ncb)
const T1 const T2 const T3 & f3
Definition: gtest.h:1327
const T1 const T2 & f2
Definition: gtest.h:1321
const T1 & f1
Definition: gtest.h:1316
::std::string string
Definition: gtest.h:1979
constructs 3 quark propagators contracted at the sink
Fourier transform phase factor support.