diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index 3c30f206..c828e120 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -33,8 +33,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -44,12 +44,12 @@ #include #include #include -#include -#include -#include #include #include #include +#include +#include +#include #include #include #include @@ -57,10 +57,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include diff --git a/Hadrons/Modules/MSource/JacobiSmear.cc b/Hadrons/Modules/MSource/JacobiSmear.cc new file mode 100644 index 00000000..e9b37f1b --- /dev/null +++ b/Hadrons/Modules/MSource/JacobiSmear.cc @@ -0,0 +1,7 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MSource; + +template class Grid::Hadrons::MSource::TJacobiSmear; diff --git a/Hadrons/Modules/MSource/JacobiSmear.hpp b/Hadrons/Modules/MSource/JacobiSmear.hpp new file mode 100644 index 00000000..5aa5c705 --- /dev/null +++ b/Hadrons/Modules/MSource/JacobiSmear.hpp @@ -0,0 +1,105 @@ +#ifndef Hadrons_MSource_JacobiSmear_hpp_ +#define Hadrons_MSource_JacobiSmear_hpp_ + +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * JacobiSmear * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MSource) + +class JacobiSmearPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(JacobiSmearPar, + std::string, gauge, + double, width, + int, iterations, + int, orthog, + std::string, source); +}; + +template +class TJacobiSmear: public Module +{ +public: + FERM_TYPE_ALIASES(FImpl,); + typedef typename FImpl::GaugeLinkField GaugeMat; +public: + // constructor + TJacobiSmear(const std::string name); + // destructor + virtual ~TJacobiSmear(void) {}; + // dependency relation + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // setup + virtual void setup(void); + // execution + virtual void execute(void); +}; + +MODULE_REGISTER_TMP(JacobiSmear, TJacobiSmear, MSource); + +/****************************************************************************** + * TJacobiSmear implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TJacobiSmear::TJacobiSmear(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TJacobiSmear::getInput(void) +{ + std::vector in = {par().source, par().gauge}; + + return in; +} + +template +std::vector TJacobiSmear::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TJacobiSmear::setup(void) +{ + envCreateLat(PropagatorField, getName()); + envTmp(std::vector, "Umu", 1, 4, envGetGrid(LatticeColourMatrix)); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TJacobiSmear::execute(void) +{ + auto &out = envGet(PropagatorField, getName()); + auto &src = envGet(PropagatorField, par().source); + auto &U = envGet(GaugeField, par().gauge); + envGetTmp(std::vector, Umu); + for(int mu=0; mu<4; mu++) + { + Umu.at(mu)=peekLorentz(U,mu); + } + CovariantSmearing covsmear; + out=src; + startTimer("Jacobi iteration"); + covsmear.GaussianSmear(Umu, out, par().width, par().iterations, par().orthog); + stopTimer("Jacobi iteration"); +} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MSource_JacobiSmear_hpp_ diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index 2eb1923d..8bc87fd3 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -44,22 +44,22 @@ modules_cc =\ Modules/MIO/LoadEigenPack.cc \ Modules/MIO/LoadNersc.cc \ Modules/MIO/LoadPerambulator.cc \ - Modules/MNPR/Amputate.cc \ - Modules/MNPR/Bilinear.cc \ - Modules/MNPR/FourQuark.cc \ Modules/MNoise/FullVolumeSpinColorDiagonal.cc \ Modules/MNoise/SparseSpinColorDiagonal.cc \ Modules/MNoise/TimeDilutedSpinColorDiagonal.cc \ + Modules/MNPR/Amputate.cc \ + Modules/MNPR/Bilinear.cc \ + Modules/MNPR/FourQuark.cc \ Modules/MScalar/ChargedProp.cc \ Modules/MScalar/FreeProp.cc \ Modules/MScalarSUN/Div.cc \ Modules/MScalarSUN/EMT.cc \ Modules/MScalarSUN/Grad.cc \ Modules/MScalarSUN/StochFreeField.cc \ + Modules/MScalarSUN/TransProj.cc \ Modules/MScalarSUN/TrKinetic.cc \ Modules/MScalarSUN/TrMag.cc \ Modules/MScalarSUN/TrPhi.cc \ - Modules/MScalarSUN/TransProj.cc \ Modules/MScalarSUN/TwoPoint.cc \ Modules/MScalarSUN/TwoPointNPR.cc \ Modules/MSink/Point.cc \ @@ -71,6 +71,7 @@ modules_cc =\ Modules/MSolver/RBPrecCG.cc \ Modules/MSource/Convolution.cc \ Modules/MSource/Gauss.cc \ + Modules/MSource/JacobiSmear.cc \ Modules/MSource/Momentum.cc \ Modules/MSource/MomentumPhase.cc \ Modules/MSource/Point.cc \ @@ -86,8 +87,8 @@ modules_hpp =\ Modules/MAction/DWF.hpp \ Modules/MAction/MobiusDWF.hpp \ Modules/MAction/ScaledDWF.hpp \ - Modules/MAction/Wilson.hpp \ Modules/MAction/WilsonClover.hpp \ + Modules/MAction/Wilson.hpp \ Modules/MAction/ZMobiusDWF.hpp \ Modules/MContraction/A2AAslashField.hpp \ Modules/MContraction/A2AFourQuarkContraction.hpp \ @@ -118,8 +119,8 @@ modules_hpp =\ Modules/MGauge/Random.hpp \ Modules/MGauge/StochEm.hpp \ Modules/MGauge/StoutSmearing.hpp \ - Modules/MGauge/Unit.hpp \ Modules/MGauge/UnitEm.hpp \ + Modules/MGauge/Unit.hpp \ Modules/MIO/LoadA2AMatrixDiskVector.hpp \ Modules/MIO/LoadA2AVectors.hpp \ Modules/MIO/LoadBinary.hpp \ @@ -129,12 +130,12 @@ modules_hpp =\ Modules/MIO/LoadEigenPack.hpp \ Modules/MIO/LoadNersc.hpp \ Modules/MIO/LoadPerambulator.hpp \ - Modules/MNPR/Amputate.hpp \ - Modules/MNPR/Bilinear.hpp \ - Modules/MNPR/FourQuark.hpp \ Modules/MNoise/FullVolumeSpinColorDiagonal.hpp \ Modules/MNoise/SparseSpinColorDiagonal.hpp \ Modules/MNoise/TimeDilutedSpinColorDiagonal.hpp \ + Modules/MNPR/Amputate.hpp \ + Modules/MNPR/Bilinear.hpp \ + Modules/MNPR/FourQuark.hpp \ Modules/MScalar/ChargedProp.hpp \ Modules/MScalar/FreeProp.hpp \ Modules/MScalar/Scalar.hpp \ @@ -142,10 +143,10 @@ modules_hpp =\ Modules/MScalarSUN/EMT.hpp \ Modules/MScalarSUN/Grad.hpp \ Modules/MScalarSUN/StochFreeField.hpp \ + Modules/MScalarSUN/TransProj.hpp \ Modules/MScalarSUN/TrKinetic.hpp \ Modules/MScalarSUN/TrMag.hpp \ Modules/MScalarSUN/TrPhi.hpp \ - Modules/MScalarSUN/TransProj.hpp \ Modules/MScalarSUN/TwoPoint.hpp \ Modules/MScalarSUN/TwoPointNPR.hpp \ Modules/MScalarSUN/Utils.hpp \ @@ -159,6 +160,7 @@ modules_hpp =\ Modules/MSolver/RBPrecCG.hpp \ Modules/MSource/Convolution.hpp \ Modules/MSource/Gauss.hpp \ + Modules/MSource/JacobiSmear.hpp \ Modules/MSource/Momentum.hpp \ Modules/MSource/MomentumPhase.hpp \ Modules/MSource/Point.hpp \