From 94accec311acfa99f6ce7304b7fcbc6476dc3e69 Mon Sep 17 00:00:00 2001 From: fionnoh Date: Wed, 15 May 2019 13:35:47 +0100 Subject: [PATCH] Added gauge transform option to eigpack IO --- Hadrons/Modules/MIO/LoadEigenPack.cc | 4 +- Hadrons/Modules/MIO/LoadEigenPack.hpp | 64 +++++++++++++++++++++------ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/Hadrons/Modules/MIO/LoadEigenPack.cc b/Hadrons/Modules/MIO/LoadEigenPack.cc index 15153871..0750d265 100644 --- a/Hadrons/Modules/MIO/LoadEigenPack.cc +++ b/Hadrons/Modules/MIO/LoadEigenPack.cc @@ -31,7 +31,7 @@ using namespace Grid; using namespace Hadrons; using namespace MIO; -template class Grid::Hadrons::MIO::TLoadEigenPack>; +template class Grid::Hadrons::MIO::TLoadEigenPack, GIMPL>; #ifdef GRID_DEFAULT_PRECISION_DOUBLE -template class Grid::Hadrons::MIO::TLoadEigenPack>; +template class Grid::Hadrons::MIO::TLoadEigenPack, GIMPL>; #endif diff --git a/Hadrons/Modules/MIO/LoadEigenPack.hpp b/Hadrons/Modules/MIO/LoadEigenPack.hpp index 9751073a..1fffb645 100644 --- a/Hadrons/Modules/MIO/LoadEigenPack.hpp +++ b/Hadrons/Modules/MIO/LoadEigenPack.hpp @@ -47,16 +47,21 @@ public: std::string, filestem, bool, multiFile, unsigned int, size, - unsigned int, Ls); + unsigned int, Ls, + std::string, gaugeXform); }; -template +template class TLoadEigenPack: public Module { public: typedef typename Pack::Field Field; typedef typename Pack::FieldIo FieldIo; typedef BaseEigenPack BasePack; + +public: + GAUGE_TYPE_ALIASES(GImpl, ); + typedef typename GImpl::GaugeLinkField GaugeMat; public: // constructor TLoadEigenPack(const std::string name); @@ -71,31 +76,36 @@ public: virtual void execute(void); }; -MODULE_REGISTER_TMP(LoadFermionEigenPack, TLoadEigenPack>, MIO); +MODULE_REGISTER_TMP(LoadFermionEigenPack, ARG(TLoadEigenPack, GIMPL>), MIO); #ifdef GRID_DEFAULT_PRECISION_DOUBLE -MODULE_REGISTER_TMP(LoadFermionEigenPackIo32, ARG(TLoadEigenPack>), MIO); +MODULE_REGISTER_TMP(LoadFermionEigenPackIo32, ARG(TLoadEigenPack, GIMPL>), MIO); #endif /****************************************************************************** * TLoadEigenPack implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// -template -TLoadEigenPack::TLoadEigenPack(const std::string name) +template +TLoadEigenPack::TLoadEigenPack(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// -template -std::vector TLoadEigenPack::getInput(void) +template +std::vector TLoadEigenPack::getInput(void) { std::vector in; + + if (!par().gaugeXform.empty()) + { + in = {par().gaugeXform}; + } return in; } -template -std::vector TLoadEigenPack::getOutput(void) +template +std::vector TLoadEigenPack::getOutput(void) { std::vector out = {getName()}; @@ -103,8 +113,8 @@ std::vector TLoadEigenPack::getOutput(void) } // setup /////////////////////////////////////////////////////////////////////// -template -void TLoadEigenPack::setup(void) +template +void TLoadEigenPack::setup(void) { GridBase *gridIo = nullptr; @@ -114,16 +124,42 @@ void TLoadEigenPack::setup(void) } envCreateDerived(BasePack, Pack, getName(), par().Ls, par().size, envGetRbGrid(Field, par().Ls), gridIo); + + if (!par().gaugeXform.empty()) + { + envTmp(GaugeMat, "tmp5dXform", par().Ls, envGetGrid5(Field, par().Ls)); + envTmp(GaugeMat, "tmp5dXformOdd", par().Ls, envGetRbGrid5(Field, par().Ls)); + } } // execution /////////////////////////////////////////////////////////////////// -template -void TLoadEigenPack::execute(void) +template +void TLoadEigenPack::execute(void) { auto &epack = envGetDerived(BasePack, Pack, getName()); epack.read(par().filestem, par().multiFile, vm().getTrajectory()); epack.eval.resize(par().size); + + if (!par().gaugeXform.empty()) + { + auto &xform = envGet(GaugeMat, par().gaugeXform); + envGetTmp(GaugeMat, tmp5dXform); + envGetTmp(GaugeMat, tmp5dXformOdd); + + for (unsigned int j = 0; j < par().Ls; j++) + { + InsertSlice(xform, tmp5dXform, j, 0); + } + + pickCheckerboard(Odd, tmp5dXformOdd, tmp5dXform); + for (unsigned int i = 0; i < par().size; i++) + { + LOG(Message) << "Applying gauge transformation to eigenvector i = " << i << std::endl; + epack.evec[i].checkerboard = Odd; + epack.evec[i] = tmp5dXformOdd * epack.evec[i]; + } + } } END_MODULE_NAMESPACE