1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: Fixed test to use new implementation of meson module.

This commit is contained in:
Lanny91 2017-06-22 16:03:59 +02:00
parent 863bb2ad10
commit 18211eb5b1
2 changed files with 30 additions and 37 deletions

View File

@ -71,6 +71,9 @@ using namespace Hadrons;
#define NAME_WALL_SOURCE(t) NAME_3MOM_WALL_SOURCE(t, ZERO_MOM) #define NAME_WALL_SOURCE(t) NAME_3MOM_WALL_SOURCE(t, ZERO_MOM)
#define NAME_POINT_SOURCE(pos) ("point_" + pos) #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)\ #define MAKE_3MOM_WALL_PROP(tW, mom, propName, solver)\
{\ {\
std::string srcName = NAME_3MOM_WALL_SOURCE(tW, mom);\ std::string srcName = NAME_3MOM_WALL_SOURCE(tW, mom);\
@ -364,28 +367,27 @@ inline void makeLoop(Application &application, std::string &propName,
* Name: mesonContraction * Name: mesonContraction
* Purpose: Create meson contraction module and add to application module. * Purpose: Create meson contraction module and add to application module.
* Parameters: application - main application that stores modules. * 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. * q1 - quark propagator 1.
* q2 - quark propagator 2. * q2 - quark propagator 2.
* label - unique label to construct module name. * sink - sink smearing module.
* mom - momentum to project (default is zero)
* gammas - gamma insertions at source and sink. * gammas - gamma insertions at source and sink.
* Returns: None. * 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 &q1, std::string &q2,
std::string &label, std::string &sink,
std::string mom = ZERO_MOM,
std::string gammas = "<Gamma5 Gamma5>") std::string gammas = "<Gamma5 Gamma5>")
{ {
std::string modName = std::to_string(npt) + "pt_" + label;
if (!(Environment::getInstance().hasModule(modName))) if (!(Environment::getInstance().hasModule(modName)))
{ {
MContraction::Meson::Par mesPar; MContraction::Meson::Par mesPar;
mesPar.output = std::to_string(npt) + "pt/" + label; mesPar.output = output;
mesPar.q1 = q1; mesPar.q1 = q1;
mesPar.q2 = q2; mesPar.q2 = q2;
mesPar.mom = mom; mesPar.sink = sink;
mesPar.gammas = gammas; mesPar.gammas = gammas;
application.createModule<MContraction::Meson>(modName, mesPar); application.createModule<MContraction::Meson>(modName, mesPar);
} }

View File

@ -25,7 +25,7 @@
directory. directory.
*******************************************************************************/ *******************************************************************************/
#include <Grid/Hadrons/Application.hpp> #include "Test_hadrons.hpp"
using namespace Grid; using namespace Grid;
using namespace Hadrons; 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<MSink::ScalarPoint>(sink, sinkPar);
// contractions // contractions
MContraction::Meson::Par mesPar; MContraction::Meson::Par mesPar;
for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int i = 0; i < flavour.size(); ++i)
for (unsigned int j = i; j < flavour.size(); ++j) for (unsigned int j = i; j < flavour.size(); ++j)
{ {
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j]; std::string modName = "meson_Z2_" + std::to_string(t) + "_" + \
mesPar.q1 = qName[i]; flavour[i] + flavour[j];
mesPar.q2 = qName[j]; std::string output = "mesons/Z2_" + flavour[i] + flavour[j];
mesPar.gammas = "all"; mesonContraction(application, modName, output, qName[i], qName[j],
mesPar.mom = "0. 0. 0. 0."; sink, ALL_GAMMAS);
application.createModule<MContraction::Meson>("meson_Z2_"
+ std::to_string(t)
+ "_"
+ flavour[i]
+ flavour[j],
mesPar);
} }
for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int i = 0; i < flavour.size(); ++i)
for (unsigned int j = 0; j < flavour.size(); ++j) for (unsigned int j = 0; j < flavour.size(); ++j)
for (unsigned int mu = 0; mu < Nd; ++mu) for (unsigned int mu = 0; mu < Nd; ++mu)
{ {
MContraction::Meson::Par mesPar; std::string modName = "3pt_Z2_" + std::to_string(t) + "_" + \
flavour[i] + flavour[j] + "_" + \
mesPar.output = "3pt/Z2_" + flavour[i] + flavour[j] + "_" std::to_string(mu);
+ std::to_string(mu); std::string output = "3pt/Z2_" + flavour[i] + \
mesPar.q1 = qName[i]; flavour[j] + "_" + std::to_string(mu);
mesPar.q2 = seqName[j][mu]; mesonContraction(application, modName, output,
mesPar.gammas = "all"; qName[i], seqName[j][mu], sink, ALL_GAMMAS);
mesPar.mom = "0. 0. 0. 0.";
application.createModule<MContraction::Meson>("3pt_Z2_"
+ std::to_string(t)
+ "_"
+ flavour[i]
+ flavour[j]
+ "_"
+ std::to_string(mu),
mesPar);
} }
} }