diff --git a/lib/qcd/action/gauge/PlaqPlusRectangleAction.h b/lib/qcd/action/gauge/PlaqPlusRectangleAction.h index 5bfd39b2..65e3971e 100644 --- a/lib/qcd/action/gauge/PlaqPlusRectangleAction.h +++ b/lib/qcd/action/gauge/PlaqPlusRectangleAction.h @@ -1,4 +1,4 @@ - /************************************************************************************* +/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid @@ -24,129 +24,127 @@ Author: paboyle 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory - *************************************************************************************/ - /* END LEGAL */ +*************************************************************************************/ +/* END LEGAL */ #ifndef QCD_PLAQ_PLUS_RECTANGLE_ACTION_H #define QCD_PLAQ_PLUS_RECTANGLE_ACTION_H -namespace Grid{ - namespace QCD{ +NAMESPACE_BEGIN(Grid); - //////////////////////////////////////////////////////////////////////// - // PlaqPlusRectangleActoin - //////////////////////////////////////////////////////////////////////// - template - class PlaqPlusRectangleAction : public Action { - public: +//////////////////////////////////////////////////////////////////////// +// PlaqPlusRectangleActoin +//////////////////////////////////////////////////////////////////////// +template +class PlaqPlusRectangleAction : public Action { +public: - INHERIT_GIMPL_TYPES(Gimpl); + INHERIT_GIMPL_TYPES(Gimpl); - private: - RealD c_plaq; - RealD c_rect; +private: + RealD c_plaq; + RealD c_rect; - public: - PlaqPlusRectangleAction(RealD b,RealD c): c_plaq(b),c_rect(c){}; +public: + PlaqPlusRectangleAction(RealD b,RealD c): c_plaq(b),c_rect(c){}; - virtual std::string action_name(){return "PlaqPlusRectangleAction";} + virtual std::string action_name(){return "PlaqPlusRectangleAction";} - virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {}; // noop as no pseudoferms + virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {}; // noop as no pseudoferms - virtual std::string LogParameters(){ - std::stringstream sstream; - sstream << GridLogMessage << "["<gSites(); - - RealD plaq = WilsonLoops::avgPlaquette(U); - RealD rect = WilsonLoops::avgRectangle(U); - - RealD action=c_plaq*(1.0 -plaq)*(Nd*(Nd-1.0))*vol*0.5 - +c_rect*(1.0 -rect)*(Nd*(Nd-1.0))*vol; - - return action; - }; - - virtual void deriv(const GaugeField &Umu,GaugeField & dSdU) { - //extend Ta to include Lorentz indexes - RealD factor_p = c_plaq/RealD(Nc)*0.5; - RealD factor_r = c_rect/RealD(Nc)*0.5; - - GridBase *grid = Umu._grid; - - std::vector U (Nd,grid); - std::vector U2(Nd,grid); - - for(int mu=0;mu(Umu,mu); - WilsonLoops::RectStapleDouble(U2[mu],U[mu],mu); - } - - GaugeLinkField dSdU_mu(grid); - GaugeLinkField staple(grid); - - for (int mu=0; mu < Nd; mu++){ - - // Staple in direction mu - - WilsonLoops::Staple(staple,Umu,mu); - - dSdU_mu = Ta(U[mu]*staple)*factor_p; - - WilsonLoops::RectStaple(Umu,staple,U2,U,mu); - - dSdU_mu = dSdU_mu + Ta(U[mu]*staple)*factor_r; - - PokeIndex(dSdU, dSdU_mu, mu); - } - - }; - - }; - - // Convenience for common physically defined cases. - // - // RBC c1 parameterisation is not really RBC but don't have good - // reference and we are happy to change name if prior use of this plaq coeff - // parameterisation is made known to us. - template - class RBCGaugeAction : public PlaqPlusRectangleAction { - public: - INHERIT_GIMPL_TYPES(Gimpl); - RBCGaugeAction(RealD beta,RealD c1) : PlaqPlusRectangleAction(beta*(1.0-8.0*c1), beta*c1) {}; - virtual std::string action_name(){return "RBCGaugeAction";} - }; - - template - class IwasakiGaugeAction : public RBCGaugeAction { - public: - INHERIT_GIMPL_TYPES(Gimpl); - IwasakiGaugeAction(RealD beta) : RBCGaugeAction(beta,-0.331) {}; - virtual std::string action_name(){return "IwasakiGaugeAction";} - }; - - template - class SymanzikGaugeAction : public RBCGaugeAction { - public: - INHERIT_GIMPL_TYPES(Gimpl); - SymanzikGaugeAction(RealD beta) : RBCGaugeAction(beta,-1.0/12.0) {}; - virtual std::string action_name(){return "SymanzikGaugeAction";} - }; - - template - class DBW2GaugeAction : public RBCGaugeAction { - public: - INHERIT_GIMPL_TYPES(Gimpl); - DBW2GaugeAction(RealD beta) : RBCGaugeAction(beta,-1.4067) {}; - virtual std::string action_name(){return "DBW2GaugeAction";} - }; - + virtual std::string LogParameters(){ + std::stringstream sstream; + sstream << GridLogMessage << "["<gSites(); + + RealD plaq = WilsonLoops::avgPlaquette(U); + RealD rect = WilsonLoops::avgRectangle(U); + + RealD action=c_plaq*(1.0 -plaq)*(Nd*(Nd-1.0))*vol*0.5 + +c_rect*(1.0 -rect)*(Nd*(Nd-1.0))*vol; + + return action; + }; + + virtual void deriv(const GaugeField &Umu,GaugeField & dSdU) { + //extend Ta to include Lorentz indexes + RealD factor_p = c_plaq/RealD(Nc)*0.5; + RealD factor_r = c_rect/RealD(Nc)*0.5; + + GridBase *grid = Umu._grid; + + std::vector U (Nd,grid); + std::vector U2(Nd,grid); + + for(int mu=0;mu(Umu,mu); + WilsonLoops::RectStapleDouble(U2[mu],U[mu],mu); + } + + GaugeLinkField dSdU_mu(grid); + GaugeLinkField staple(grid); + + for (int mu=0; mu < Nd; mu++){ + + // Staple in direction mu + + WilsonLoops::Staple(staple,Umu,mu); + + dSdU_mu = Ta(U[mu]*staple)*factor_p; + + WilsonLoops::RectStaple(Umu,staple,U2,U,mu); + + dSdU_mu = dSdU_mu + Ta(U[mu]*staple)*factor_r; + + PokeIndex(dSdU, dSdU_mu, mu); + } + + }; + +}; + +// Convenience for common physically defined cases. +// +// RBC c1 parameterisation is not really RBC but don't have good +// reference and we are happy to change name if prior use of this plaq coeff +// parameterisation is made known to us. +template +class RBCGaugeAction : public PlaqPlusRectangleAction { +public: + INHERIT_GIMPL_TYPES(Gimpl); + RBCGaugeAction(RealD beta,RealD c1) : PlaqPlusRectangleAction(beta*(1.0-8.0*c1), beta*c1) {}; + virtual std::string action_name(){return "RBCGaugeAction";} +}; + +template +class IwasakiGaugeAction : public RBCGaugeAction { +public: + INHERIT_GIMPL_TYPES(Gimpl); + IwasakiGaugeAction(RealD beta) : RBCGaugeAction(beta,-0.331) {}; + virtual std::string action_name(){return "IwasakiGaugeAction";} +}; + +template +class SymanzikGaugeAction : public RBCGaugeAction { +public: + INHERIT_GIMPL_TYPES(Gimpl); + SymanzikGaugeAction(RealD beta) : RBCGaugeAction(beta,-1.0/12.0) {}; + virtual std::string action_name(){return "SymanzikGaugeAction";} +}; + +template +class DBW2GaugeAction : public RBCGaugeAction { +public: + INHERIT_GIMPL_TYPES(Gimpl); + DBW2GaugeAction(RealD beta) : RBCGaugeAction(beta,-1.4067) {}; + virtual std::string action_name(){return "DBW2GaugeAction";} +}; + +NAMESPACE_END(Grid); #endif