From 18b7845b7ba572808c65dd0d766f44b50fa50700 Mon Sep 17 00:00:00 2001 From: Guido Cossu Date: Tue, 21 Mar 2017 11:52:05 +0900 Subject: [PATCH] Adding WilsonFlow smearing --- lib/qcd/smearing/APEsmearing.h | 38 +++++++++-- lib/qcd/smearing/BaseSmearing.h | 30 +++++++- lib/qcd/smearing/WilsonFlow.h | 117 ++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 6 deletions(-) create mode 100644 lib/qcd/smearing/WilsonFlow.h diff --git a/lib/qcd/smearing/APEsmearing.h b/lib/qcd/smearing/APEsmearing.h index 467bf2c6..d3fe94f6 100644 --- a/lib/qcd/smearing/APEsmearing.h +++ b/lib/qcd/smearing/APEsmearing.h @@ -1,3 +1,31 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: ./lib/qcd/modules/plaquette.h + +Copyright (C) 2017 + +Author: Guido Cossu + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +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 */ /*! @brief Declaration of Smear_APE class for APE smearing */ @@ -10,12 +38,12 @@ /*! @brief APE type smearing of link variables. */ - template + template class Smear_APE: public Smear{ private: const std::vector rho;/*!< Array of weights */ -//This member must be private - we do not want to control from outside +//This member must be private - we do not want to control from outside std::vector set_rho(const double common_rho) const { std::vector res; @@ -40,7 +68,7 @@ GridBase *grid = U._grid; GaugeLinkField Cup(grid), tmp_stpl(grid); WilsonLoops WL; - u_smr = zero; + u_smr = zero; for(int mu=0; mu + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +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 */ /* @brief Declares base smearing class Smear */ #ifndef BASE_SMEAR_ #define BASE_SMEAR_ -template +template class Smear{ public: INHERIT_GIMPL_TYPES(Gimpl) // inherits the types for the gauge fields diff --git a/lib/qcd/smearing/WilsonFlow.h b/lib/qcd/smearing/WilsonFlow.h new file mode 100644 index 00000000..a47df2ca --- /dev/null +++ b/lib/qcd/smearing/WilsonFlow.h @@ -0,0 +1,117 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: ./lib/qcd/modules/plaquette.h + +Copyright (C) 2017 + +Author: Guido Cossu + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +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 */ + +#ifndef WILSONFLOW_H +#define WILSONFLOW_H + +namespace Grid { +namespace QCD { + +template +class WilsonFlow: public Smear{ + unsigned int Nstep; + RealD epsilon; + + WilsonGaugeAction &SG; + + void evolve_step(); + RealD tau(unsigned int t)const {return epsilon*(t+1.0); } + + + public: + INHERIT_GIMPL_TYPES(Gimpl) + + explicit WilsonFlow(unsigned int Nstep, RealD epsilon): + Nstep(Nstep), + epsilon(epsilon), + SG(3.0) { + // WilsonGaugeAction with beta 3.0 + assert(epsilon > 0.0); + LogMessage(); + } + + void LogMessage() { + std::cout << GridLogMessage + << "[WilsonFlow] Nstep : " << Nstep + << "[WilsonFlow] epsilon : " << epsilon + << "[WilsonFlow] full trajectory : " << Nstep * epsilon + << std::endl; + } + + virtual void smear(GaugeField&, const GaugeField&) const; + + virtual void derivative(GaugeField&, const GaugeField&, const GaugeField&) const { + assert(0); + // undefined for WilsonFlow + } + + RealD energyDensityPlaquette(unsigned int step, const GaugeField& U) const; +}; + +void WilsonFlow::evolve_step(GaugeField &U) { + GaugeField Z(U._grid); + GaugeField tmp(U._grid); + SG.deriv(U, Z); + Z *= 0.25; // Z0 = 1/4 * F(U) + Gimpl::update_field(Z, U, -2.0*epsilon); // U = W1 = exp(ep*Z0)*W0 + + Z *= -17.0/8.0; + SG.deriv(U, tmp); Z += tmp; // -17/32*Z0 +Z1 + Z *= 8.0/9.0; // Z = -17/36*Z0 +8/9*Z1 + Gimpl::update_field(Z, U, -2.0*epsilon); // U_= W2 = exp(ep*Z)*W1 + + Z *= -4.0/3.0; + SG.deriv(U, tmp); Z += tmp; // 4/3*(17/36*Z0 -8/9*Z1) +Z2 + Z *= 3.0/4.0; // Z = 17/36*Z0 -8/9*Z1 +3/4*Z2 + Gimpl::update_field(Z, U, -2.0*epsilon); // V(t+e) = exp(ep*Z)*W2 +} + +RealD energyDensityPlaquette(unsigned int step, const GaugeField& U) const { + RealD td = tau(step); + return 2.0 * td * td * SG.S(Uflow)/volume; +} + +void WilsonFlow::smear(GaugeField& out, const GaugeField& in) const { + out = in; + RealD volume = out._grid->gSites(); + + for (unsigned int step = 0; step < Nstep; step++) { + evolve_step(out); + // Energy density, plaquette + std::cout << GridLogMessage + << "[WilsonFlow] Energy Density (step) : " + << step + << " " << energyDensityPlaquette(step, out) + << std::endl; +} + +} // namespace QCD +} // namespace Grid + +#endif // WILSONFLOW_H