/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: Hadrons/Modules/MNPR/Bilinear.hpp Copyright (C) 2015-2019 Author: Antonin Portelli Author: Julia Kettle J.R.Kettle-2@sms.ed.ac.uk Author: Peter Boyle 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_Bilinear_hpp_ #define Hadrons_Bilinear_hpp_ #include #include #include #include //#include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * TBilinear * Performs bilinear contractions of the type tr[g5*adj(Sout)*g5*G*Sin] Suitable for non exceptional momenta in Rome-Southampton NPR ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MNPR) class BilinearPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(BilinearPar, std::string, Sin, std::string, Sout, std::string, pin, std::string, pout, std::string, output); }; template class TBilinear: public Module { public: FERM_TYPE_ALIASES(FImpl1, 1); FERM_TYPE_ALIASES(FImpl2, 2); class Result: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(Result, std::vector, bilinear); }; public: // constructor TBilinear(const std::string name); // destructor virtual ~TBilinear(void) {}; // dependencies/products virtual std::vector getInput(void); virtual std::vector getOutput(void); //LatticeSpinColourMatrix PhaseProps(LatticeSpinColourMatrix S, std::vector p); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(Bilinear, ARG(TBilinear), MNPR); /****************************************************************************** * TBilinear implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TBilinear::TBilinear(const std::string name) : Module(name) {} // setup /////////////////////////////////////////////////////////////////////// template void TBilinear::setup(void) { //env().template registerLattice(getName()); //env().template registerObject(getName()); } // dependencies/products /////////////////////////////////////////////////////// template std::vector TBilinear::getInput(void) { std::vector input = {par().Sin, par().Sout}; return input; } template std::vector TBilinear::getOutput(void) { std::vector out = {getName()}; return out; } /* /////Phase propagators////////////////////////// template LatticeSpinColourMatrix TBilinear::PhaseProps(LatticeSpinColourMatrix S, std::vector p) { GridBase *grid = S._grid; LatticeComplex pdotx(grid), coor(grid); std::vector latt_size = grid->_fdimensions; Complex Ci(0.0,1.0); pdotx=Zero(); for (unsigned int mu = 0; mu < 4; ++mu) { Real TwoPiL = M_PI * 2.0/ latt_size[mu]; LatticeCoordinate(coor,mu); pdotx = pdotx +(TwoPiL * p[mu]) * coor; } S = S*exp(-Ci*pdotx); return S; } */ // execution /////////////////////////////////////////////////////////////////// template void TBilinear::execute(void) { /************************************************************************** Compute the bilinear vertex needed for the NPR. V(G) = sum_x [ g5 * adj(S'(x,p2)) * g5 * G * S'(x,p1) ]_{si,sj,ci,cj} G is one of the 16 gamma vertices [I,gmu,g5,g5gmu,sig(mu,nu)] * G / \ p1/ \p2 / \ / \ Returns a spin-colour matrix, with indices si,sj, ci,cj Conventions: p1 - incoming momenta p2 - outgoing momenta q = (p1-p2) **************************************************************************/ LOG(Message) << "Computing bilinear contractions '" << getName() << "' using" << " momentum '" << par().Sin << "' and '" << par().Sout << "'" << std::endl; BinaryWriter writer(par().output); // Propogators LatticeSpinColourMatrix &Sin = *env().template getObject(par().Sin); LatticeSpinColourMatrix &Sout = *env().template getObject(par().Sout); LatticeComplex pdotxin(env().getGrid()), pdotxout(env().getGrid()), coor(env().getGrid()); // momentum on legs std::vector pin = strToVec(par().pin), pout = strToVec(par().pout); std::vector latt_size(pin.begin(), pin.end()); //bilinears LatticeSpinColourMatrix bilinear_x(env().getGrid()); SpinColourMatrix bilinear; Gamma g5(Gamma::Algebra::Gamma5); Result result; Complex Ci(0.0,1.0); // pdotxin=Zero(); pdotxout=Zero(); for (unsigned int mu = 0; mu < 4; ++mu) { Real TwoPiL = M_PI * 2.0/ latt_size[mu]; LatticeCoordinate(coor,mu); pdotxin = pdotxin +(TwoPiL * pin[mu]) * coor; pdotxout= pdotxout +(TwoPiL * pout[mu]) * coor; } Sin = Sin*exp(-Ci*pdotxin); //phase corrections Sout = Sout*exp(-Ci*pdotxout); ////Set up gamma vector////////////////////////// std::vector gammavector; for( int i=0; i