CHROMA
mesons2_w.cc
Go to the documentation of this file.
1 // $Id: mesons2_w.cc,v 1.1 2006-07-10 19:53:37 edwards Exp $
2 // $Log: mesons2_w.cc,v $
3 // Revision 1.1 2006-07-10 19:53:37 edwards
4 // A complex version.
5 //
6 // Revision 3.0 2006/04/03 04:59:00 edwards
7 // Major overhaul of fermion and gauge action interface. Basically,
8 // all fermacts and gaugeacts now carry out <T,P,Q> template parameters. These are
9 // the fermion type, the "P" - conjugate momenta, and "Q" - generalized coordinates
10 // in the sense of Hamilton's equations. The fermbc's have been rationalized to never
11 // be over multi1d<T>. The "createState" within the FermionAction is now fixed meaning
12 // the "u" fields are now from the coordinate type. There are now "ConnectState" that
13 // derive into FermState<T,P,Q> and GaugeState<P,Q>.
14 //
15 // Revision 2.1 2005/11/20 18:29:00 edwards
16 // Added parenthesis
17 //
18 // Revision 2.0 2005/09/25 21:04:35 edwards
19 // Moved to version 2.0
20 //
21 // Revision 1.21 2005/02/28 03:35:25 edwards
22 // Fixed doxygen comments.
23 //
24 // Revision 1.20 2005/01/14 18:42:36 edwards
25 // Converted all lib files to be in chroma namespace.
26 //
27 // Revision 1.19 2004/07/28 02:38:04 edwards
28 // Changed {START,END}_CODE("foo") to {START,END}_CODE().
29 //
30 // Revision 1.18 2004/02/11 12:51:34 bjoo
31 // Stripped out Read() and Write()
32 //
33 // Revision 1.17 2004/02/03 20:47:24 edwards
34 // Small code tweaks.
35 //
36 // Revision 1.16 2003/10/01 03:01:39 edwards
37 // Removed extraneous include.
38 //
39 // Revision 1.15 2003/09/29 21:31:36 edwards
40 // Tiny cosmetic change.
41 //
42 // Revision 1.14 2003/06/24 03:25:27 edwards
43 // Changed from nml to xml.
44 //
45 // Revision 1.13 2003/04/02 22:28:22 edwards
46 // Changed proto.h to qdp_util.h
47 //
48 // Revision 1.12 2003/04/01 03:27:26 edwards
49 // Added const to sftmom.
50 //
51 // Revision 1.11 2003/04/01 02:38:26 edwards
52 // Added doxygen comments.
53 //
54 // Revision 1.10 2003/03/14 21:51:54 flemingg
55 // Changes the way in which the nml data is output to match what's done
56 // in szin.
57 //
58 // Revision 1.9 2003/03/14 17:16:13 flemingg
59 // Variant 1 is now working with SftMom::sft(). In arbitrary units,
60 // the relative performance seems to be: V1) 7.5, V2) 10, V3) 100.
61 //
62 // Revision 1.8 2003/03/14 05:14:32 flemingg
63 // rewrite of mesons_w.cc to use the new SftMom class. mesons_w.cc still
64 // needs to be cleaned up once the best strategy is resolved. But for now,
65 // the library and test program compiles and runs.
66 //
67 // Revision 1.7 2003/03/06 03:38:35 edwards
68 // Added start/end_code.
69 //
70 // Revision 1.6 2003/03/06 02:07:12 flemingg
71 // Changed the MomList class to eliminate an unneeded class member.
72 //
73 // Revision 1.5 2003/03/06 00:30:14 flemingg
74 // Complete rewrite of lib/meas/hadron/mesons_w.cc, including a simple test
75 // program in mainprogs/tests built with 'make check' and various other
76 // changes to autoconf/make files to support this rewrite.
77 //
78 
79 #include "chromabase.h"
80 #include "util/ft/sftmom.h"
81 #include "meas/hadron/mesons_w.h"
82 
83 namespace Chroma {
84 
85 //! Meson 2-pt functions
86 /* This routine is specific to Wilson fermions!
87  *
88  * Construct meson propagators and writes in COMPLEX
89  *
90  * The two propagators can be identical or different.
91  *
92  * \param quark_prop_1 first quark propagator ( Read )
93  * \param quark_prop_2 second (anti-) quark propagator ( Read )
94  * \param t0 timeslice coordinate of the source ( Read )
95  * \param phases object holds list of momenta and Fourier phases ( Read )
96  * \param xml xml file object ( Write )
97  * \param xml_group std::string used for writing xml data ( Read )
98  *
99  * ____
100  * \
101  * m(t) = > < m(t_source, 0) m(t + t_source, x) >
102  * /
103  * ----
104  * x
105  */
106 
107 void mesons2(const LatticePropagator& quark_prop_1,
108  const LatticePropagator& quark_prop_2,
109  const SftMom& phases,
110  int t0,
111  XMLWriter& xml,
112  const std::string& xml_group)
113 {
114  START_CODE();
115 
116  // Length of lattice in decay direction
117  int length = phases.numSubsets();
118 
119  // Construct the anti-quark propagator from quark_prop_2
120  int G5 = Ns*Ns-1;
121  LatticePropagator anti_quark_prop = Gamma(G5) * quark_prop_2 * Gamma(G5);
122 
123  // This variant uses the function SftMom::sft() to do all the work
124  // computing the Fourier transform of the meson correlation function
125  // inside the class SftMom where all the of the Fourier phases and
126  // momenta are stored. It's primary disadvantage is that it
127  // requires more memory because it does all of the Fourier transforms
128  // at the same time.
129 
130  // Loop over gamma matrix insertions
131  XMLArrayWriter xml_gamma(xml,Ns*Ns);
132  push(xml_gamma, xml_group);
133 
134  for (int gamma_value=0; gamma_value < (Ns*Ns); ++gamma_value)
135  {
136  push(xml_gamma); // next array element
137  write(xml_gamma, "gamma_value", gamma_value);
138 
139  // Construct the meson correlation function
140  LatticeComplex corr_fn;
141  corr_fn = trace(adj(anti_quark_prop) * (Gamma(gamma_value) *
142  quark_prop_1 * Gamma(gamma_value)));
143 
144  multi2d<DComplex> hsum;
145  hsum = phases.sft(corr_fn);
146 
147  // Loop over sink momenta
148  XMLArrayWriter xml_sink_mom(xml_gamma,phases.numMom());
149  push(xml_sink_mom, "momenta");
150 
151  for (int sink_mom_num=0; sink_mom_num < phases.numMom(); ++sink_mom_num)
152  {
153  push(xml_sink_mom);
154  write(xml_sink_mom, "sink_mom_num", sink_mom_num);
155  write(xml_sink_mom, "sink_mom", phases.numToMom(sink_mom_num));
156 
157  multi1d<DComplex> mesprop(length);
158  for (int t=0; t < length; ++t)
159  {
160  int t_eff = (t - t0 + length) % length;
161  mesprop[t_eff] = hsum[sink_mom_num][t];
162  }
163 
164  write(xml_sink_mom, "mesprop", mesprop);
165  pop(xml_sink_mom);
166 
167  } // end for(sink_mom_num)
168 
169  pop(xml_sink_mom);
170  pop(xml_gamma);
171  } // end for(gamma_value)
172 
173  pop(xml_gamma);
174 
175  END_CODE();
176 }
177 
178 } // end namespace Chroma
Primary include file for CHROMA library code.
Fourier transform phase factor support.
Definition: sftmom.h:35
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
multi1d< int > numToMom(int mom_num) const
Convert momenta id to actual array of momenta.
Definition: sftmom.h:78
multi2d< DComplex > sft(const LatticeComplex &cf) const
Do a sumMulti(cf*phases,getSet())
Definition: sftmom.cc:524
int numMom() const
Number of momenta.
Definition: sftmom.h:60
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
int t
Definition: meslate.cc:37
Meson 2-pt functions.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
push(xml_out,"Condensates")
void mesons2(const LatticePropagator &quark_prop_1, const LatticePropagator &quark_prop_2, const SftMom &phases, int t0, XMLWriter &xml, const std::string &xml_group)
Meson 2-pt functions.
Definition: mesons2_w.cc:107
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
Fourier transform phase factor support.