CHROMA
t_follana_io_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"
8 
9 using namespace Chroma;
10 
11 
12 
13 //! Function object used for constructing the time-slice set
14 class TimeSliceFunc : public SetFunc
15 {
16 public:
17  TimeSliceFunc(int dir): dir_decay(dir) {}
18 
19  int operator() (const multi1d<int>& coordinate) const {return coordinate[dir_decay];}
20  int numSubsets() const {return Layout::lattSize()[dir_decay];}
21 
22  int dir_decay;
23 
24 private:
25  TimeSliceFunc() {} // hide default constructor
26 };
27 
28 
29 
30 int main(int argc, char *argv[])
31 {
32  // Put the machine into a known state
33  Chroma::initialize(&argc, &argv);
34 
35  XMLReader xml_in("input.xml");
36 
37  // XML File will look like this
38  //
39  // <? xml version="1.0" ?>
40  // <test>
41  // <nrow>X Y Z T</nrow>
42  // <infile>filename_of_propagator</infile>
43  // </test>
44  //
45  multi1d<int> nrow(Nd);
46  std::string filename;
47 
48  read(xml_in, "/test/nrow", nrow);
49  read(xml_in, "/test/infile", filename);
50 
51 
52 
53  Layout::setLattSize(nrow);
54  Layout::create();
55 
56  QDPIO::cout << "Lattice: Lx = " << nrow[0] << " Ly = " << nrow[1] << " Lz = " << nrow[2]
57  << " Lt =" << nrow[3] << std::endl;
58 
59  QDPIO::cout << "Reading Propagator from file " << filename << std::endl;
60 
61  // Try and read the propagator;
62 
63  LatticePropagator qprop= zero;
64  readQpropFollana((char *)filename.c_str(), qprop);
65 
66  LatticeComplex corr_fn = trace(adj(qprop)*qprop);
67 
68  Set timeslice;
69  timeslice.make(TimeSliceFunc(3));
70 
71  /* Project on zero momentum: Do a slice-wise sum. */
72  multi1d<DComplex> hsum(nrow[3]);
73 
74  hsum = sumMulti(corr_fn, timeslice);
75 
76  XMLFileWriter xml_out("output.xml");
77 
78  push(xml_out, "follanaIO");
79  write(xml_out, "hsum", hsum);
80  pop(xml_out);
81 
82  multi1d<LatticeReal> meson_phases(Nd);
83 
84  MesPhas(meson_phases, 3);
85  // Time to bolt
87  exit(0);
88 
89 }
Primary include file for CHROMA in application codes.
Function object used for constructing the time-slice set.
Definition: barQll_w.h:95
int operator()(const multi1d< int > &coordinate) const
Definition: barQll_w.h:99
TimeSliceFunc(int dir)
int numSubsets() const
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.
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")
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)
void MesPhas(multi1d< LatticeReal > &meson_phases, int j_decay)
Definition: mesphas_s.cc:16
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
int main(int argc, char *argv[])