CHROMA
key_hadron_3pt_corr.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Hadron 3pt correlators
3  */
4 
6 
7 namespace Chroma
8 {
9 #if 0
10  namespace
11  {
12  //! Error output
13  std::ostream& operator<<(std::ostream& os, const Array<int>& d)
14  {
15  if (d.size() > 0)
16  {
17  os << d[0];
18 
19  for(int i=1; i < d.size(); ++i)
20  os << " " << d[i];
21  }
22 
23  return os;
24  }
25 
26  //! Error output
27  std::ostream& operator<<(std::ostream& os, const Array<ComplexD>& d)
28  {
29  if (d.size() > 0)
30  {
31  for(int i=0; i < d.size(); ++i)
32  {
33  if (i > 0)
34  os << " ";
35 
36  os << "(" << real(d[i]) << "," << imag(d[i]) << ")";
37  }
38  }
39 
40  return os;
41  }
42 
43  //! Error output
44  template<typename T>
45  std::ostream& operator<<(std::ostream& os, const std::vector<T>& d)
46  {
47  if (d.size() > 0)
48  {
49  os << d[0];
50 
51  for(int i=1; i < d.size(); ++i)
52  os << " " << d[i];
53  }
54 
55  return os;
56  }
57  }
58 
59 
60  //----------------------------------------------------------------------------
61  //! Used for error output
62  std::ostream& operator<<(std::ostream& os, const KeyHadron3PtCorr_t& d)
63  {
64  os << "KeyHadron3PtCorr_t:"
65  << " src_name= " << d.src_name
66  << " src_smear= " << d.src_smear
67  << " src_lorentz= " << d.src_lorentz
68  << " src_spin= " << d.src_spin
69  << " snk_name= " << d.snk_name
70  << " snk_smear= " << d.snk_smear
71  << " snk_lorentz= " << d.snk_lorentz
72  << " snk_spin= " << d.snk_spin
73  << " mass= " << d.mass
74  << " gamma= " << d.gamma
75  << " links= " << d.links
76  << " p_i= " << d.pi_pf.p_i
77  << " p_f= " << d.pi_pf.p_f
78  << " quark= " << d.quark
79  << " dt= " << d.dt
80  << " num_vecs= " << d.num_vecs
81  << " ensemble= " << d.ensemble
82  << std::endl;
83 
84  return os;
85  }
86 #endif
87 
88 
89  //----------------------------------------------------------------------------
90  // Reader
91  void read(XMLReader& xml, const std::string& path, PiPf& param)
92  {
93  XMLReader paramtop(xml, path);
94 
95  read(paramtop, "p_f", param.p_f);
96  read(paramtop, "p_i", param.p_i);
97  }
98 
99  // Writer
100  void write(XMLWriter& xml, const std::string& path, const PiPf& param)
101  {
102  push(xml, path);
103 
104  write(xml, "p_f", param.p_f);
105  write(xml, "p_i", param.p_i);
106  write(xml, "q_sq", norm2(param.p_f - param.p_i));
107 
108  pop(xml);
109  }
110 
111  //----------------------------------------------------------------------------
112  // Read a key
113  void read(XMLReader& xml, const std::string& path, KeyHadron3PtCorr_t& param)
114  {
115  XMLReader paramtop(xml, path);
116 
117  read(paramtop, "num_vecs", param.num_vecs);
118  read(paramtop, "src_name", param.src_name);
119  read(paramtop, "src_smear", param.src_smear);
120  read(paramtop, "src_lorentz", param.src_lorentz);
121  read(paramtop, "src_spin", param.src_spin);
122  read(paramtop, "snk_name", param.snk_name);
123  read(paramtop, "snk_smear", param.snk_smear);
124  read(paramtop, "snk_lorentz", param.snk_lorentz);
125  read(paramtop, "snk_spin", param.snk_spin);
126  read(paramtop, "PiPf", param.pi_pf);
127  read(paramtop, "gamma", param.gamma);
128  read(paramtop, "links", param.links);
129  read(paramtop, "quark", param.quark);
130  read(paramtop, "dt", param.dt);
131  read(paramtop, "mass", param.mass);
132  read(paramtop, "ensemble", param.ensemble);
133  }
134 
135  // KeyHadron3PtCorr writer
136  void write(XMLWriter& xml, const std::string& path, const KeyHadron3PtCorr_t& param)
137  {
138  push(xml, path);
139 
140  write(xml, "num_vecs", param.num_vecs);
141  write(xml, "src_name", param.src_name);
142  write(xml, "src_smear", param.src_smear);
143  write(xml, "src_lorentz", param.src_lorentz);
144  write(xml, "src_spin", param.src_spin);
145  write(xml, "snk_name", param.snk_name);
146  write(xml, "snk_smear", param.snk_smear);
147  write(xml, "snk_lorentz", param.snk_lorentz);
148  write(xml, "snk_spin", param.snk_spin);
149  write(xml, "PiPf", param.pi_pf);
150  write(xml, "gamma", param.gamma);
151  write(xml, "links", param.links);
152  write(xml, "quark", param.quark);
153  write(xml, "dt", param.dt);
154  write(xml, "mass", param.mass);
155  write(xml, "ensemble", param.ensemble);
156 
157  pop(xml);
158  }
159 
160 
161  //----------------------------------------------------------------------------
162  //! KeyHadron3PtCorr reader
163  void read(BinaryReader& bin, KeyHadron3PtCorr_t& param)
164  {
165  read(bin, param.src_name, 128);
166  read(bin, param.src_smear, 128);
167  read(bin, param.src_lorentz);
168  read(bin, param.src_spin);
169  read(bin, param.snk_name, 128);
170  read(bin, param.snk_smear, 128);
171  read(bin, param.snk_lorentz);
172  read(bin, param.snk_spin);
173  read(bin, param.pi_pf.p_i);
174  read(bin, param.pi_pf.p_f);
175  read(bin, param.gamma);
176  read(bin, param.links);
177  read(bin, param.quark);
178  read(bin, param.dt);
179  read(bin, param.num_vecs);
180  read(bin, param.mass, 128);
181  read(bin, param.ensemble, 1024);
182  }
183 
184  //! Hadron3PtCorr write
185  void write(BinaryWriter& bin, const KeyHadron3PtCorr_t& param)
186  {
187  write(bin, param.src_name);
188  write(bin, param.src_smear);
189  write(bin, param.src_lorentz);
190  write(bin, param.src_spin);
191  write(bin, param.snk_name);
192  write(bin, param.snk_smear);
193  write(bin, param.snk_lorentz);
194  write(bin, param.snk_spin);
195  write(bin, param.pi_pf.p_i);
196  write(bin, param.pi_pf.p_f);
197  write(bin, param.gamma);
198  write(bin, param.links);
199  write(bin, param.quark);
200  write(bin, param.dt);
201  write(bin, param.num_vecs);
202  write(bin, param.mass);
203  write(bin, param.ensemble);
204  }
205 
206 } // namespace Chroma
207 
208 
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.
Hadron 3pt correlators.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP::StandardOutputStream & operator<<(QDP::StandardOutputStream &s, const multi1d< int > &d)
Definition: npr_vertex_w.cc:12
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
DComplex d
Definition: invbicg.cc:99
::std::string string
Definition: gtest.h:1979
Key for Hadron 3pt corr.
Hold momenta.
multi1d< int > p_i
multi1d< int > p_f