From 18211eb5b13fa2738061b4c48a7518c7368c2645 Mon Sep 17 00:00:00 2001 From: Lanny91 Date: Thu, 22 Jun 2017 16:03:59 +0200 Subject: [PATCH] Hadrons: Fixed test to use new implementation of meson module. --- tests/hadrons/Test_hadrons.hpp | 20 ++++++----- tests/hadrons/Test_hadrons_meson_3pt.cc | 47 ++++++++++--------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/tests/hadrons/Test_hadrons.hpp b/tests/hadrons/Test_hadrons.hpp index a554425d..3492816d 100644 --- a/tests/hadrons/Test_hadrons.hpp +++ b/tests/hadrons/Test_hadrons.hpp @@ -71,6 +71,9 @@ using namespace Hadrons; #define NAME_WALL_SOURCE(t) NAME_3MOM_WALL_SOURCE(t, ZERO_MOM) #define NAME_POINT_SOURCE(pos) ("point_" + pos) +// Meson module "gammas" special values +#define ALL_GAMMAS "all" + #define MAKE_3MOM_WALL_PROP(tW, mom, propName, solver)\ {\ std::string srcName = NAME_3MOM_WALL_SOURCE(tW, mom);\ @@ -364,28 +367,27 @@ inline void makeLoop(Application &application, std::string &propName, * Name: mesonContraction * Purpose: Create meson contraction module and add to application module. * Parameters: application - main application that stores modules. - * npt - specify n-point correlator (for labelling). + * modName - unique module name. + * output - name of output files. * q1 - quark propagator 1. * q2 - quark propagator 2. - * label - unique label to construct module name. - * mom - momentum to project (default is zero) + * sink - sink smearing module. * gammas - gamma insertions at source and sink. * Returns: None. ******************************************************************************/ -inline void mesonContraction(Application &application, unsigned int npt, +inline void mesonContraction(Application &application, + std::string &modName, std::string &output, std::string &q1, std::string &q2, - std::string &label, - std::string mom = ZERO_MOM, + std::string &sink, std::string gammas = "") { - std::string modName = std::to_string(npt) + "pt_" + label; if (!(Environment::getInstance().hasModule(modName))) { MContraction::Meson::Par mesPar; - mesPar.output = std::to_string(npt) + "pt/" + label; + mesPar.output = output; mesPar.q1 = q1; mesPar.q2 = q2; - mesPar.mom = mom; + mesPar.sink = sink; mesPar.gammas = gammas; application.createModule(modName, mesPar); } diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index 7e487153..1cbb866d 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -25,7 +25,7 @@ directory. *******************************************************************************/ -#include +#include "Test_hadrons.hpp" using namespace Grid; using namespace Hadrons; @@ -127,43 +127,34 @@ int main(int argc, char *argv[]) } } + // Point sink. + std::string sink = "sink"; + MSink::Point::Par sinkPar; + sinkPar.mom = ZERO_MOM; + application.createModule(sink, sinkPar); + // contractions MContraction::Meson::Par mesPar; for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int j = i; j < flavour.size(); ++j) { - mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j]; - mesPar.q1 = qName[i]; - mesPar.q2 = qName[j]; - mesPar.gammas = "all"; - mesPar.mom = "0. 0. 0. 0."; - application.createModule("meson_Z2_" - + std::to_string(t) - + "_" - + flavour[i] - + flavour[j], - mesPar); + std::string modName = "meson_Z2_" + std::to_string(t) + "_" + \ + flavour[i] + flavour[j]; + std::string output = "mesons/Z2_" + flavour[i] + flavour[j]; + mesonContraction(application, modName, output, qName[i], qName[j], + sink, ALL_GAMMAS); } for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int j = 0; j < flavour.size(); ++j) for (unsigned int mu = 0; mu < Nd; ++mu) { - MContraction::Meson::Par mesPar; - - mesPar.output = "3pt/Z2_" + flavour[i] + flavour[j] + "_" - + std::to_string(mu); - mesPar.q1 = qName[i]; - mesPar.q2 = seqName[j][mu]; - mesPar.gammas = "all"; - mesPar.mom = "0. 0. 0. 0."; - application.createModule("3pt_Z2_" - + std::to_string(t) - + "_" - + flavour[i] - + flavour[j] - + "_" - + std::to_string(mu), - mesPar); + std::string modName = "3pt_Z2_" + std::to_string(t) + "_" + \ + flavour[i] + flavour[j] + "_" + \ + std::to_string(mu); + std::string output = "3pt/Z2_" + flavour[i] + \ + flavour[j] + "_" + std::to_string(mu); + mesonContraction(application, modName, output, + qName[i], seqName[j][mu], sink, ALL_GAMMAS); } }