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