CHROMA
hadron_corr_s.h
Go to the documentation of this file.
1 
2 #ifndef HADRON_CORR_S_H
3 #define HADRON_CORR_S_H
4 
5 #define NUM_STAG_PROPS 8
6 #define NUM_STAG_PIONS 16
7 
8 
9 #include "chromabase.h"
10 #include "stag_propShift_s.h"
11 
12 namespace Chroma
13 {
14 
15  /*
16 
17  This is generic code to compute staggered correlators.
18 
19  */
20 
21 
22 
24  {
25 
26  public :
27  virtual void compute(multi1d<LatticeStaggeredPropagator>& quark_props,
28  int j_decay) = 0 ;
29 
30  /*
31  Write the correlators out
32  */
33  void dump(int t_source, XMLWriter &xml_out)
34  {
35  multi2d<Real> pi_corr(no_channel, t_length);
36  multi2d<Real> re_corr_fn(no_channel, t_length);
37  pi_corr = zero;
38 
39  // Take the real part of the correlator and average over the sources
40  for(int i=0; i < no_channel ; i++){
41  for(int t=0; t < t_length; t++){
42  int t_eff = (t - t_source + t_length)% t_length;
43  re_corr_fn[i][t_eff] = real(corr_fn[i][t]);
44  }
45  }
46 
47  multi1d<Real> Pi(t_length) ;
48  push(xml_out, outer_tag);
49  for(int i=0; i < no_channel; i++) {
50  Pi = re_corr_fn[i];
51  // std::ostringstream tag;
52  //tag << "re_pion" << i;
53  // push(xml_out, tag.str());
54  push(xml_out, tag_names[i]);
55  write(xml_out, inner_tag, Pi);
56  pop(xml_out);
57  }
58  pop(xml_out);
59 
60 
61 
62  }
63 
64  void binary_dump(int t_source, std::string start_name)
65  {
66  const int magic_number = 66618 ;
67  std::string filename ;
68  std::string resized_tag;
69 
70 
71  filename = start_name + outer_tag + "."+inner_tag ;
72  QDPIO::cout << "out tag, in tag: " <<outer_tag << inner_tag << std::endl;
73  BinaryFileWriter speedy ;
74  speedy.open(filename);
75  write(speedy,magic_number) ;
76  write(speedy,t_length) ;
77  write(speedy,no_channel) ;
78 
79  QDPIO::cout << "FILENAME: "<< filename << std::endl;
80 
81  multi2d<Real> pi_corr(no_channel, t_length);
82  multi2d<Real> re_corr_fn(no_channel, t_length);
83  pi_corr = zero;
84 
85  // Take the real part of the correlator and average over the sources
86  for(int i=0; i < no_channel ; i++){
87  for(int t=0; t < t_length; t++){
88  int t_eff = (t - t_source + t_length)% t_length;
89  re_corr_fn[i][t_eff] = real(corr_fn[i][t]);
90  }
91  }
92 
93  multi1d<Real> Pi(t_length) ;
94 
95  for(int i=0; i < no_channel; i++) {
96  Pi = re_corr_fn[i];
97  resized_tag.assign(tag_names[i]);
98  resized_tag.resize(45,' ');
99 
100 
101  write(speedy, tag_names[i]);
102  write(speedy, Pi);
103 
104  }
105 
106 
107  speedy.close();
108 
109 
110 
111  }
112 
113 
114 
115 
116 
117 
118  staggered_hadron_corr(int t_len, int t_chan,
119  const multi1d<LatticeColorMatrix> & uin,
120  Stag_shift_option type_of_shift_in )
121  : t_length(t_len) ,
122  no_channel(t_chan)
123  {
124  corr_fn.resize(no_channel, t_length);
125  u.resize(4) ;
126 
127  if( uin.size() != 4 ) {
128  QDPIO::cerr << "staggered_hadron_corr: input guage config has wrong number of dimensions " << uin.size() << std::endl;
129  QDP_abort(1);
130  };
131 
132  u = uin ;
133  type_of_shift = type_of_shift_in ;
134  }
135 
136 
138  {
139  corr_fn.resize(1, 1);
140  }
141 
142 
143  protected:
144 
145  multi2d<DComplex> corr_fn ;
148  multi1d<std::string> tag_names ;
149  multi1d<LatticeColorMatrix> u ; // this should handle or state
150 
151  LatticeStaggeredPropagator shift_deltaProp(multi1d<int>& delta,
152  const LatticeStaggeredPropagator& src)
153 
154  {
155 
156  switch (type_of_shift)
157  {
158  case NON_GAUGE_INVAR :
159  return shiftDeltaProp(delta,src) ;
160  break ;
161  case GAUGE_INVAR :
162  return shiftDeltaPropCov(delta,src,u,false) ;
163  break ;
164  case SYM_GAUGE_INVAR :
165  return shiftDeltaPropCov(delta,src,u,true) ; // symm shifting
166  break ;
167  case SYM_NON_GAUGE_INVAR:
168  return shiftDeltaProp(delta,src,true) ; // symm shifting
169  break ;
170  default :
171  /**************************************************************************/
172 
173  QDPIO::cerr << "Shift type " << type_of_shift << " unsupported." << std::endl;
174  QDP_abort(1);
175  }
176 
177  return zero; // make compiler happy
178  }
179 
180 
181  private :
182  int t_length ;
183  int no_channel ;
184 
186 
187 
188 
189 
190  } ;
191 
192 
193 } // end namespace Chroma
194 
195 
196 #endif
Primary include file for CHROMA library code.
staggered_hadron_corr(int t_len, int t_chan, const multi1d< LatticeColorMatrix > &uin, Stag_shift_option type_of_shift_in)
Stag_shift_option type_of_shift
void binary_dump(int t_source, std::string start_name)
Definition: hadron_corr_s.h:64
multi1d< LatticeColorMatrix > u
multi1d< std::string > tag_names
multi2d< DComplex > corr_fn
virtual void compute(multi1d< LatticeStaggeredPropagator > &quark_props, int j_decay)=0
void dump(int t_source, XMLWriter &xml_out)
Definition: hadron_corr_s.h:33
LatticeStaggeredPropagator shift_deltaProp(multi1d< int > &delta, const LatticeStaggeredPropagator &src)
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
int j_decay
Definition: meslate.cc:22
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
@ SYM_NON_GAUGE_INVAR
int i
Definition: pbg5p_w.cc:55
LatticeStaggeredPropagator shiftDeltaPropCov(multi1d< int > &delta, const LatticeStaggeredPropagator &src, multi1d< LatticeColorMatrix > u, bool sym_flag)
pop(xml_out)
LatticeStaggeredPropagator shiftDeltaProp(multi1d< int > &delta, const LatticeStaggeredPropagator &src)
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979