From 8e0ced627a9b134e8a99bc94b9b5032e8a8141ed Mon Sep 17 00:00:00 2001 From: Lanny91 Date: Fri, 26 May 2017 15:59:15 +0100 Subject: [PATCH 1/2] Hadrons: Fermion boundary conditions can now be set in measurement code. --- extras/Hadrons/Modules/MAction/DWF.hpp | 10 ++++++++-- extras/Hadrons/Modules/MAction/Wilson.hpp | 10 ++++++++-- tests/hadrons/Test_hadrons_meson_3pt.cc | 5 +++++ tests/hadrons/Test_hadrons_rarekaon.cc | 5 +++++ tests/hadrons/Test_hadrons_spectrum.cc | 5 +++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/extras/Hadrons/Modules/MAction/DWF.hpp b/extras/Hadrons/Modules/MAction/DWF.hpp index 49861e3e..880fe7b9 100644 --- a/extras/Hadrons/Modules/MAction/DWF.hpp +++ b/extras/Hadrons/Modules/MAction/DWF.hpp @@ -48,7 +48,8 @@ public: std::string, gauge, unsigned int, Ls, double , mass, - double , M5); + double , M5, + std::string , boundary); }; template @@ -116,14 +117,19 @@ void TDWF::execute(void) << par().mass << ", M5= " << par().M5 << " and Ls= " << par().Ls << " using gauge field '" << par().gauge << "'" << std::endl; + LOG(Message) << "Fermion boundary conditions: " << par().boundary + << std::endl; env().createGrid(par().Ls); auto &U = *env().template getObject(par().gauge); auto &g4 = *env().getGrid(); auto &grb4 = *env().getRbGrid(); auto &g5 = *env().getGrid(par().Ls); auto &grb5 = *env().getRbGrid(par().Ls); + std::vector boundary = strToVec(par().boundary); + typename DomainWallFermion::ImplParams implParams(boundary); FMat *fMatPt = new DomainWallFermion(U, g5, grb5, g4, grb4, - par().mass, par().M5); + par().mass, par().M5, + implParams); env().setObject(getName(), fMatPt); } diff --git a/extras/Hadrons/Modules/MAction/Wilson.hpp b/extras/Hadrons/Modules/MAction/Wilson.hpp index 6ffa997d..4b84bda5 100644 --- a/extras/Hadrons/Modules/MAction/Wilson.hpp +++ b/extras/Hadrons/Modules/MAction/Wilson.hpp @@ -46,7 +46,8 @@ class WilsonPar: Serializable public: GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonPar, std::string, gauge, - double , mass); + double , mass, + std::string, boundary); }; template @@ -112,10 +113,15 @@ void TWilson::execute() { LOG(Message) << "Setting up TWilson fermion matrix with m= " << par().mass << " using gauge field '" << par().gauge << "'" << std::endl; + LOG(Message) << "Fermion boundary conditions: " << par().boundary + << std::endl; auto &U = *env().template getObject(par().gauge); auto &grid = *env().getGrid(); auto &gridRb = *env().getRbGrid(); - FMat *fMatPt = new WilsonFermion(U, grid, gridRb, par().mass); + std::vector boundary = strToVec(par().boundary); + typename WilsonFermion::ImplParams implParams(boundary); + FMat *fMatPt = new WilsonFermion(U, grid, gridRb, par().mass, + implParams); env().setObject(getName(), fMatPt); } diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index efef6931..7e487153 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -61,6 +61,10 @@ int main(int argc, char *argv[]) // gauge field application.createModule("gauge"); + + // set fermion boundary conditions to be periodic space, antiperiodic time. + std::string boundary = "1 1 1 -1"; + for (unsigned int i = 0; i < flavour.size(); ++i) { // actions @@ -69,6 +73,7 @@ int main(int argc, char *argv[]) actionPar.Ls = 12; actionPar.M5 = 1.8; actionPar.mass = mass[i]; + actionPar.boundary = boundary; application.createModule("DWF_" + flavour[i], actionPar); // solvers diff --git a/tests/hadrons/Test_hadrons_rarekaon.cc b/tests/hadrons/Test_hadrons_rarekaon.cc index 89d7d501..ab4d3ef1 100644 --- a/tests/hadrons/Test_hadrons_rarekaon.cc +++ b/tests/hadrons/Test_hadrons_rarekaon.cc @@ -98,6 +98,10 @@ int main(int argc, char *argv[]) gaugePar.file = configStem; application.createModule("gauge", gaugePar); } + + // set fermion boundary conditions to be periodic space, antiperiodic time. + std::string boundary = "1 1 1 -1"; + for (unsigned int i = 0; i < flavour.size(); ++i) { // actions @@ -106,6 +110,7 @@ int main(int argc, char *argv[]) actionPar.Ls = 16; actionPar.M5 = 1.8; actionPar.mass = mass[i]; + actionPar.boundary = boundary; application.createModule("DWF_" + flavour[i], actionPar); // solvers diff --git a/tests/hadrons/Test_hadrons_spectrum.cc b/tests/hadrons/Test_hadrons_spectrum.cc index 2d731ff4..55f3346e 100644 --- a/tests/hadrons/Test_hadrons_spectrum.cc +++ b/tests/hadrons/Test_hadrons_spectrum.cc @@ -63,6 +63,10 @@ int main(int argc, char *argv[]) MSource::Point::Par ptPar; ptPar.position = "0 0 0 0"; application.createModule("pt", ptPar); + + // set fermion boundary conditions to be periodic space, antiperiodic time. + std::string boundary = "1 1 1 -1"; + for (unsigned int i = 0; i < flavour.size(); ++i) { // actions @@ -71,6 +75,7 @@ int main(int argc, char *argv[]) actionPar.Ls = 12; actionPar.M5 = 1.8; actionPar.mass = mass[i]; + actionPar.boundary = boundary; application.createModule("DWF_" + flavour[i], actionPar); // solvers From 064315c00b4d3501e2695b0aa1757a302a9f8ed4 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 29 May 2017 12:57:33 +0100 Subject: [PATCH 2/2] Hadrons: mesons gamma list fix --- extras/Hadrons/Modules/MContraction/Meson.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extras/Hadrons/Modules/MContraction/Meson.hpp b/extras/Hadrons/Modules/MContraction/Meson.hpp index 4cbe1ac4..09c2a6e1 100644 --- a/extras/Hadrons/Modules/MContraction/Meson.hpp +++ b/extras/Hadrons/Modules/MContraction/Meson.hpp @@ -131,12 +131,11 @@ std::vector TMeson::getOutput(void) template void TMeson::parseGammaString(std::vector &gammaList) { + gammaList.clear(); // Determine gamma matrices to insert at source/sink. if (par().gammas.compare("all") == 0) { // Do all contractions. - unsigned int n_gam = Ns * Ns; - gammaList.resize(n_gam*n_gam); for (unsigned int i = 1; i < Gamma::nGamma; i += 2) { for (unsigned int j = 1; j < Gamma::nGamma; j += 2)