CHROMA
character_gaugeact.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Plaquette gauge action as sum of characters
3  */
4 
5 #include "chromabase.h"
10 #include "io/aniso_io.h"
11 
12 namespace Chroma
13 {
14 
15  namespace CharacterGaugeActEnv
16  {
17  namespace
18  {
20  multi1d<LatticeColorMatrix> >* createGaugeAct(XMLReader& xml,
21  const std::string& path)
22  {
23  return new GaugeAct(CreateGaugeStateEnv::reader(xml, path),
24  Params(xml, path));
25  }
26 
27  const std::string name = "CHARACTER_GAUGEACT";
28 
29  //! Local registration flag
30  static bool registered = false;
31  }
32 
33  //! Register all the factories
34  bool registerAll()
35  {
36  bool success = true;
37  if (! registered)
38  {
39  success &= TheGaugeActFactory::Instance().registerObject(name, createGaugeAct);
40  registered = true;
41  }
42  return success;
43  }
44 
45 
46  Params::Params(XMLReader& xml_in, const std::string& path)
47  {
48  XMLReader paramtop(xml_in, path);
49 
50  try
51  {
52  read(paramtop, "beta_F", beta_F);
53  read(paramtop, "beta_A", beta_A);
54  read(paramtop, "beta_S", beta_S);
55  }
56  catch( const std::string& e ) {
57  QDPIO::cerr << "Error reading XML: " << e << std::endl;
58  QDP_abort(1);
59  }
60  }
61 
62 
63  //! Compute the action
65  {
66  // Action at the site level
67  multi2d<LatticeColorMatrix> plq;
68  this->siteAction(plq, state);
69 
70  // Total action
71  // Fundamental part
72  Double act_F = zero;
73  Double act_A = zero;
74  Double act_S = zero;
75  Double three = Nc;
76  Double nine = Nc*Nc ;
77  Double sext = Nc*Nc+Nc ;
78 
79  for(int mu=1; mu < Nd; ++mu)
80  {
81  for(int nu=0; nu < mu; ++nu)
82  {
83  LatticeComplex plaq=trace(plq[mu][nu]);
84  // Sum over plaquettes
85  act_F += sum(real(plaq)-three);
86  act_A += sum(localNorm2(plaq) - nine);
87  act_S += sum(real(trace(plq[mu][nu]*plq[mu][nu])+plaq*plaq)-sext);
88  }
89  }
90 
91  // Normalize
92  Real act = -(param.beta_F / Real(Nc)) * act_F - (param.beta_A/Real(Nc*Nc)) * act_A - 0.5*param.beta_S*(act_S/sext);
93 
94  return act;
95  }
96 
97 
98  //! Compute the plaquette
99  void GaugeAct::siteAction(multi2d<LatticeColorMatrix>& plq, const Handle< GaugeState<P,Q> >& state) const
100  {
101  START_CODE();
102 
103  // Initialize
104  plq.resize(Nd,Nd);
105  plq = zero;
106 
107  // Handle< const GaugeState<P,Q> > u_bc(createState(u));
108  // Apply boundaries
109  const multi1d<LatticeColorMatrix>& u = state->getLinks();
110 
111  // Compute the average plaquettes
112  for(int mu=1; mu < Nd; ++mu)
113  {
114  for(int nu=0; nu < mu; ++nu)
115  {
116  /* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
117  /* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
118  /* wplaq_tmp = tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu)) */
119  plq[mu][nu] += (u[mu]*shift(u[nu],FORWARD,mu)*adj(shift(u[mu],FORWARD,nu))*adj(u[nu])) ;
120 
121  // Keep a copy
122  plq[nu][mu] = plq[mu][nu];
123  }
124  }
125 
126 
127  END_CODE();
128  }
129 
130 
131  //! Compute staple
132  /*! Default version. Derived class should override this if needed. */
133  void GaugeAct::staple(LatticeColorMatrix& result,
134  const Handle< GaugeState<P,Q> >& state,
135  int mu, int cb) const
136  {
137  QDPIO::cerr << __func__ << ": staple not possible\n";
138  QDP_abort(1);
139  }
140 
141 
142  //! Compute dS/dU
143  void GaugeAct::deriv(multi1d<LatticeColorMatrix>& ds_u,
144  const Handle< GaugeState<P,Q> >& state) const
145  {
146  START_CODE();
147 
148  LatticeColorMatrix tmp_1;
149  LatticeColorMatrix tmp_2;
150 
151  const multi1d<LatticeColorMatrix>& u = state->getLinks();
152  multi1d<LatticeColorMatrix> deriv_fun(Nd);
153  multi1d<LatticeColorMatrix> deriv_adj(Nd);
154  multi1d<LatticeColorMatrix> deriv_sex(Nd);
155  ds_u.resize(Nd);
156  for(int mu=0; mu < Nd; mu++)
157  {
158  deriv_fun[mu] = zero ;
159  deriv_adj[mu] = zero ;
160  deriv_sex[mu] = zero ;
161  for(int nu = 0; nu < Nd; nu++)
162  {
163  if (mu == nu) continue;
164 
165  LatticeColorMatrix tmp_1 = shift(u[nu], FORWARD, mu);
166  LatticeColorMatrix tmp_2 = shift(u[mu], FORWARD, nu);
167 
168  LatticeColorMatrix up_plq = u[mu]*tmp_1*adj(tmp_2)*adj(u[nu]);
169  LatticeColorMatrix down_plq = u[mu]*shift(adj(tmp_1)*adj(u[mu])*u[nu],BACKWARD,nu);
170 
171  deriv_fun[mu] += up_plq + down_plq ;
172 
173  deriv_adj[mu] += up_plq*conj(trace(up_plq)) +
174  down_plq*conj(trace(down_plq)) ;
175 
176  deriv_sex[mu] += up_plq*up_plq + down_plq*down_plq +
177  up_plq*trace(up_plq) +
178  down_plq*trace(down_plq) ;
179 
180  }// nu
181  // Fold in the normalization from the action
182  ds_u[mu] = (-param.beta_F/Real(2*Nc) ) * deriv_fun[mu];
183  ds_u[mu] += (-param.beta_A/Real(Nc*Nc) ) * deriv_adj[mu];
184  ds_u[mu] += (-param.beta_S/Real(2*(Nc*Nc+Nc))) * deriv_sex[mu];
185  }// mu
186 
187  // Zero the force on any fixed boundaries
188  getGaugeBC().zero(ds_u);
189 
190  END_CODE();
191  }
192 
193 
194  }//CharacterGaugeActEnv
195 
196 } // Chroma
Anisotropy parameters.
gauge action as a sum of characters of the SU(3) irreps
Primary include file for CHROMA library code.
void staple(LatticeColorMatrix &result, const Handle< GaugeState< P, Q > > &state, int mu, int cb) const
Compute staple.
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
void siteAction(multi2d< LatticeColorMatrix > &site_act, const Handle< GaugeState< P, Q > > &state) const
Compute the site-level action.
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
Abstract base class for gauge actions.
Definition: gaugeact.h:25
virtual const GaugeBC< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > & getGaugeBC() const
Return the gauge BC object for this action.
Definition: gaugeact.h:46
virtual void zero(P &ds_u) const =0
Zero some gauge-like field in place on the masked links.
Support class for fermion actions and linear operators.
Definition: state.h:74
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
int GaugeAct
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
All gauge create-state method.
Gauge create state factory.
Fermion action factories.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
LatticeColorMatrix tmp_2
Definition: meslate.cc:51
Double plaq
Definition: meslate.cc:58
LatticeColorMatrix tmp_1
Definition: meslate.cc:50
Nd
Definition: meslate.cc:74
GaugeAction< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createGaugeAct(XMLReader &xml, const std::string &path)
static bool registered
Local registration flag.
const std::string name
Name to be used.
bool registerAll()
Register all the factories.
Handle< CreateGaugeState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the CreateGaugeState readers.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
START_CODE()
int cb
Definition: invbicg.cc:120
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Double sum
Definition: qtopcor.cc:37