Grid 0.7.0
WilsonGaugeAction.h
Go to the documentation of this file.
1/*************************************************************************************
2
3Grid physics library, www.github.com/paboyle/Grid
4
5Source file: ./lib/qcd/action/gauge/WilsonGaugeAction.h
6
7Copyright (C) 2015
8
9Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
10Author: Peter Boyle <paboyle@ph.ed.ac.uk>
11Author: neo <cossu@post.kek.jp>
12Author: paboyle <paboyle@ph.ed.ac.uk>
13Author: Guido Cossu <guido.cossu@ed.ac.uk>
14
15This program is free software; you can redistribute it and/or modify
16it under the terms of the GNU General Public License as published by
17the Free Software Foundation; either version 2 of the License, or
18(at your option) any later version.
19
20This program is distributed in the hope that it will be useful,
21but WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23GNU General Public License for more details.
24
25You should have received a copy of the GNU General Public License along
26with this program; if not, write to the Free Software Foundation, Inc.,
2751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28
29See the full license in the file "LICENSE" in the top level distribution
30directory
31*************************************************************************************/
32 /* END LEGAL */
33#ifndef QCD_WILSON_GAUGE_ACTION_H
34#define QCD_WILSON_GAUGE_ACTION_H
35
42
44// Wilson Gauge Action .. should I template the Nc etc..
46template <class Gimpl>
47class WilsonGaugeAction : public Action<typename Gimpl::GaugeField>
55{
56public:
61
62 using Action<GaugeField>::S;
63 using Action<GaugeField>::Sinitial;
64 using Action<GaugeField>::deriv;
65 using Action<GaugeField>::refresh;
66
70 explicit WilsonGaugeAction(RealD beta_):beta(beta_){};
71
72 virtual std::string action_name() {return "WilsonGaugeAction";}
73
74 virtual std::string LogParameters(){
75 std::stringstream sstream;
76 sstream << GridLogMessage << "[WilsonGaugeAction] Beta: " << beta << std::endl;
77 return sstream.str();
78 }
79
81 virtual void refresh(const GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG){};
82
87 virtual RealD S(const GaugeField &U) {
89 RealD vol = U.Grid()->gSites();
90
91 // Comparing with Gattringer and Lang Eq. (3.93),
92 // taking the _average_ plaquette here means that
93 // multiplying explicitly by the volume and dimensionality factors is needed,
94 // but the factor of \f$1 / N_c\f$ divides out.
95 RealD action = beta * (1.0 - plaq) * (Nd * (Nd - 1.0)) * vol * 0.5;
96 return action;
97 };
98
108 virtual void deriv(const GaugeField &U, GaugeField &dSdU) {
109 RealD factor = 0.5 * beta / RealD(Nc);
110 GridBase *grid = U.Grid();
111
112 GaugeLinkField dSdU_mu(grid);
113 std::vector<GaugeLinkField> Umu(Nd, grid);
114 for (int mu = 0; mu < Nd; mu++) {
115 Umu[mu] = PeekIndex<LorentzIndex>(U, mu);
116 }
117
118 for (int mu = 0; mu < Nd; mu++) {
119 // Staple in direction mu
120 WilsonLoops<Gimpl>::Staple(dSdU_mu, Umu, mu);
121 dSdU_mu = Ta(Umu[mu] * dSdU_mu) * factor;
122
123 PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
124 }
125 }
126
127private:
128 RealD beta;
129 };
130
134#endif
void PokeIndex(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< Index >(vobj(), 0))> &rhs, int i)
auto PeekIndex(const Lattice< vobj > &lhs, int i) -> Lattice< decltype(peekIndex< Index >(vobj(), i))>
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int Nd
Definition QCD.h:52
static constexpr int Nc
Definition QCD.h:50
double RealD
Definition Simd.h:61
accelerator_inline iScalar< vtype > Ta(const iScalar< vtype > &r)
Definition Tensor_Ta.h:45
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
Base class for all actions.
Definition ActionBase.h:64
virtual RealD S(const GaugeField &U)=0
virtual RealD Sinitial(const GaugeField &U)
Definition ActionBase.h:157
virtual std::string LogParameters()=0
virtual std::string action_name()=0
virtual void refresh(const GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG)=0
virtual void deriv(const GaugeField &U, GaugeField &dSdU)=0
The Wilson gauge action, as introduced in Wilson, Phys. Rev. D 10, 2445. See for example Gattringer a...
INHERIT_GIMPL_TYPES(Gimpl)
All attributes of the gauge implementation are available from the action. See GaugeImplTypes....
static RealD avgPlaquette(const GaugeLorentz &Umu)
static void Staple(GaugeMat &staple, const GaugeLorentz &Umu, int mu, int nu)