diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index da289307..787fecea 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Hadrons/Modules/MSolver/A2AAslashVector.cc b/Hadrons/Modules/MSolver/A2AAslashVectors.cc similarity index 82% rename from Hadrons/Modules/MSolver/A2AAslashVector.cc rename to Hadrons/Modules/MSolver/A2AAslashVectors.cc index 27344397..74e9f59f 100644 --- a/Hadrons/Modules/MSolver/A2AAslashVector.cc +++ b/Hadrons/Modules/MSolver/A2AAslashVectors.cc @@ -2,7 +2,7 @@ Grid physics library, www.github.com/paboyle/Grid -Source file: Hadrons/Modules/MSolver/A2AAslashVector.cc +Source file: Hadrons/Modules/MSolver/A2AAslashVectors.cc Copyright (C) 2015-2018 @@ -25,11 +25,11 @@ with this program; if not, write to the Free Software Foundation, Inc., See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ -#include +#include using namespace Grid; using namespace Hadrons; using namespace MSolver; -template class Grid::Hadrons::MSolver::TA2AAslashVector; -template class Grid::Hadrons::MSolver::TA2AAslashVector; +template class Grid::Hadrons::MSolver::TA2AAslashVectors; +template class Grid::Hadrons::MSolver::TA2AAslashVectors; diff --git a/Hadrons/Modules/MSolver/A2AAslashVector.hpp b/Hadrons/Modules/MSolver/A2AAslashVectors.hpp similarity index 66% rename from Hadrons/Modules/MSolver/A2AAslashVector.hpp rename to Hadrons/Modules/MSolver/A2AAslashVectors.hpp index 3142d1e7..08c16729 100644 --- a/Hadrons/Modules/MSolver/A2AAslashVector.hpp +++ b/Hadrons/Modules/MSolver/A2AAslashVectors.hpp @@ -2,7 +2,7 @@ Grid physics library, www.github.com/paboyle/Grid -Source file: Hadrons/Modules/MSolver/A2AAslashVector.hpp +Source file: Hadrons/Modules/MSolver/A2AAslashVectors.hpp Copyright (C) 2015-2018 @@ -25,13 +25,14 @@ with this program; if not, write to the Free Software Foundation, Inc., See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ -#ifndef Hadrons_MSolver_A2AAslashVector_hpp_ -#define Hadrons_MSolver_A2AAslashVector_hpp_ +#ifndef Hadrons_MSolver_A2AAslashVectors_hpp_ +#define Hadrons_MSolver_A2AAslashVectors_hpp_ #include #include #include #include +#include BEGIN_HADRONS_NAMESPACE @@ -54,29 +55,30 @@ BEGIN_MODULE_NAMESPACE(MSolver) * *****************************************************************************/ - -class A2AAslashVectorPar: Serializable +class A2AAslashVectorsPar: Serializable { public: - GRID_SERIALIZABLE_CLASS_MEMBERS(A2AAslashVectorPar, + GRID_SERIALIZABLE_CLASS_MEMBERS(A2AAslashVectorsPar, std::string, vector, std::string, emField, - std::string, solver); + std::string, solver, + std::string, output, + bool, multiFile); }; template -class TA2AAslashVector : public Module +class TA2AAslashVectors : public Module { public: FERM_TYPE_ALIASES(FImpl,); SOLVER_TYPE_ALIASES(FImpl,); public: - typedef PhotonR::GaugeField EmField; + typedef PhotonR::GaugeField EmField; public: // constructor - TA2AAslashVector(const std::string name); + TA2AAslashVectors(const std::string name); // destructor - virtual ~TA2AAslashVector(void) {}; + virtual ~TA2AAslashVectors(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); @@ -88,21 +90,21 @@ private: unsigned int Ls_; }; -MODULE_REGISTER_TMP(A2AAslashVector,TA2AAslashVector, MSolver); -MODULE_REGISTER_TMP(ZA2AAslashVector,TA2AAslashVector, MSolver); +MODULE_REGISTER_TMP(A2AAslashVectors, TA2AAslashVectors, MSolver); +MODULE_REGISTER_TMP(ZA2AAslashVectors, TA2AAslashVectors, MSolver); /****************************************************************************** - * TA2AAslashVector implementation * + * TA2AAslashVectors implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template -TA2AAslashVector::TA2AAslashVector(const std::string name) -: Module(name) +TA2AAslashVectors::TA2AAslashVectors(const std::string name) +: Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template -std::vector TA2AAslashVector::getInput(void) +std::vector TA2AAslashVectors::getInput(void) { std::vector in = {par().vector, par().emField, par().solver}; @@ -110,7 +112,7 @@ std::vector TA2AAslashVector::getInput(void) } template -std::vector TA2AAslashVector::getOutput(void) +std::vector TA2AAslashVectors::getOutput(void) { std::vector out = {getName()}; @@ -119,7 +121,7 @@ std::vector TA2AAslashVector::getOutput(void) // setup /////////////////////////////////////////////////////////////////////// template -void TA2AAslashVector::setup(void) +void TA2AAslashVectors::setup(void) { Ls_ = env().getObjectLs(par().solver); auto &vvector = envGet(std::vector, par().vector); @@ -134,7 +136,7 @@ void TA2AAslashVector::setup(void) // execution /////////////////////////////////////////////////////////////////// template -void TA2AAslashVector::execute(void) +void TA2AAslashVectors::execute(void) { auto &solver = envGet(Solver, par().solver); auto &stoch_photon = envGet(EmField, par().emField); @@ -148,42 +150,45 @@ void TA2AAslashVector::execute(void) Complex ci(0.0,1.0); - startTimer("Seq Aslash"); - - LOG(Message) << "Calculate Sequential propagator on Aslash * v with the A2A vector " << par().vector - << " and the photon field " << par().emField << std::endl; - - + LOG(Message) << "Calculate Sequential propagator on Aslash * v with the A2A vector " + << par().vector << " and the photon field " << par().emField << std::endl; for(unsigned int i=0; i(stoch_photon, mu) * (gmu * vvector[i]); - } - stopTimer("Multiply Aslash"); + v4dtmp = zero; + startTimer("Multiply Aslash"); + for(unsigned int mu=0;mu<=3;mu++) + { + Gamma gmu(Gamma::gmu[mu]); + v4dtmp += ci * PeekIndex(stoch_photon, mu) * (gmu * vvector[i]); + } + stopTimer("Multiply Aslash"); - if (Ls_ == 1) - { - solver(Aslashv[i], v4dtmp); - } - else - { - mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp); - solver(v5dtmp_sol, v5dtmp); - mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp); - Aslashv[i] = v4dtmp; - } + startTimer("Inversion"); + if (Ls_ == 1) + { + solver(Aslashv[i], v4dtmp); + } + else + { + mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp); + solver(v5dtmp_sol, v5dtmp); + mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp); + Aslashv[i] = v4dtmp; + } + stopTimer("Inversion"); } - stopTimer("Seq Aslash"); + if (!par().output.empty()) + { + startTimer("I/O"); + A2AVectorsIo::write(par().output, Aslashv, par().multiFile, vm().getTrajectory()); + stopTimer("I/O"); + } } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE -#endif // Hadrons_MSolver_A2AAslashVector_hpp_ +#endif // Hadrons_MSolver_A2AAslashVectors_hpp_ diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index 2add645c..88cfea88 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -20,7 +20,7 @@ modules_cc =\ Modules/MSink/Point.cc \ Modules/MSink/Smear.cc \ Modules/MSolver/A2AVectors.cc \ - Modules/MSolver/A2AAslashVector.cc \ + Modules/MSolver/A2AAslashVectors.cc \ Modules/MSolver/RBPrecCG.cc \ Modules/MSolver/MixedPrecisionRBPrecCG.cc \ Modules/MSolver/LocalCoherenceLanczos.cc \ @@ -97,7 +97,7 @@ modules_hpp =\ Modules/MSolver/Guesser.hpp \ Modules/MSolver/RBPrecCG.hpp \ Modules/MSolver/A2AVectors.hpp \ - Modules/MSolver/A2AAslashVector.hpp \ + Modules/MSolver/A2AAslashVectors.hpp \ Modules/MGauge/UnitEm.hpp \ Modules/MGauge/StoutSmearing.hpp \ Modules/MGauge/Unit.hpp \