CHROMA
t_follana_pion_s.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <cstdio>
4 
5 #include "chroma.h"
6 #include "io/follana_io_s.h"
7 #include "meas/hadron/pions_follana_s.h"
8 
9 using namespace Chroma;
10 
11 
12 
13 int main(int argc, char *argv[])
14 {
15  // Put the machine into a known state
16  Chroma::initialize(&argc, &argv);
17 
18  XMLReader xml_in("input.xml");
19 
20  // XML File will look like this
21  //
22  // <? xml version="1.0" ?>
23  // <test>
24  // <nrow>X Y Z T</nrow>
25  // <propStem>stem_for_prop_filenames</propStem>
26  // </test>
27  //
28  multi1d<int> nrow(Nd);
29  std::string filename_stem;
30  std::string filename;
31 
32 
33  read(xml_in, "/test/nrow", nrow);
34  read(xml_in, "/test/propStem", filename_stem);
35 
36 
37 
38  Layout::setLattSize(nrow);
39  Layout::create();
40 
41  QDPIO::cout << "Lattice: Lx = " << nrow[0] << " Ly = " << nrow[1] << " Lz = " << nrow[2]
42  << " Lt =" << nrow[3] << std::endl;
43 
44 
45  QDPIO::cout << "About to read propagators" << std::endl;
46 
47  int i;
48  multi1d<LatticePropagator> props(NUM_STAG_PROPS);
49 
50  for(i = 0; i < NUM_STAG_PROPS; i++) {
51  std::ostringstream istring;
52  istring << "." << i;
53 
54  filename = filename_stem + istring.str();;
55  QDPIO::cout << "Reading Propagator from file " << filename.c_str() << std::endl;
56 
57  // Try and read the propagator;
58 
59  props[i] = zero;
60  readQpropFollana((char *)filename.c_str(), props[i], true);
61  }
62 
63  QDPIO::cout << "Computing the meaning of life..." << std::endl;
64 
65  multi2d<DComplex> pions(NUM_STAG_PIONS, nrow[3]);
66  staggeredPionsFollana(props, pions, Nd-1);
67 
68  XMLFileWriter xml_out("output.xml");
69 
70  push(xml_out, "follanaIO");
71  for(i=0; i < NUM_STAG_PIONS; i++) {
72  std::ostringstream tag;
73  tag << "pion" << i;
74  push(xml_out, tag.str());
75  write(xml_out, "pions_i", pions[i]);
76  pop(xml_out);
77  }
78 
79  pop(xml_out);
80 
81  QDPIO::cout << "That's all folks" << std::endl;
82  // Time to bolt
84  exit(0);
85 }
Primary include file for CHROMA in application codes.
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.
#define NUM_STAG_PIONS
Definition: hadron_corr_s.h:6
#define NUM_STAG_PROPS
Definition: hadron_corr_s.h:5
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void readQpropFollana(char file[], LatticePropagator &quark_prop, bool swap)
Definition: follana_io_s.cc:16
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
pop(xml_out)
Double zero
Definition: invbicg.cc:106
std::string tag(const std::string &prefix)
Definition: octave.h:15
::std::string string
Definition: gtest.h:1979
int main(int argc, char *argv[])