CHROMA
barcomp_w.cc
Go to the documentation of this file.
1 // $Id: barcomp_w.cc,v 3.3 2009-03-19 17:17:20 mcneile Exp $
2 /*! \file
3  * \brief Construct all components of a baryon propagator
4  */
5 
6 
8 
9 namespace Chroma
10 {
11 
12  //! Serialize generalized object
13  multi1d<ComplexF> QQQSparse_t::serialize()
14  {
15  // Dreadful hack - we will use 3 complexs to hold 6 ints. So, the size
16  // of the array is the size of the correlators plus the size of the complexs
17  multi1d<ComplexF> barprop_1d(corrs.size()*(3 + length));
18 
19  int cnt = 0;
20  for(int s=0; s < corrs.size(); ++s)
21  {
22  const QQQElem_t& elem = corrs[s];
23  const QQQSpinIndices_t& sp = elem.source_sink;
24 
25  // Dreadful hack - use a complex to hold an int
26  barprop_1d[cnt++] = cmplx(Real(sp.source[0]), Real(sp.source[1]));
27  barprop_1d[cnt++] = cmplx(Real(sp.source[2]), Real(sp.sink[0]));
28  barprop_1d[cnt++] = cmplx(Real(sp.sink[1]), Real(sp.sink[2]));
29 
30  for(int t=0; t < length; ++t)
31  {
32  barprop_1d[cnt++] = elem.corr[t];
33  }
34  }
35 
36  if (cnt != barprop_1d.size())
37  {
38  QDPIO::cerr << "Size mismatch in QQQSparse_t serialization" << std::endl;
39  QDP_abort(1);
40  }
41 
42  return barprop_1d;
43  }
44 
45 
46 
47  //! Construct all components of a baryon propagator
48  /*!
49  * \ingroup hadron
50  *
51  * This routine is specific to Wilson fermions!
52  *
53  * In all baryons the colour components are contracted with the totally
54  * antisymmetric 'tensor' eps(a,b,c) = antisym_tensor(a,b,c).
55  *
56  * \param barprop baryon correlation function (in real space) ( Write )
57  * \param quark_propagator_1 quark propagator ( Read )
58  * \param quark_propagator_2 quark propagator ( Read )
59  * \param quark_propagator_3 quark propagator ( Read )
60  * \param spin_indices holds list of source/sink spin indices ( Read )
61  * \param phases object holds list of momenta ( Read )
62  * \param t0 coordinates of source in decay direction ( Read )
63  * \param bc_spec boundary condition for spectroscopy ( Read )
64  */
65 
66  void barcompSparse(QQQSparse_t& barprop,
67  const LatticePropagator& quark_propagator_1,
68  const LatticePropagator& quark_propagator_2,
69  const LatticePropagator& quark_propagator_3,
70  const multi1d<QQQSpinIndices_t> spin_indices,
71  const SftMom& phases,
72  int t0, int bc_spec)
73  {
74  START_CODE();
75  if ( Nc != 3 ){ /* Code is specific to Ns=4 and Nc=3. */
76  QDPIO::cerr<<" code only works for Nc=3 and Ns=4\n";
77  QDP_abort(111) ;
78  }
79 #if QDP_NC == 3
80 
81 
82  // Length of lattice in decay direction
83  int length = phases.numSubsets();
84 
85  // This object is composed of the spin indices and the correlators
86  barprop.length = length;
87  barprop.corrs.resize(spin_indices.size());
88 
89  // Temporaries
90  multi1d<DComplex> hsum;
91  LatticeComplex b_prop;
92 
93  // Loop over all source/sink spin indices
94  for(int i=0; i < spin_indices.size(); ++i)
95  {
96  const QQQSpinIndices_t& d = spin_indices[i];
97  barprop.corrs[i].source_sink = d;
98 
99  // Contract over color indices with antisym tensors
100  b_prop =
101  colorContract(peekSpin(quark_propagator_1,
102  d.source[0],d.sink[0]), // (si_1,sf_1)
103  peekSpin(quark_propagator_2,
104  d.source[1],d.sink[1]), // (si_2,sf_2)
105  peekSpin(quark_propagator_3,
106  d.source[2],d.sink[2])); // (si_3,sf_3)
107 
108  /* Project on zero momentum: Do a slice-wise sum. */
109  hsum = sumMulti(b_prop, phases.getSet());
110 
111  barprop.corrs[i].corr.resize(length);
112  for(int t=0; t < length; ++t) // t
113  {
114  int t_eff = (t - t0 + length) % length;
115  barprop.corrs[i].corr[t] = (bc_spec < 0 && (t_eff+t0) >= length) ? -hsum[t] : hsum[t];
116  }
117  }
118 
119 #endif
120  END_CODE();
121  }
122 
123 
124 
125  //! Serialize generalized object
126  multi1d<ComplexF> QQQDense_t::serialize()
127  {
128  multi1d<int> ranks(7);
129 
130  multi1d<ComplexF> barprop_1d(length*Ns*Ns*Ns*Ns*Ns*Ns);
131 
132  int cnt = 0;
133  for(ranks[0]=0; ranks[0] < Ns; ++ranks[0]) // sf_3
134  for(ranks[1]=0; ranks[1] < Ns; ++ranks[1]) // sf_2
135  for(ranks[2]=0; ranks[2] < Ns; ++ranks[2]) // sf_1
136  for(ranks[3]=0; ranks[3] < Ns; ++ranks[3]) // si_3
137  for(ranks[4]=0; ranks[4] < Ns; ++ranks[4]) // si_2
138  for(ranks[5]=0; ranks[5] < Ns; ++ranks[5]) // si_1
139  for(ranks[6] = 0; ranks[6] < length; ++ranks[6])
140  {
141  barprop_1d[cnt++] = corrs[ranks];
142  }
143 
144  return barprop_1d;
145  }
146 
147 
148 
149  //! Construct all components of a baryon propagator
150  /*!
151  * \ingroup hadron
152  *
153  * This routine is specific to Wilson fermions!
154  *
155  * In all baryons the colour components are contracted with the totally
156  * antisymmetric 'tensor' eps(a,b,c) = antisym_tensor(a,b,c).
157  *
158  * \param barprop baryon correlation function (in real space) ( Write )
159  * \param quark_propagator_1 quark propagator ( Read )
160  * \param quark_propagator_2 quark propagator ( Read )
161  * \param quark_propagator_3 quark propagator ( Read )
162  * \param phases object holds list of momenta ( Read )
163  * \param t0 coordinates of source in decay direction ( Read )
164  * \param bc_spec boundary condition for spectroscopy ( Read )
165  */
166 
167  void barcomp(QQQDense_t& barprop,
168  const LatticePropagator& quark_propagator_1,
169  const LatticePropagator& quark_propagator_2,
170  const LatticePropagator& quark_propagator_3,
171  const SftMom& phases,
172  int t0, int bc_spec)
173  {
174  START_CODE();
175  if ( Nc != 3 ){ /* Code is specific to Ns=4 and Nc=3. */
176  QDPIO::cerr<<"barcomp code only works for Nc=3 and Ns=4\n";
177  QDP_abort(111) ;
178  }
179 #if QDP_NC == 3
180 
181 
182  // Length of lattice in decay direction
183  int length = phases.numSubsets();
184 
185  multi1d<int> ranks(7);
186  ranks = Ns;
187  ranks[6] = length;
188 
189  barprop.length = length;
190  barprop.corrs.resize(ranks);
191 
192  // Temporaries
193  multi1d<DComplex> hsum;
194  LatticeComplex b_prop;
195 
196  for(ranks[0]=0; ranks[0] < Ns; ++ranks[0]) // sf_3
197  for(ranks[1]=0; ranks[1] < Ns; ++ranks[1]) // sf_2
198  for(ranks[2]=0; ranks[2] < Ns; ++ranks[2]) // sf_1
199  for(ranks[3]=0; ranks[3] < Ns; ++ranks[3]) // si_3
200  for(ranks[4]=0; ranks[4] < Ns; ++ranks[4]) // si_2
201  for(ranks[5]=0; ranks[5] < Ns; ++ranks[5]) // si_1
202  {
203  // Contract over color indices with antisym tensors
204  b_prop =
205  colorContract(peekSpin(quark_propagator_1,
206  ranks[5],ranks[2]), // (si_1,sf_1)
207  peekSpin(quark_propagator_2,
208  ranks[4],ranks[1]), // (si_2,sf_2)
209  peekSpin(quark_propagator_3,
210  ranks[3],ranks[0])); // (si_3,sf_3)
211 
212  /* Project on zero momentum: Do a slice-wise sum. */
213  hsum = sumMulti(b_prop, phases.getSet());
214 
215  for(ranks[6] = 0; ranks[6] < length; ++ranks[6]) // t
216  {
217  int t_eff = (ranks[6] - t0 + length) % length;
218 
219  barprop.corrs[ranks] =
220  (bc_spec < 0 && (t_eff+t0) >= length) ? -hsum[ranks[6]] :
221  hsum[ranks[6]];
222  }
223  }
224 
225 #endif
226  END_CODE();
227  }
228 
229 
230 } // end namespace Chroma
231 
Construct all components of a baryon propagator.
Fourier transform phase factor support.
Definition: sftmom.h:35
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
const Set & getSet() const
The set to be used in sumMulti.
Definition: sftmom.h:57
void barcomp(QQQDense_t &barprop, const LatticePropagator &quark_propagator_1, const LatticePropagator &quark_propagator_2, const LatticePropagator &quark_propagator_3, const SftMom &phases, int t0, int bc_spec)
Construct all components of a baryon propagator.
Definition: barcomp_w.cc:167
void barcompSparse(QQQSparse_t &barprop, const LatticePropagator &quark_propagator_1, const LatticePropagator &quark_propagator_2, const LatticePropagator &quark_propagator_3, const multi1d< QQQSpinIndices_t > spin_indices, const SftMom &phases, int t0, int bc_spec)
Construct all components of a baryon propagator.
Definition: barcomp_w.cc:66
int bc_spec
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int i
Definition: pbg5p_w.cc:55
DComplex d
Definition: invbicg.cc:99
START_CODE()
multi1d< LatticeFermion > s(Ncb)
SpinMatrix sp
Dense QQQ object.
Definition: barcomp_w.h:36
multiNd< Complex > corrs
Definition: barcomp_w.h:41
multi1d< ComplexF > serialize()
Serialize generalized object.
Definition: barcomp_w.cc:126
QQQSpinIndices_t source_sink
Definition: barcomp_w.h:25
multi1d< ComplexF > corr
Definition: barcomp_w.h:26
Sparse QQQ object.
Definition: barcomp_w.h:18
multi1d< QQQElem_t > corrs
Definition: barcomp_w.h:30
multi1d< ComplexF > serialize()
Serialize generalized object.
Definition: barcomp_w.cc:13
Hold source and sink spin indices for a sparse QQQ file.
Definition: qprop_io.h:163