CHROMA
phase_stout_link_smearing.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Stout link smearing
3  */
4 
5 #include "chromabase.h"
6 
9 
10 namespace Chroma
11 {
12 
13  // Read parameters
14  void read(XMLReader& xml, const std::string& path, PhaseStoutLinkSmearingEnv::Params& param)
15  {
17  param = tmp;
18  }
19 
20  //! Parameters for running code
21  void write(XMLWriter& xml, const std::string& path, const PhaseStoutLinkSmearingEnv::Params& param)
22  {
23  param.writeXML(xml, path);
24  }
25 
26 
27  //! Hooks to register the class
28  namespace PhaseStoutLinkSmearingEnv
29  {
30  namespace
31  {
32  //! Callback function
33  LinkSmearing* createSource(XMLReader& xml_in,
34  const std::string& path)
35  {
36  return new LinkSmear(Params(xml_in, path));
37  }
38 
39  //! Local registration flag
40  bool registered = false;
41 
42  //! Name to be used
43  const std::string name = "PHASE_STOUT_SMEAR";
44  }
45 
46  //! Return the name
47  std::string getName() {return name;}
48 
49  //! Register all the factories
50  bool registerAll()
51  {
52  bool success = true;
53  if (! registered)
54  {
55  success &= Chroma::TheLinkSmearingFactory::Instance().registerObject(name, createSource);
56  registered = true;
57  }
58  return success;
59  }
60 
61 
62  //! Parameters for running code
63  Params::Params(XMLReader& xml, const std::string& path) : StoutLinkSmearingEnv::Params(xml,path)
64  {
65  XMLReader paramtop(xml, path);
66  read(paramtop, "k", k);
67  read(paramtop, "zeta", zeta);
68  }
69 
70 
71  //! Parameters for running code
72  void Params::writeXML(XMLWriter& xml, const std::string& path) const
73  {
74  push(xml, path);
75 
76  int version = 1;
77  write(xml, "version", version);
78  write(xml, "LinkSmearingType", PhaseStoutLinkSmearingEnv::name);
79  write(xml, "link_smear_num", link_smear_num);
80  write(xml, "link_smear_fact", link_smear_fact);
81  write(xml, "smear_dirs", smear_dirs);
82  write(xml,"k",k);
83  write(xml,"zeta",zeta);
84  pop(xml);
85  }
86 
87 
88  //! Smear the links
89  void
90  LinkSmear::operator()(multi1d<LatticeColorMatrix>& u) const
91  {
92  // Now stout smear
94  ss(u);
95  for(int d(0);d<Nd;d++)
96  if(params.smear_dirs[d]){
97  if(params.k[d]!=0){
98  QDPIO::cout<<" Adding phase to direction: "<<d<<std::endl ;
99  Real f = twopi / Real(Layout::lattSize()[d])*
100  params.zeta*Real(params.k[d]) ;
101  Complex c = cmplx(cos(f),sin(f)) ;
102  QDPIO::cout<<" exp(i*phase)= "<<c<<std::endl ;
103  QDPIO::cout<<" 2*pi= "<<twopi<<std::endl ;
104  u[d]*=c ;
105  }
106  }
107  }
108  }
109 }
110 
111 
Primary include file for CHROMA library code.
Base class for link smearing.
Definition: link_smearing.h:19
void operator()(multi1d< LatticeColorMatrix > &u) const
Smear the links.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.
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.
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")
Double c
Definition: invbicg.cc:108
const Real twopi
Definition: chromabase.h:55
pop(xml_out)
DComplex d
Definition: invbicg.cc:99
::std::string string
Definition: gtest.h:1979