/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: Hadrons/Modules/MFermion/EMLepton.hpp Copyright (C) 2015-2019 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_MFermion_EMLepton_hpp_ #define Hadrons_MFermion_EMLepton_hpp_ #include #include #include BEGIN_HADRONS_NAMESPACE /******************************************************************************* * * Calculates a free lepton propagator with a sequential insertion of * i*\gamma_mu A_mu with a photon field A_mu * * L(x) = \sum_y S(x,y) i*\gamma_mu*A_mu S(y,xl) \delta_{(tl-x0),dt} * * with xl = (0,0,0,tl) * * In addition outputs the propagator without photon vertex * * L^{free}(x) = S(x,xl) \delta_{(tl-x0),dt} * * * options: * - action: fermion action used for propagator (string) * - emField: photon field A_mu (string) * - mass: input mass for the lepton propagator * - twist: twisted boundary for lepton propagator, e.g. "0.0 0.0 0.0 0.5" * - deltat: source-sink separation * *******************************************************************************/ /****************************************************************************** * EMLepton * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MFermion) class EMLeptonPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(EMLeptonPar, std::string, action, std::string, emField, double, mass, std::string , boundary, std::string, twist, unsigned int, deltat); }; template class TEMLepton: public Module { public: FERM_TYPE_ALIASES(FImpl,); public: typedef PhotonR::GaugeField EmField; public: // constructor TEMLepton(const std::string name); // destructor virtual ~TEMLepton(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); protected: // setup virtual void setup(void); // execution virtual void execute(void); private: unsigned int Ls_; }; MODULE_REGISTER_TMP(EMLepton, TEMLepton, MFermion); /****************************************************************************** * TEMLepton implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TEMLepton::TEMLepton(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TEMLepton::getInput(void) { std::vector in = {par().action, par().emField}; return in; } template std::vector TEMLepton::getOutput(void) { std::vector out = {getName(), getName() + "_free"}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TEMLepton::setup(void) { Ls_ = env().getObjectLs(par().action); envCreateLat(PropagatorField, getName()); envCreateLat(PropagatorField, getName() + "_free"); envTmpLat(FermionField, "source", Ls_); envTmpLat(FermionField, "sol", Ls_); envTmpLat(FermionField, "tmp"); envTmpLat(PropagatorField, "sourcetmp"); envTmpLat(PropagatorField, "proptmp"); envTmpLat(PropagatorField, "freetmp"); envTmp(Lattice>, "tlat",1, envGetGrid(LatticeComplex)); } // execution /////////////////////////////////////////////////////////////////// template void TEMLepton::execute(void) { LOG(Message) << "Computing free fermion propagator '" << getName() << "'" << std::endl; auto &mat = envGet(FMat, par().action); RealD mass = par().mass; Complex ci(0.0,1.0); PropagatorField &Aslashlep = envGet(PropagatorField, getName()); PropagatorField &lep = envGet(PropagatorField, getName() + "_free"); envGetTmp(FermionField, source); envGetTmp(FermionField, sol); envGetTmp(FermionField, tmp); LOG(Message) << "Calculating a lepton Propagator with sequential Aslash insertion with lepton mass " << mass << " using the action '" << par().action << "' for fixed source-sink separation of " << par().deltat << std::endl; envGetTmp(Lattice>, tlat); LatticeCoordinate(tlat, Tp); std::vector twist = strToVec(par().twist); if(twist.size() != Nd) { HADRONS_ERROR(Size, "number of twist angles does not match number of dimensions"); } std::vector boundary = strToVec(par().boundary); if(boundary.size() != Nd) { HADRONS_ERROR(Size, "number of boundary conditions does not match number of dimensions"); } auto &stoch_photon = envGet(EmField, par().emField); unsigned int nt = env().getDim(Tp); envGetTmp(PropagatorField, proptmp); envGetTmp(PropagatorField, freetmp); envGetTmp(PropagatorField, sourcetmp); std::vector position; SitePropagator id; id = 1.; unsigned int tl=0; //point source at (0,0,0,tl) position.clear(); for(int tt=0;tt