Grid 0.7.0
CovariantSmearing.h
Go to the documentation of this file.
1/*************************************************************************************
2
3Grid physics library, www.github.com/paboyle/Grid
4
5Source file: ./lib/qcd/action/scalar/CovariantLaplacian.h
6
7Copyright (C) 2016
8
9Author: Azusa Yamaguchi
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along
22with this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25See the full license in the file "LICENSE" in the top level distribution
26directory
27*************************************************************************************/
28#pragma once
29
31
32template <class Gimpl> class CovariantSmearing : public Gimpl
33{
34public:
36
37 typedef typename Gimpl::GaugeLinkField GaugeMat;
38 typedef typename Gimpl::GaugeField GaugeLorentz;
39
40 template<typename T>
41 static void GaussianSmear(const std::vector<LatticeColourMatrix>& U,
42 T& chi,
43 const Real& width, int Iterations, int orthog)
44 {
45 GridBase *grid = chi.Grid();
46 T psi(grid);
47
49 // Follow Chroma conventions for width to keep compatibility with previous data
50 // Free field iterates
51 // chi = (1 - w^2/4N p^2)^N chi
52 //
53 // ~ (e^(-w^2/4N p^2)^N chi
54 // ~ (e^(-w^2/4 p^2) chi
55 // ~ (e^(-w'^2/2 p^2) chi [ w' = w/sqrt(2) ]
56 //
57 // Which in coordinate space is proportional to
58 //
59 // e^(-x^2/w^2) = e^(-x^2/2w'^2)
60 //
61 // The 4 is a bit unconventional from Gaussian width perspective, but... it's Chroma convention.
62 // 2nd derivative approx d^2/dx^2 = x+mu + x-mu - 2x
63 //
64 // d^2/dx^2 = - p^2
65 //
66 // chi = ( 1 + w^2/4N d^2/dx^2 )^N chi
67 //
69 Real coeff = (width*width) / Real(4*Iterations);
70
71 int dims = Nd;
72 if( orthog < Nd ) dims=Nd-1;
73
74 for(int n = 0; n < Iterations; ++n) {
75 psi = (-2.0*dims)*chi;
76 for(int mu=0;mu<Nd;mu++) {
77 if ( mu != orthog ) {
78 psi = psi + Gimpl::CovShiftForward(U[mu],mu,chi);
79 psi = psi + Gimpl::CovShiftBackward(U[mu],mu,chi);
80 }
81 }
82 chi = chi + coeff*psi;
83 }
84 }
85};
86
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int Nd
Definition QCD.h:52
RealF Real
Definition Simd.h:65
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
Gimpl::GaugeField GaugeLorentz
Gimpl::GaugeLinkField GaugeMat
INHERIT_GIMPL_TYPES(Gimpl)
static void GaussianSmear(const std::vector< LatticeColourMatrix > &U, T &chi, const Real &width, int Iterations, int orthog)