CHROMA
qprop_io.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Routines associated with Chroma propagator IO
4  */
5 
6 #ifndef __qprop_io_h__
7 #define __qprop_io_h__
8 
9 #include "io/xml_group_reader.h"
12 
13 namespace Chroma
14 {
15 
16  /*!
17  * Chroma propagator support
18  *
19  * \ingroup io
20  *
21  * @{
22  */
23 
24 
25  //! Propagator source construction parameters
27  {
28  PropSourceConst_t(); /*!< default constructor */
29 
30  multi1d<int> getTSrce() const; /*!< return 4D coords of source (may not exist) */
31 
32  multi1d<int> getMom() const; /*!< return the momentum of the source (may not exist) */
33 
34  GroupXML_t source; /*!< Holds source xml params*/
35 
36  int j_decay; /*!< decay direction */
37  int t_source; /*!< source slice location */
38  };
39 
40  //! Source-smearing parameters
42  {
43  PropSourceSmear_t(); /*!< default constructor */
44 
45  GroupXML_t source; /*!< Holds source xml params*/
46  int j_decay; /*!< decay direction */
47  };
48 
49  //! Sink-smearing parameters
51  {
52  PropSinkSmear_t(); /*!< default constructor */
53 
54  GroupXML_t sink; /*!< Holds sink xml params*/
55  int j_decay; /*!< decay direction */
56  };
57 
58 
59  //! Multi-propagator parameters
61  {
62  ChromaMultiProp_t(); /*!< default constructor */
63  QuarkSpinType quarkSpinType; /*!< what spin components to compute */
64 
65  //! String holding XML of the FermionAction section
66  GroupXML_t fermact; /*!< fermion action */
67  GroupXML_t invParam; /*!< Inverter parameters */
68 
69  multi1d<Real> MultiMasses;
70  };
71 
72 
73  //! Propagator parameters
74  struct ChromaProp_t
75  {
76  ChromaProp_t(); /*!< default constructor */
77  QuarkSpinType quarkSpinType; /*!< why spin components to compute */
78 
79  // String holding XML of the FermionAction section
80  GroupXML_t fermact; /*!< fermion action */
81  bool obsvP; /*!< measure any observables (like Z_V, or mresP) on 5D prop */
82 
83  // String holding XML for auxiliary state information
84  GroupXML_t invParam; /*!< Inverter parameters */
85  };
86 
87 
88  //! Sequential source parameters
89  struct SeqSource_t
90  {
91  SeqSource_t(); /*!< default constructor */
92 
93  GroupXML_t seqsrc; /*!< Sequential source xml */
94 
95  multi1d<int> sink_mom; /*!< sink momentum */
96  int t_sink; /*!< time slice of sink */
97  int j_decay; /*!< decay direction */
98  };
99 
100 
101  //! Mega structure holding a propagator source
103  {
106  };
107 
108 
109  //! Mega structure holding a full forward prop (not sink smeared)
111  {
115  };
116 
117 
118  //! Mega structure holding a full forward sink-smeared prop
120  {
125  };
126 
127 
128  //! Mega structure holding a full sequential source
130  {
133  multi1d<ForwardProp_t> forward_props;
135  };
136 
137 
138  //! Mega structure holding a full sequential prop
140  {
144  multi1d<ForwardProp_t> forward_props;
146  };
147 
148 
149  //! Mega structure holding a full sequential prop that is source smeared
151  {
156  multi1d<ForwardProp_t> forward_props;
158  };
159 
160 
161  //! Hold source and sink spin indices for a sparse QQQ file
163  {
164  multi1d<int> source;
165  multi1d<int> sink;
166  };
167 
168 
169  //! Mega structure holding QQ diquark object
170  struct QQDiquark_t
171  {
172  QQDiquark_t(); /*!< default constructor */
173  bool Dirac_basis; /*!< spin component basis */
174  multi1d<ForwardProp_t> forward_props;
175  };
176 
177 
178  //! Mega structure holding QQQ props
180  {
181  QQQBarcomp_t(); // default constructor
182  multi1d<QQQSpinIndices_t> spin_indices; // spin indices
183  bool sparseP; // Is this data sparsely stored?
184  bool Dirac_basis; // spin component basis
185  multi1d<ForwardProp_t> forward_props;
186  };
187 
188 
189  //! Mega structure holding QQbar props
191  {
192  QQbarMescomp_t(); // default constructor
193  bool Dirac_basis; // spin component basis
194  multi1d<ForwardProp_t> forward_props;
195  };
196 
197 
198  //! Given a fermion action in std::string form, return the Mass
199  Real getMass(const GroupXML_t& fermact);
200 
201  //! Given a fermion action in std::string form, return the boundary
202  multi1d<int> getFermActBoundary(const GroupXML_t& fermact);
203 
204  //! Propagator source read
205  void read(XMLReader& xml, const std::string& path, PropSourceConst_t& header);
206 
207  //! Propagator source writer
208  void write(XMLWriter& xml, const std::string& path, const PropSourceConst_t& header);
209 
210 
211  //! Propagator source smearing read
212  void read(XMLReader& xml, const std::string& path, PropSourceSmear_t& header);
213 
214  //! Propagator source smearing writer
215  void write(XMLWriter& xml, const std::string& path, const PropSourceSmear_t& header);
216 
217 
218  //! Propagator sink reader
219  void read(XMLReader& xml, const std::string& path, PropSinkSmear_t& header);
220 
221  //! Propagator sink writer
222  void write(XMLWriter& xml, const std::string& path, const PropSinkSmear_t& header);
223 
224 
225  //! Propagator header read
226  void read(XMLReader& xml, const std::string& path, ChromaProp_t& header);
227 
228  //! Multi Propagator header read
229  void read(XMLReader& xml, const std::string& path, ChromaMultiProp_t& header);
230 
231 
232  //! Propagator header writer
233  void write(XMLWriter& xml, const std::string& path, const ChromaProp_t& header);
234 
235  //! Propagator header writer
236  void write(XMLWriter& xml, const std::string& path, const ChromaMultiProp_t& header);
237 
238 
239  //! SeqSource header read
240  void read(XMLReader& xml, const std::string& path, SeqSource_t& header);
241 
242  //! SeqSource header writer
243  void write(XMLWriter& xml, const std::string& path, const SeqSource_t& header);
244 
245 
246  //! MakeSourceProp reader
247  void read(XMLReader& xml, const std::string& path, MakeSourceProp_t& header);
248 
249  //! MakeSourceProp writer
250  void write(XMLWriter& xml, const std::string& path, const MakeSourceProp_t& header);
251 
252 
253  //! Propagator_t reader
254  void read(XMLReader& xml, const std::string& path, Propagator_t& header);
255 
256  //! Propagator_t writer
257  void write(XMLWriter& xml, const std::string& path, const Propagator_t& header);
258 
259 
260  //! ForwardProp reader
261  void read(XMLReader& xml, const std::string& path, ForwardProp_t& header);
262 
263  //! ForwardProp writer
264  void write(XMLWriter& xml, const std::string& path, const ForwardProp_t& header);
265 
266 
267  //! SequentialSource reader
268  void read(XMLReader& xml, const std::string& path, SequentialSource_t& header);
269 
270  //! SequentialSource writer
271  void write(XMLWriter& xml, const std::string& path, const SequentialSource_t& header);
272 
273 
274  //! SequentialProp reader
275  void read(XMLReader& xml, const std::string& path, SequentialProp_t& header);
276 
277  //! SequentialProp writer
278  void write(XMLWriter& xml, const std::string& path, const SequentialProp_t& header);
279 
280 
281  //! Source/sink spin indices
282  void read(XMLReader& xml, const std::string& path, QQQSpinIndices_t& input);
283 
284  //! Source/sink spin indices
285  void write(XMLWriter& xml, const std::string& path, const QQQSpinIndices_t& input);
286 
287 
288  //! QQDiquark reader
289  void read(XMLReader& xml, const std::string& path, QQDiquark_t& header);
290 
291  //! QQDiquark writer
292  void write(XMLWriter& xml, const std::string& path, const QQDiquark_t& header);
293 
294 
295  //! QQQBarcomp reader
296  void read(XMLReader& xml, const std::string& path, QQQBarcomp_t& header);
297 
298  //! QQQBarcomp writer
299  void write(XMLWriter& xml, const std::string& path, const QQQBarcomp_t& header);
300 
301 
302  //! QQbarMescomp reader
303  void read(XMLReader& xml, const std::string& path, QQbarMescomp_t& header);
304 
305  //! QQbarMescomp writer
306  void write(XMLWriter& xml, const std::string& path, const QQbarMescomp_t& header);
307 
308 
309  //! Write a Chroma propagator
310  /*
311  * \param file_xml file header ( Read )
312  * \param record_xml xml holding propagator info ( Read )
313  * \param quark_prop propagator ( Read )
314  * \param file path ( Read )
315  * \param volfmt either QDP_SINGLEFILE, QDP_MULTIFILE ( Read )
316  * \param serpar either QDP_SERIAL, QDP_PARALLEL ( Read )
317  */
318  void writeQprop(XMLBufferWriter& file_xml,
319  XMLBufferWriter& record_xml, const LatticePropagator& quark_prop,
320  const std::string& file,
321  QDP_volfmt_t volfmt, QDP_serialparallel_t serpar);
322 
323 
324  //! Read a Chroma propagator
325  /*
326  * \param file_xml file header ( Write )
327  * \param record_xml xml holding propagator info ( Write )
328  * \param quark_prop propagator ( Write )
329  * \param file path ( Read )
330  * \param serpar either QDP_SERIAL, QDP_PARALLEL ( Read )
331  */
332  void readQprop(XMLReader& file_xml,
333  XMLReader& record_xml, LatticePropagator& quark_prop,
334  const std::string& file,
335  QDP_serialparallel_t serpar);
336 
337  // Write a Chroma Fermion Field (eg prop_component)
338  /*
339  * \param file_xml file header ( Read )
340  * \param record_xml xml holding propagator info ( Read )
341  * \param fermion fermion field( Read )
342  * \param file path ( Read )
343  * \param volfmt either QDPIO_SINGLEFILE, QDPIO_MULTIFILE ( Read )
344  * \param serpar either QDPIO_SERIAL, QDPIO_PARALLEL ( Read )
345  */
346  void writeFermion(XMLBufferWriter& file_xml,
347  XMLBufferWriter& record_xml, const LatticeFermion& fermion,
348  const std::string& file,
349  QDP_volfmt_t volfmt, QDP_serialparallel_t serpar);
350 
351 
352  // Read a Chroma Fermion Field
353  /*
354  * \param file_xml file header ( Write )
355  * \param record_xml xml holding propagator info ( Write )
356  * \param fermion The Fermion ( Write )
357  * \param file path ( Read )
358  * \param serpar either QDPIO_SERIAL, QDPIO_PARALLEL ( Read )
359  */
360  void readFermion(XMLReader& file_xml,
361  XMLReader& record_xml,
362  LatticeFermion& fermion,
363  const std::string& file,
364  QDP_serialparallel_t serpar);
365 
366  /*! @} */ // end of group io
367 
368 } // end namespace Chroma
369 
370 #endif
QDP volfmt enum.
Enum for what spin components of a quark prop to compute.
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.
QuarkSpinType
Quark spin type.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Real getMass(const GroupXML_t &fermact)
Given a fermion action in std::string form, return the Mass.
Definition: qprop_io.cc:16
void readQprop(XMLReader &file_xml, XMLReader &record_xml, LatticePropagator &quark_prop, const std::string &file, QDP_serialparallel_t serpar)
Read a Chroma propagator.
Definition: qprop_io.cc:1573
void writeQprop(XMLBufferWriter &file_xml, XMLBufferWriter &record_xml, const LatticePropagator &quark_prop, const std::string &file, QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
Write a Chroma propagator.
Definition: qprop_io.cc:1532
multi1d< int > getFermActBoundary(const GroupXML_t &fermact)
Given a fermion action in std::string form, return the boundary.
Definition: qprop_io.cc:61
void readFermion(XMLReader &file_xml, XMLReader &record_xml, LatticeFermion &fermion, const std::string &file, QDP_serialparallel_t serpar)
Definition: qprop_io.cc:1631
void writeFermion(XMLBufferWriter &file_xml, XMLBufferWriter &record_xml, const LatticeFermion &fermion, const std::string &file, QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
Definition: qprop_io.cc:1613
::std::string string
Definition: gtest.h:1979
Multi-propagator parameters.
Definition: qprop_io.h:61
QuarkSpinType quarkSpinType
Definition: qprop_io.h:63
GroupXML_t fermact
String holding XML of the FermionAction section.
Definition: qprop_io.h:66
multi1d< Real > MultiMasses
Definition: qprop_io.h:69
Propagator parameters.
Definition: qprop_io.h:75
GroupXML_t invParam
Definition: qprop_io.h:84
GroupXML_t fermact
Definition: qprop_io.h:80
QuarkSpinType quarkSpinType
Definition: qprop_io.h:77
Mega structure holding a full forward sink-smeared prop.
Definition: qprop_io.h:120
ChromaProp_t prop_header
Definition: qprop_io.h:122
PropSinkSmear_t sink_header
Definition: qprop_io.h:121
PropSourceConst_t source_header
Definition: qprop_io.h:123
std::string gauge_header
Definition: qprop_io.h:124
Hold group xml and type id.
Mega structure holding a propagator source.
Definition: qprop_io.h:103
std::string gauge_header
Definition: qprop_io.h:105
PropSourceConst_t source_header
Definition: qprop_io.h:104
Sink-smearing parameters.
Definition: qprop_io.h:51
Propagator source construction parameters.
Definition: qprop_io.h:27
multi1d< int > getMom() const
Definition: qprop_io.cc:161
multi1d< int > getTSrce() const
Definition: qprop_io.cc:120
Source-smearing parameters.
Definition: qprop_io.h:42
Mega structure holding a full forward prop (not sink smeared)
Definition: qprop_io.h:111
ChromaProp_t prop_header
Definition: qprop_io.h:112
std::string gauge_header
Definition: qprop_io.h:114
PropSourceConst_t source_header
Definition: qprop_io.h:113
Mega structure holding QQ diquark object.
Definition: qprop_io.h:171
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:174
Mega structure holding QQQ props.
Definition: qprop_io.h:180
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:185
multi1d< QQQSpinIndices_t > spin_indices
Definition: qprop_io.h:182
Hold source and sink spin indices for a sparse QQQ file.
Definition: qprop_io.h:163
multi1d< int > sink
Definition: qprop_io.h:165
multi1d< int > source
Definition: qprop_io.h:164
Mega structure holding QQbar props.
Definition: qprop_io.h:191
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:194
Mega structure holding a full sequential prop that is source smeared.
Definition: qprop_io.h:151
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:156
PropSinkSmear_t sink_header
Definition: qprop_io.h:154
PropSourceSmear_t smeared_seqprop_header
Definition: qprop_io.h:152
Sequential source parameters.
Definition: qprop_io.h:90
multi1d< int > sink_mom
Definition: qprop_io.h:95
GroupXML_t seqsrc
Definition: qprop_io.h:93
Mega structure holding a full sequential prop.
Definition: qprop_io.h:140
ChromaProp_t seqprop_header
Definition: qprop_io.h:141
PropSinkSmear_t sink_header
Definition: qprop_io.h:142
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:144
std::string gauge_header
Definition: qprop_io.h:145
SeqSource_t seqsource_header
Definition: qprop_io.h:143
Mega structure holding a full sequential source.
Definition: qprop_io.h:130
PropSinkSmear_t sink_header
Definition: qprop_io.h:131
multi1d< ForwardProp_t > forward_props
Definition: qprop_io.h:133
SeqSource_t seqsource_header
Definition: qprop_io.h:132
std::string gauge_header
Definition: qprop_io.h:134
Read an XML group as a std::string.