diff --git a/extras/Hadrons/Modules.hpp b/extras/Hadrons/Modules.hpp index e1f06f32..a52b9a6e 100644 --- a/extras/Hadrons/Modules.hpp +++ b/extras/Hadrons/Modules.hpp @@ -1,60 +1,31 @@ -/************************************************************************************* - -Grid physics library, www.github.com/paboyle/Grid - -Source file: extras/Hadrons/Modules.hpp - -Copyright (C) 2015 -Copyright (C) 2016 -Copyright (C) 2017 - -Author: Antonin Portelli - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -See the full license in the file "LICENSE" in the top level distribution directory -*************************************************************************************/ -/* END LEGAL */ - -#include -#include -#include -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include #include -#include #include +#include #include #include #include -#include +#include +#include +#include #include #include #include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include diff --git a/extras/Hadrons/Modules/MSource/SeqConservedSummed.hpp b/extras/Hadrons/Modules/MSource/SeqConservedSummed.hpp new file mode 100644 index 00000000..2296701a --- /dev/null +++ b/extras/Hadrons/Modules/MSource/SeqConservedSummed.hpp @@ -0,0 +1,165 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: extras/Hadrons/Modules/MContraction/SeqConservedSummed.hpp + +Copyright (C) 2017 + +Author: Andrew Lawson +Author: Vera Guelpers + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +See the full license in the file "LICENSE" in the top level distribution directory +*************************************************************************************/ +/* END LEGAL */ + +#ifndef Hadrons_MSource_SeqConservedSummed_hpp_ +#define Hadrons_MSource_SeqConservedSummed_hpp_ + +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/* + + Sequential source summed over the Lorentz index of current + ----------------------------- + * src_x = sum_mu q_x * theta(x_3 - tA) * theta(tB - x_3) * J_mu * exp(i x.mom) + + * options: + - q: input propagator (string) + - action: fermion action used for propagator q (string) + - tA: begin timeslice (integer) + - tB: end timesilce (integer) + - curr_type: type of conserved current to insert (Current) + - mom: momentum insertion, space-separated float sequence (e.g ".1 .2 1. 0.") + + */ + +/****************************************************************************** + * SeqConservedSummed * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MSource) + +class SeqConservedSummedPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(SeqConservedSummedPar, + std::string, q, + std::string, action, + unsigned int, tA, + unsigned int, tB, + Current, curr_type, + std::string, mom); +}; + +template +class TSeqConservedSummed: public Module +{ +public: + FERM_TYPE_ALIASES(FImpl,); +public: + // constructor + TSeqConservedSummed(const std::string name); + // destructor + virtual ~TSeqConservedSummed(void) = default; + // dependency relation + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // setup + virtual void setup(void); + // execution + virtual void execute(void); +}; + +MODULE_REGISTER_NS(SeqConservedSummed, TSeqConservedSummed, MSource); + +/****************************************************************************** + * TSeqConservedSummed implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TSeqConservedSummed::TSeqConservedSummed(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TSeqConservedSummed::getInput(void) +{ + std::vector in = {par().q, par().action}; + + return in; +} + +template +std::vector TSeqConservedSummed::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TSeqConservedSummed::setup(void) +{ + auto Ls_ = env().getObjectLs(par().action); + env().template registerLattice(getName(), Ls_); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TSeqConservedSummed::execute(void) +{ + if (par().tA == par().tB) + { + LOG(Message) << "Generating sequential source with conserved " + << par().curr_type << " current insertion summed over mu at " + << "t = " << par().tA << std::endl; + } + else + { + LOG(Message) << "Generating sequential source with conserved " + << par().curr_type << " current insertion summed over mu for " + << par().tA << " <= t <= " + << par().tB << std::endl; + } + PropagatorField &src = *env().template createLattice(getName()); + auto src_buf = src; + PropagatorField &q = *env().template getObject(par().q); + FMat &mat = *(env().template getObject(par().action)); + + std::vector mom = strToVec(par().mom); + src = zero; + for(int mu=0;mu<=3;mu++) + { + mat.SeqConservedCurrent(q, src_buf, par().curr_type, mu, + mom, par().tA, par().tB); + src += src_buf; + + } + +} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_SeqConservedSummed_hpp_ diff --git a/extras/Hadrons/modules.inc b/extras/Hadrons/modules.inc index fbbb2eb9..1ad4750a 100644 --- a/extras/Hadrons/modules.inc +++ b/extras/Hadrons/modules.inc @@ -1,42 +1,44 @@ modules_cc =\ Modules/MContraction/WeakHamiltonianEye.cc \ - Modules/MContraction/WeakHamiltonianNonEye.cc \ Modules/MContraction/WeakNeutral4ptDisc.cc \ - Modules/MGauge/Load.cc \ + Modules/MContraction/WeakHamiltonianNonEye.cc \ + Modules/MScalar/FreeProp.cc \ + Modules/MScalar/ChargedProp.cc \ Modules/MGauge/Random.cc \ Modules/MGauge/StochEm.cc \ Modules/MGauge/Unit.cc \ - Modules/MScalar/ChargedProp.cc \ - Modules/MScalar/FreeProp.cc + Modules/MGauge/Load.cc modules_hpp =\ - Modules/MAction/DWF.hpp \ - Modules/MAction/Wilson.hpp \ - Modules/MContraction/Baryon.hpp \ - Modules/MContraction/DiscLoop.hpp \ - Modules/MContraction/Gamma3pt.hpp \ - Modules/MContraction/Meson.hpp \ + Modules/MSolver/RBPrecCG.hpp \ Modules/MContraction/WardIdentity.hpp \ - Modules/MContraction/WeakHamiltonian.hpp \ + Modules/MContraction/Meson.hpp \ + Modules/MContraction/Gamma3pt.hpp \ + Modules/MContraction/DiscLoop.hpp \ Modules/MContraction/WeakHamiltonianEye.hpp \ - Modules/MContraction/WeakHamiltonianNonEye.hpp \ + Modules/MContraction/Baryon.hpp \ + Modules/MContraction/WeakHamiltonian.hpp \ Modules/MContraction/WeakNeutral4ptDisc.hpp \ - Modules/MFermion/GaugeProp.hpp \ - Modules/MGauge/Load.hpp \ - Modules/MGauge/Random.hpp \ - Modules/MGauge/StochEm.hpp \ - Modules/MGauge/Unit.hpp \ + Modules/MContraction/WeakHamiltonianNonEye.hpp \ + Modules/MUtilities/TestSeqGamma.hpp \ + Modules/MUtilities/TestSeqConserved.hpp \ Modules/MLoop/NoiseLoop.hpp \ - Modules/MScalar/ChargedProp.hpp \ Modules/MScalar/FreeProp.hpp \ + Modules/MScalar/ChargedProp.hpp \ Modules/MScalar/Scalar.hpp \ Modules/MSink/Point.hpp \ Modules/MSink/Smear.hpp \ - Modules/MSolver/RBPrecCG.hpp \ + Modules/MFermion/GaugeProp.hpp \ + Modules/MSource/SeqConservedSummed.hpp \ + Modules/MSource/Wall.hpp \ Modules/MSource/Point.hpp \ Modules/MSource/SeqConserved.hpp \ Modules/MSource/SeqGamma.hpp \ - Modules/MSource/Wall.hpp \ Modules/MSource/Z2.hpp \ - Modules/MUtilities/TestSeqConserved.hpp \ - Modules/MUtilities/TestSeqGamma.hpp + Modules/MGauge/Load.hpp \ + Modules/MGauge/StochEm.hpp \ + Modules/MGauge/Random.hpp \ + Modules/MGauge/Unit.hpp \ + Modules/MAction/DWF.hpp \ + Modules/MAction/Wilson.hpp +