diff --git a/extras/Hadrons/Modules.hpp b/extras/Hadrons/Modules.hpp index 42a1f651..c27254aa 100644 --- a/extras/Hadrons/Modules.hpp +++ b/extras/Hadrons/Modules.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -22,4 +23,3 @@ #include #include #include -#include diff --git a/extras/Hadrons/Modules/Quark.hpp b/extras/Hadrons/Modules/MFermion/GaugeProp.hpp similarity index 65% rename from extras/Hadrons/Modules/Quark.hpp rename to extras/Hadrons/Modules/MFermion/GaugeProp.hpp index cf7d4c28..b4f9edcc 100644 --- a/extras/Hadrons/Modules/Quark.hpp +++ b/extras/Hadrons/Modules/MFermion/GaugeProp.hpp @@ -1,34 +1,5 @@ -/************************************************************************************* - -Grid physics library, www.github.com/paboyle/Grid - -Source file: extras/Hadrons/Modules/Quark.hpp - -Copyright (C) 2015 -Copyright (C) 2016 - -Author: Antonin Portelli - -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 Hadrons_Quark_hpp_ -#define Hadrons_Quark_hpp_ +#ifndef Hadrons_MFermion_GaugeProp_hpp_ +#define Hadrons_MFermion_GaugeProp_hpp_ #include #include @@ -37,27 +8,29 @@ See the full license in the file "LICENSE" in the top level distribution directo BEGIN_HADRONS_NAMESPACE /****************************************************************************** - * TQuark * + * GaugeProp * ******************************************************************************/ -class QuarkPar: Serializable +BEGIN_MODULE_NAMESPACE(MFermion) + +class GaugePropPar: Serializable { public: - GRID_SERIALIZABLE_CLASS_MEMBERS(QuarkPar, + GRID_SERIALIZABLE_CLASS_MEMBERS(GaugePropPar, std::string, source, std::string, solver); }; template -class TQuark: public Module +class TGaugeProp: public Module { public: FGS_TYPE_ALIASES(FImpl,); public: // constructor - TQuark(const std::string name); + TGaugeProp(const std::string name); // destructor - virtual ~TQuark(void) = default; - // dependencies/products + virtual ~TGaugeProp(void) = default; + // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup @@ -69,20 +42,20 @@ private: SolverFn *solver_{nullptr}; }; -MODULE_REGISTER(Quark, TQuark); +MODULE_REGISTER_NS(GaugeProp, TGaugeProp, MFermion); /****************************************************************************** - * TQuark implementation * + * TGaugeProp implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template -TQuark::TQuark(const std::string name) -: Module(name) +TGaugeProp::TGaugeProp(const std::string name) +: Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template -std::vector TQuark::getInput(void) +std::vector TGaugeProp::getInput(void) { std::vector in = {par().source, par().solver}; @@ -90,7 +63,7 @@ std::vector TQuark::getInput(void) } template -std::vector TQuark::getOutput(void) +std::vector TGaugeProp::getOutput(void) { std::vector out = {getName(), getName() + "_5d"}; @@ -99,7 +72,7 @@ std::vector TQuark::getOutput(void) // setup /////////////////////////////////////////////////////////////////////// template -void TQuark::setup(void) +void TGaugeProp::setup(void) { Ls_ = env().getObjectLs(par().solver); env().template registerLattice(getName()); @@ -111,13 +84,13 @@ void TQuark::setup(void) // execution /////////////////////////////////////////////////////////////////// template -void TQuark::execute(void) +void TGaugeProp::execute(void) { LOG(Message) << "Computing quark propagator '" << getName() << "'" - << std::endl; + << std::endl; FermionField source(env().getGrid(Ls_)), sol(env().getGrid(Ls_)), - tmp(env().getGrid()); + tmp(env().getGrid()); std::string propName = (Ls_ == 1) ? getName() : (getName() + "_5d"); PropagatorField &prop = *env().template createLattice(propName); PropagatorField &fullSrc = *env().template getObject(par().source); @@ -128,12 +101,12 @@ void TQuark::execute(void) } LOG(Message) << "Inverting using solver '" << par().solver - << "' on source '" << par().source << "'" << std::endl; + << "' on source '" << par().source << "'" << std::endl; for (unsigned int s = 0; s < Ns; ++s) for (unsigned int c = 0; c < Nc; ++c) { LOG(Message) << "Inversion for spin= " << s << ", color= " << c - << std::endl; + << std::endl; // source conversion for 4D sources if (!env().isObject5d(par().source)) { @@ -170,7 +143,7 @@ void TQuark::execute(void) if (Ls_ > 1) { PropagatorField &p4d = - *env().template getObject(getName()); + *env().template getObject(getName()); axpby_ssp_pminus(sol, 0., sol, 1., sol, 0, 0); axpby_ssp_pplus(sol, 1., sol, 1., sol, 0, Ls_-1); @@ -180,6 +153,8 @@ void TQuark::execute(void) } } +END_MODULE_NAMESPACE + END_HADRONS_NAMESPACE -#endif // Hadrons_Quark_hpp_ +#endif // Hadrons_MFermion_GaugeProp_hpp_ diff --git a/extras/Hadrons/modules.inc b/extras/Hadrons/modules.inc index f51ede5a..669b08ba 100644 --- a/extras/Hadrons/modules.inc +++ b/extras/Hadrons/modules.inc @@ -20,6 +20,7 @@ modules_hpp =\ Modules/MContraction/WeakHamiltonianEye.hpp \ Modules/MContraction/WeakHamiltonianNonEye.hpp \ Modules/MContraction/WeakNeutral4ptDisc.hpp \ + Modules/MFermion/GaugeProp.hpp \ Modules/MGauge/Load.hpp \ Modules/MGauge/Random.hpp \ Modules/MGauge/StochEm.hpp \ @@ -33,6 +34,5 @@ modules_hpp =\ Modules/MSource/Point.hpp \ Modules/MSource/SeqGamma.hpp \ Modules/MSource/Wall.hpp \ - Modules/MSource/Z2.hpp \ - Modules/Quark.hpp + Modules/MSource/Z2.hpp diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index 7e487153..382c39d4 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -65,6 +65,10 @@ int main(int argc, char *argv[]) // set fermion boundary conditions to be periodic space, antiperiodic time. std::string boundary = "1 1 1 -1"; + // sink + MSink::Point::Par sinkPar; + sinkPar.mom = "0 0 0"; + application.createModule("sink", sinkPar); for (unsigned int i = 0; i < flavour.size(); ++i) { // actions @@ -115,15 +119,15 @@ int main(int argc, char *argv[]) } // propagators - Quark::Par quarkPar; + MFermion::GaugeProp::Par quarkPar; quarkPar.solver = "CG_" + flavour[i]; quarkPar.source = srcName; - application.createModule(qName[i], quarkPar); + application.createModule(qName[i], quarkPar); for (unsigned int mu = 0; mu < Nd; ++mu) { quarkPar.source = seqName[i][mu]; seqName[i][mu] = "Q_" + flavour[i] + "-" + seqName[i][mu]; - application.createModule(seqName[i][mu], quarkPar); + application.createModule(seqName[i][mu], quarkPar); } } @@ -136,7 +140,7 @@ int main(int argc, char *argv[]) mesPar.q1 = qName[i]; mesPar.q2 = qName[j]; mesPar.gammas = "all"; - mesPar.mom = "0. 0. 0. 0."; + mesPar.sink = "sink"; application.createModule("meson_Z2_" + std::to_string(t) + "_" @@ -155,7 +159,7 @@ int main(int argc, char *argv[]) mesPar.q1 = qName[i]; mesPar.q2 = seqName[j][mu]; mesPar.gammas = "all"; - mesPar.mom = "0. 0. 0. 0."; + mesPar.sink = "sink"; application.createModule("3pt_Z2_" + std::to_string(t) + "_" diff --git a/tests/hadrons/Test_hadrons_spectrum.cc b/tests/hadrons/Test_hadrons_spectrum.cc index 8f7b30c8..801674f7 100644 --- a/tests/hadrons/Test_hadrons_spectrum.cc +++ b/tests/hadrons/Test_hadrons_spectrum.cc @@ -90,12 +90,12 @@ int main(int argc, char *argv[]) solverPar); // propagators - Quark::Par quarkPar; + MFermion::GaugeProp::Par quarkPar; quarkPar.solver = "CG_" + flavour[i]; quarkPar.source = "pt"; - application.createModule("Qpt_" + flavour[i], quarkPar); + application.createModule("Qpt_" + flavour[i], quarkPar); quarkPar.source = "z2"; - application.createModule("QZ2_" + flavour[i], quarkPar); + application.createModule("QZ2_" + flavour[i], quarkPar); } for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int j = i; j < flavour.size(); ++j)