CHROMA
hyp_link_smearing.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Hyp link smearing
3  */
4 
5 #include "chromabase.h"
6 
9 #include "meas/smear/hyp_smear.h"
10 #include "meas/smear/hyp_smear3d.h"
11 
12 namespace Chroma
13 {
14 
15  // Read parameters
16  void read(XMLReader& xml, const std::string& path, HypLinkSmearingEnv::Params& param)
17  {
19  param = tmp;
20  }
21 
22  //! Parameters for running code
23  void write(XMLWriter& xml, const std::string& path, const HypLinkSmearingEnv::Params& param)
24  {
25  param.writeXML(xml, path);
26  }
27 
28 
29  //! Hooks to register the class
30  namespace HypLinkSmearingEnv
31  {
32  namespace
33  {
34  //! Callback function
35  LinkSmearing* createSource(XMLReader& xml_in,
36  const std::string& path)
37  {
38  return new LinkSmear(Params(xml_in, path));
39  }
40 
41  //! Local registration flag
42  bool registered = false;
43 
44  //! Name to be used
45  const std::string name = "HYP_SMEAR";
46  }
47 
48  //! Return the name
49  std::string getName() {return name;}
50 
51  //! Register all the factories
52  bool registerAll()
53  {
54  bool success = true;
55  if (! registered)
56  {
57  success &= Chroma::TheLinkSmearingFactory::Instance().registerObject(name, createSource);
58  registered = true;
59  }
60  return success;
61  }
62 
63 
64  //! Parameters for running code
65  Params::Params(XMLReader& xml, const std::string& path)
66  {
67  XMLReader paramtop(xml, path);
68 
69  int version;
70  read(paramtop, "version", version);
71  num_smear = 1;
72  no_smear_dir = -1;
73  BlkMax = 100;
74  BlkAccu = 1.0e-5;
75 
76  switch (version)
77  {
78  case 2:
79  break;
80 
81  case 3:
82  read(paramtop, "num_smear", num_smear);
83  break;
84 
85  case 4:
86  read(paramtop, "num_smear", num_smear);
87  read(paramtop, "no_smear_dir", no_smear_dir);
88  break;
89 
90  case 5:
91  read(paramtop, "num_smear", num_smear);
92  read(paramtop, "no_smear_dir", no_smear_dir);
93  read(paramtop, "BlkMax", BlkMax);
94  read(paramtop, "BlkAccu", BlkAccu);
95  break;
96 
97  default :
98  QDPIO::cerr << "Input parameter version " << version << " unsupported." << std::endl;
99  QDP_abort(1);
100  }
101 
102  read(paramtop, "alpha1", alpha1);
103  read(paramtop, "alpha2", alpha2);
104  read(paramtop, "alpha3", alpha3);
105  }
106 
107 
108  //! Parameters for running code
109  void Params::writeXML(XMLWriter& xml, const std::string& path) const
110  {
111  push(xml, path);
112 
113  int version = 5;
114  write(xml, "version", version);
115  write(xml, "LinkSmearingType", name);
116 
117  /* this version allows a variable num_smear */
118  write(xml, "alpha1", alpha1);
119  write(xml, "alpha2", alpha2);
120  write(xml, "alpha3", alpha3);
121  write(xml, "num_smear", num_smear);
122  write(xml, "no_smear_dir", num_smear);
123  write(xml, "BlkMax", BlkMax);
124  write(xml, "BlkAccu", BlkAccu);
125 
126  pop(xml);
127  }
128 
129 
130  //! Smear the links
131  void
132  LinkSmear::operator()(multi1d<LatticeColorMatrix>& u) const
133  {
134  // Now hyp smear
135  if (params.num_smear > 0)
136  {
137  QDPIO::cout << "Hyp Smear gauge field" << std::endl;
138 
139  for (int n = 0; n < params.num_smear; n++)
140  {
141  multi1d<LatticeColorMatrix> u_hyp(Nd);
142 
143  if (params.no_smear_dir < 0 || params.no_smear_dir >= Nd)
144  Hyp_Smear(u, u_hyp,
147  else
148  Hyp_Smear3d(u, u_hyp,
151 
152  u = u_hyp;
153  }
154 
155  QDPIO::cout << "Gauge field Hyp-smeared!" << std::endl;
156  }
157  }
158 
159  }
160 }
Primary include file for CHROMA library code.
void operator()(multi1d< LatticeColorMatrix > &u) const
Smear the links.
Base class for link smearing.
Definition: link_smearing.h:19
static T & Instance()
Definition: singleton.h:432
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 Hyp_Smear(const multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &u_hyp, const Real &alpha1, const Real &alpha2, const Real &alpha3, const Real &BlkAccu, int BlkMax)
Construct the "hyp-smeared" links of Anna Hasenfratz.
Definition: hyp_smear.cc:30
void Hyp_Smear3d(const multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &u_hyp, const Real &alpha1, const Real &alpha2, const Real &alpha3, const Real &BlkAccu, int BlkMax, int j_decay)
Construct the "hyp-smeared" links of Anna Hasenfratz involving only the spatial links.
Definition: hyp_smear3d.cc:31
Hyp smear a gauge field.
Hyp smear a gauge field.
unsigned n
Definition: ldumul_w.cc:36
Nd
Definition: meslate.cc:74
static bool registered
Local registration flag.
const std::string name
Name to be used.
GaugeInit * createSource(XMLReader &xml_in, const std::string &path)
Callback function.
bool registerAll()
Register all the factories.
std::string getName()
Return the name.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Params for Hyp link smearing.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.