CHROMA
quark_flavor_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Derivative displacements
3  */
4 
5 #include "chromabase.h"
6 
10 
11 namespace Chroma
12 {
13 
14  // Read parameters
15  void read(XMLReader& xml, const std::string& path, StaggeredQuarkFlavorOpEnv::Params& param)
16  {
18  param = tmp;
19  }
20 
21  // Writer
22  void write(XMLWriter& xml, const std::string& path, const StaggeredQuarkFlavorOpEnv::Params& param)
23  {
24  param.writeXML(xml, path);
25  }
26 
27 
28  //! Staggered Flavored sources
29  /*! \ingroup sources */
30  namespace StaggeredQuarkFlavorOpEnv
31  {
32  //! Anonymous namespace
33  namespace
34  {
35 
36  //! Determine sign of plusminus
37  /*!
38  * \ingroup sources
39  */
40  int plusMinus(enum PlusMinus isign)
41  {
42  int is = 0;
43  switch (isign)
44  {
45  case PLUS:
46  is = +1;
47  break;
48 
49  case MINUS:
50  is = -1;
51  break;
52 
53  default:
54  QDP_error_exit("illegal isign in plusminus");
55  }
56  return is;
57  }
58 
59 
60  //-------------------- callback functions ------------------
61 
62  //! Construct (right Nabla) source
63  QuarkDisplacement<LatticeStaggeredPropagator>* scalar(XMLReader& xml_in,const std::string& path){
64  return new StaggeredScalarOp<LatticeStaggeredPropagator>(Params(xml_in, path));
65  }
66 
67  QuarkDisplacement<LatticeStaggeredPropagator>* Vector(XMLReader& xml_in,const std::string& path){
69  }
70 
71  QuarkDisplacement<LatticeStaggeredPropagator>* axial_vector(XMLReader& xml_in,const std::string& path){
73  }
74 
75  QuarkDisplacement<LatticeStaggeredPropagator>* tensor(XMLReader& xml_in,const std::string& path){
77  }
78 
79  QuarkDisplacement<LatticeStaggeredPropagator>* pseudo_scalar(XMLReader& xml_in,const std::string& path){
81  }
82 
83 
84  } // end anonymous namespace
85 
86 
87  //! Initialize
89  { }
90 
91  //! Read parameters
92  Params::Params(XMLReader& xml, const std::string& path)
93  {
94  XMLReader paramtop(xml, path);
95 
96  int version;
97  read(paramtop, "version", version);
98 
99  switch (version)
100  {
101  case 1:
102  read(paramtop, "DisplacementType", FlavorOp);
103  break;
104 
105  default:
106  QDPIO::cerr << __func__ << ": parameter version " << version
107  << " unsupported." << std::endl;
108  QDP_abort(1);
109  }
110 
111  QDPIO::cout<<"Staggered Flavor Operator= "<<FlavorOp<<std::endl;
112 
113  }
114 
115  // Writer
116  void Params::writeXML(XMLWriter& xml, const std::string& path) const
117  {
118  push(xml, path);
119 
120  int version = 1;
121  QDP::write(xml, "version", version);
122 
123  write(xml, "DisplacementType", FlavorOp);
124 
125  pop(xml);
126  }
127 
128 
129  //! Read parameters
130  ParamsOneIndex::ParamsOneIndex(XMLReader& xml, const std::string& path)
131  {
132  XMLReader paramtop(xml, path);
133 
134  int version;
135  read(paramtop, "version", version);
136 
137  switch (version)
138  {
139  case 1:
140  read(paramtop, "DisplacementType", FlavorOp);
141  read(paramtop, "mu", mu);
142 
143  break;
144 
145  default:
146  QDPIO::cerr << __func__ << ": parameter version " << version
147  << " unsupported." << std::endl;
148  QDP_abort(1);
149  }
150 
151  QDPIO::cout<<"Staggered Flavor Operator= "<<FlavorOp<<"("<<mu<<")"<<std::endl;
152 
153  }
154 
155  // Writer
156  void ParamsOneIndex::writeXML(XMLWriter& xml, const std::string& path) const
157  {
158  push(xml, path);
159 
160  int version = 1;
161  QDP::write(xml, "version", version);
162 
163  write(xml, "DisplacementType", FlavorOp);
164  write(xml, "mu", mu);
165 
166  pop(xml);
167  }
168 
169 
170  //! Read parameters
171  ParamsTwoIndex::ParamsTwoIndex(XMLReader& xml, const std::string& path)
172  {
173  XMLReader paramtop(xml, path);
174 
175  int version;
176  read(paramtop, "version", version);
177 
178  switch (version)
179  {
180  case 1:
181  read(paramtop, "DisplacementType", FlavorOp);
182  read(paramtop, "mu", mu);
183  read(paramtop, "nu", nu);
184 
185  break;
186 
187  default:
188  QDPIO::cerr << __func__ << ": parameter version " << version
189  << " unsupported." << std::endl;
190  QDP_abort(1);
191 
192  QDPIO::cout<<"Staggered Flavor Operator= "<<FlavorOp ;
193  QDPIO::cout<<"("<<mu<<","<<nu<<")"<<std::endl;
194  }
195 
196  }
197 
198  // Writer
199  void ParamsTwoIndex::writeXML(XMLWriter& xml, const std::string& path) const
200  {
201  push(xml, path);
202 
203  int version = 1;
204  QDP::write(xml, "version", version);
205 
206  write(xml, "DisplacementType", FlavorOp);
207  write(xml, "mu", mu);
208  write(xml, "nu", nu);
209 
210  pop(xml);
211  }
212 
213  // Construct scalar source
214  // See corresponding .h file for doxygen comments
215  template<>
216  void
218  const multi1d<LatticeColorMatrix>& u,
219  enum PlusMinus isign) const
220  {
221  START_CODE();
222 
223  //set up a point source
224 
225  END_CODE();
226  }
227 
228 
229  // Construct pseudoscalar source
230  // See corresponding .h file for doxygen comments
231  template<>
232  void
234  const multi1d<LatticeColorMatrix>& u,
235  enum PlusMinus isign) const
236  {
237  START_CODE();
238 
239  LatticeStaggeredPropagator tt(tmp) ;
240 
241  FlavorPseudoScalar(tmp, tt, u) ;
242 
243  END_CODE();
244  }
245 
246  // Construct Vector source
247  // See corresponding .h file for doxygen comments
248  template<>
249  void
251  const multi1d<LatticeColorMatrix>& u,
252  enum PlusMinus isign) const
253  {
254  START_CODE();
255  LatticeStaggeredPropagator tt(tmp) ;
256 
257  FlavorVector(tmp, tt, u, params.mu) ;
258 
259  END_CODE();
260  }
261 
262  // Construct axial Vector source
263  // See corresponding .h file for doxygen comments
264  template<>
265  void
267  const multi1d<LatticeColorMatrix>& u,
268  enum PlusMinus isign) const
269  {
270  START_CODE();
271 
272  LatticeStaggeredPropagator tt(tmp) ;
273 
274  FlavorAxialVector(tmp, tt, u, params.mu) ;
275 
276  END_CODE();
277  }
278 
279 
280  // Construct Vector source
281  // See corresponding .h file for doxygen comments
282  template<>
283  void
285  const multi1d<LatticeColorMatrix>& u,
286  enum PlusMinus isign) const
287  {
288  START_CODE();
289 
290  LatticeStaggeredPropagator tt(tmp) ;
291 
292  FlavorTensor(tmp, tt, u, params.mu, params.nu) ;
293 
294  END_CODE();
295  }
296 
297  //! Local registration flag
298  static bool registered = false;
299 
300  //! Register all the possible deriv mesons
301  bool registerAll()
302  {
303  bool success = true;
304  if (! registered)
305  {
306  //! Register all the factories
307  success &= Chroma::TheStagPropDisplacementFactory::Instance().registerObject(std::string("SCALAR_STAG_FLAV"), scalar);
308  success &= Chroma::TheStagPropDisplacementFactory::Instance().registerObject(std::string("VECTOR_STAG_FLAV"), Vector);
309  success &= Chroma::TheStagPropDisplacementFactory::Instance().registerObject(std::string("AXIAL_VECTOR_STAG_FLAV"), axial_vector);
310  success &= Chroma::TheStagPropDisplacementFactory::Instance().registerObject(std::string("TENSOR_STAG_FLAV"), tensor);
311  success &= Chroma::TheStagPropDisplacementFactory::Instance().registerObject(std::string("PSEUDO_SCALAR_STAG_FLAV"), pseudo_scalar);
312 
313  registered = true;
314  }
315  return success;
316  }
317  } // end namespace StaggeredQuarkFlavorOpEnv
318 
319 } // end namespace Chroma
320 
321 
322 
323 
Primary include file for CHROMA library code.
Base class for quark displacement.
static T & Instance()
Definition: singleton.h:432
Construct staggered axial std::vector flavored sources.
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u, enum PlusMinus isign) const
Displace the quark.
Construct staggered pseudo scalar flavored sources.
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u, enum PlusMinus isign) const
Displace the quark.
Construct staggered scalar flavored sources.
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u, enum PlusMinus isign) const
Displace the quark.
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u, enum PlusMinus isign) const
Displace the quark.
Construct staggered std::vector flavored sources.
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u, enum PlusMinus isign) const
Displace the quark.
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.
void write(XMLWriter &xml, const std::string &path, const StaggeredQuarkFlavorOpEnv::Params &param)
Writer.
Params params
void FlavorPseudoScalar(T &dest, const T &src, const G &u)
void FlavorTensor(T &dest, const T &src, const G &u, const int mu, const int nu)
void FlavorVector(T &dest, const T &src, const G &u, const int mu)
void FlavorAxialVector(T &dest, const T &src, const G &u, const int mu)
bool registerAll()
Register all the possible deriv mesons.
static bool registered
Local registration flag.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
All quark displacement constructors.
Factory for producing quark displacement objects.
Staggered Flavor operators.
void writeXML(XMLWriter &in, const std::string &path) const
void writeXML(XMLWriter &in, const std::string &path) const
Params for derivative quark displacement.
void writeXML(XMLWriter &in, const std::string &path) const