CHROMA
wilson_coarse_fine_1loop_gaugeact.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson gauge action supporting 2+2 anisotropy.
3  *
4  * Wilson gauge action on a 2+2 lattice.
5  * Follows the conventions of hep-lat/0303005 (TrinLat).
6  * Here, coefficients are for 1-loop.
7  */
8 
9 #include "chromabase.h"
13 
14 namespace Chroma
15 {
16 
17  namespace WilsonCoarseFine1LoopGaugeActEnv
18  {
20  multi1d<LatticeColorMatrix> >* createGaugeAct(XMLReader& xml,
21  const std::string& path)
22  {
25  }
26 
27  const std::string name = "WILSON_COARSE_FINE_1LOOP_GAUGEACT";
28 
29  //! Local registration flag
30  static bool registered = false;
31 
32  //! Register all the factories
33  bool registerAll()
34  {
35  bool success = true;
36  if (! registered)
37  {
38  success &= TheGaugeActFactory::Instance().registerObject(name, createGaugeAct);
39  registered = true;
40  }
41  return success;
42  }
43  }
44 
45 
47  const std::string& path)
48  {
49  XMLReader paramtop(xml_in, path);
50 
51  try
52  {
53  read(paramtop, "beta", beta);
54  read(paramtop, "coarse_dirs", coarse_dirs);
55  read(paramtop, "xi", xi);
56  read(paramtop, "coeff_ff", coeff_ff);
57  read(paramtop, "coeff_cc", coeff_cc);
58  }
59  catch( const std::string& e )
60  {
61  QDPIO::cerr << __func__ << ": Error reading XML: " << e << std::endl;
62  QDP_abort(1);
63  }
64  }
65 
66  void read(XMLReader& xml, const std::string& path, WilsonCoarseFine1LoopGaugeActParams& p)
67  {
69  p = tmp;
70  }
71 
72  void write(XMLWriter& xml, const std::string& path, const WilsonCoarseFine1LoopGaugeActParams& p)
73  {
74  push(xml, path);
75 
76  int version = 1;
77 
78  write(xml, "version", version);
79  write(xml, "beta", p.beta);
80  write(xml, "coarse_dirs", p.coarse_dirs);
81  write(xml, "xi", p.xi);
82  write(xml, "coeff_ff", p.coeff_ff);
83  write(xml, "coeff_cc", p.coeff_cc);
84 
85  pop(xml);
86  }
87 
88 
89 
90  //! Read beta from a param struct
93  : param(p)
94  {
95  init(cgs);
96  }
97 
98 
99  // Private initializer
100  void
102  {
103  START_CODE();
104 
105  // Sanity check. Insist there are 2 coarse and 2 fine directions
106  if (param.coarse_dirs.size() != 4 || Nd != 4)
107  {
108  QDPIO::cerr << WilsonCoarseFine1LoopGaugeActEnv::name << ": coarse_dirs and Nd must be size=4" << std::endl;
109  QDP_abort(1);
110  }
111 
112  int cnt = 0;
113  for(int i=0; i < param.coarse_dirs.size(); ++i)
114  {
115  if (param.coarse_dirs[i]) ++cnt;
116  }
117 
118  if (cnt != 2)
119  {
120  QDPIO::cerr << WilsonCoarseFine1LoopGaugeActEnv::name << ": not 2 coarse dirs" << std::endl;
121  QDP_abort(1);
122  }
123 
124 
125  // Fold in normalizations
126  multi2d<Real> coeffs(Nd,Nd);
127  coeffs = zero;
128 
129  Real g2 = 2.0*Nc / param.beta;
130  Real xi2 = param.xi * param.xi;
131  Real c_ff = param.beta * (1.0 + param.coeff_ff*g2) * xi2;
132  Real c_cc = param.beta * (1.0 + param.coeff_cc*g2) / xi2;
133  Real c_cf = param.beta;
134 
135  for(int mu = 0; mu < Nd; ++mu)
136  {
137  for(int nu = mu+1; nu < Nd; ++nu)
138  {
139  if( (! param.coarse_dirs[mu]) && (! param.coarse_dirs[nu]) )
140  {
141  // Fine-fine Plaquette in either mu or nu direction
142  coeffs[mu][nu] = c_ff;
143  }
144  else if( param.coarse_dirs[mu] && param.coarse_dirs[nu] )
145  {
146  // Coarse-coarse Plaquette in either mu or nu direction
147  coeffs[mu][nu] = c_cc;
148  }
149  else
150  {
151  // Coarse-fine or fine-coarse Plaquette
152  coeffs[mu][nu] = c_cf;
153  }
154 
155  coeffs[nu][mu] = coeffs[mu][nu];
156  }
157  }
158 
159  // Create gauge action
160  PlaqGaugeActParams plaq_param;
161  plaq_param.coeffs = coeffs;
162  plaq = new PlaqGaugeAct(cgs,plaq_param);
163 
164  END_CODE();
165  }
166 
167 }
168 
Primary include file for CHROMA library code.
Create a gauge connection state.
Definition: create_state.h:47
Abstract base class for gauge actions.
Definition: gaugeact.h:25
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
void init(Handle< CreateGaugeState< P, Q > > cgs)
Private initializer.
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
All gauge create-state method.
Fermion action factories.
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
Handle< CreateGaugeState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the CreateGaugeState readers.
GaugeAction< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createGaugeAct(XMLReader &xml, const std::string &path)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
START_CODE()
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
Parameter structure.
Definition: plaq_gaugeact.h:26
Wilson gauge action supporting 2+2 anisotropy.