diff --git a/tests/hadrons/Test_hadrons.hpp b/tests/hadrons/Test_hadrons.hpp index c0a596b5..61e90bac 100644 --- a/tests/hadrons/Test_hadrons.hpp +++ b/tests/hadrons/Test_hadrons.hpp @@ -82,11 +82,11 @@ using namespace Hadrons; MAKE_3MOM_WALL_PROP(tW, ZERO_MOM, propName, solver) // Sequential source macros -#define MAKE_SEQUENTIAL_PROP(tS, qSrc, mom, propName, solver)\ +#define MAKE_SEQUENTIAL_PROP(tS, qSrc, mom, seqPropName, solver, gamma)\ {\ - std::string srcName = ADD_INDEX(qSrc + "_seq", tS);\ - makeSequentialSource(application, srcName, qSrc, tS, mom);\ - makePropagator(application, propName, srcName, solver);\ + std::string srcName = seqPropName + "_src";\ + makeSequentialSource(application, srcName, qSrc, tS, gamma, mom);\ + makePropagator(application, seqPropName, srcName, solver);\ } // Point source macros @@ -205,6 +205,7 @@ inline void makePointSource(Application &application, std::string srcName, ******************************************************************************/ inline void makeSequentialSource(Application &application, std::string srcName, std::string qSrc, unsigned int tS, + Gamma::Algebra gamma = Gamma::Algebra::GammaT, std::string mom = ZERO_MOM) { // If the source already exists, don't make the module again. @@ -215,7 +216,7 @@ inline void makeSequentialSource(Application &application, std::string srcName, seqPar.tA = tS; seqPar.tB = tS; seqPar.mom = mom; - seqPar.gamma = Gamma::Algebra::GammaT; + seqPar.gamma = gamma; application.createModule(srcName, seqPar); } } @@ -579,3 +580,34 @@ inline void makeSeqTest(Application &application, std::string &modName, application.createModule(modName, seqPar); } } + +/******************************************************************************* + * Name: makeSeqGamComparison + * Purpose: Create module to compare sequential insertion of gamma matrix + * against sink contraction and add to application module. + * Parameters: application - main application that stores modules. + * modName - name of module to create. + * propName - 4D quark propagator. + * seqProp - 4D quark propagator with sequential insertion of + * gamma matrix. + * gamma - Inserted gamma matrix. + * t_g - time at which gamma matrix is inserted + * sequentially. + * Returns: None. + ******************************************************************************/ +inline void makeSeqGamComparison(Application &application, std::string &modName, + std::string &propName, std::string &seqProp, + std::string &origin, Gamma::Algebra gamma, + unsigned int t_g) +{ + if (!(Environment::getInstance().hasModule(modName))) + { + MUtilities::TestSeqGamma::Par seqPar; + seqPar.q = propName; + seqPar.qSeq = seqProp; + seqPar.origin = origin; + seqPar.t_g = t_g; + seqPar.gamma = gamma; + application.createModule(modName, seqPar); + } +} diff --git a/tests/hadrons/Test_hadrons_rarekaon.cc b/tests/hadrons/Test_hadrons_rarekaon.cc index 1b5a45d9..3a642f24 100644 --- a/tests/hadrons/Test_hadrons_rarekaon.cc +++ b/tests/hadrons/Test_hadrons_rarekaon.cc @@ -212,10 +212,10 @@ int main(int argc, char *argv[]) std::string q_KsCs_mq = LABEL_3PT("Q_KsCs_mq", tK, tJ); std::string q_pilCl_q = LABEL_3PT("Q_pilCl_q", tpi, tJ); std::string q_pilCl_mq = LABEL_3PT("Q_pilCl_mq", tpi, tJ); - MAKE_SEQUENTIAL_PROP(tJ, q_Kl_0, qmom, q_KlCl_q, solvers[light]); - MAKE_SEQUENTIAL_PROP(tJ, q_Ks_k, mqmom, q_KsCs_mq, solvers[strange]); - MAKE_SEQUENTIAL_PROP(tJ, q_pil_p, qmom, q_pilCl_q, solvers[light]); - MAKE_SEQUENTIAL_PROP(tJ, q_pil_0, mqmom, q_pilCl_mq, solvers[light]); + MAKE_SEQUENTIAL_PROP(tJ, q_Kl_0, qmom, q_KlCl_q, solvers[light], gT); + MAKE_SEQUENTIAL_PROP(tJ, q_Ks_k, mqmom, q_KsCs_mq, solvers[strange], gT); + MAKE_SEQUENTIAL_PROP(tJ, q_pil_p, qmom, q_pilCl_q, solvers[light], gT); + MAKE_SEQUENTIAL_PROP(tJ, q_pil_0, mqmom, q_pilCl_mq, solvers[light], gT); /******************************************************************* * CONTRACTIONS: pi and K 3pt contractions with current insertion. @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) std::string loop_qCq = LABEL_3PT(loop_stem + flavour[f], tJ, nn); std::string loop_qCq_res = loop_qCq + "_res"; MAKE_SEQUENTIAL_PROP(tJ, noiseRes[f][nn], qmom, - loop_qCq_res, solvers[f]); + loop_qCq_res, solvers[f], gT); makeLoop(application, loop_qCq, eta, loop_qCq_res); /******************************************************* diff --git a/tests/hadrons/Test_hadrons_seq_gamma.cc b/tests/hadrons/Test_hadrons_seq_gamma.cc new file mode 100644 index 00000000..22c35ecb --- /dev/null +++ b/tests/hadrons/Test_hadrons_seq_gamma.cc @@ -0,0 +1,89 @@ +/******************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: tests/hadrons/Test_hadrons_seq_gamma.cc + + Copyright (C) 2017 + + Author: Andrew Lawson + + 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. + *******************************************************************************/ + +#include "Test_hadrons.hpp" + +using namespace Grid; +using namespace QCD; +using namespace Hadrons; + +/******************************************************************************* + * Consistency test for sequential gamma insertion. + ******************************************************************************/ + +int main(int argc, char *argv[]) +{ + // initialization ////////////////////////////////////////////////////////// + HADRONS_DEFAULT_INIT; + + // run setup /////////////////////////////////////////////////////////////// + Application application; + unsigned int nt = GridDefaultLatt()[Tp]; + unsigned int tS = nt / 2; + unsigned int Ls = 12; + double mass = 0.04; + double M5 = 1.8; + + // global parameters + HADRONS_DEFAULT_GLOBALS(application); + + // gauge field + std::string gaugeField = "gauge"; + application.createModule(gaugeField); + + // action + std::string actionName = "DWF"; + makeDWFAction(application, actionName, gaugeField, mass, M5, Ls); + + // solver + std::string solverName = "CG"; + makeRBPrecCGSolver(application, solverName, actionName); + + // test sequential propagator, with g5 insertion. + Gamma::Algebra g = Gamma::Algebra::Gamma5; + std::string pointProp = "q_0"; + std::string point5d = LABEL_5D(pointProp); + std::string origin = "0 0 0 0"; + MAKE_POINT_PROP(origin, pointProp, solverName); + + std::string seqProp = ADD_INDEX(pointProp + "_seqg5", tS); + std::string seqSrc = seqProp + "_src"; + MAKE_SEQUENTIAL_PROP(tS, pointProp, ZERO_MOM, seqProp, solverName, g); + + std::string modName = "Test g5 sequential insertion"; + makeSeqGamComparison(application, modName, pointProp, seqProp, origin, g, tS); + + // execution + application.saveParameterFile("SeqGamma5Test.xml"); + application.run(); + + // epilogue + LOG(Message) << "Grid is finalizing now" << std::endl; + Grid_finalize(); + + return EXIT_SUCCESS; +} \ No newline at end of file