#ifndef Hadrons_MScalarSUN_TwoPointNPR_hpp_ #define Hadrons_MScalarSUN_TwoPointNPR_hpp_ #include #include #include #include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * TwoPointNPR * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MScalarSUN) class TwoPointNPRPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(TwoPointNPRPar, std::vector, op, std::string, field, std::string, output); }; class TwoPointNPRResult: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(TwoPointNPRResult, std::string, op, std::vector, data); }; template class TTwoPointNPR: public Module { public: typedef typename SImpl::Field Field; typedef typename SImpl::SiteField::scalar_object Site; typedef typename SImpl::ComplexField ComplexField; public: // constructor TTwoPointNPR(const std::string name); // destructor virtual ~TTwoPointNPR(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(TwoPointNPRSU2, TTwoPointNPR>, MScalarSUN); MODULE_REGISTER_TMP(TwoPointNPRSU3, TTwoPointNPR>, MScalarSUN); MODULE_REGISTER_TMP(TwoPointNPRSU4, TTwoPointNPR>, MScalarSUN); MODULE_REGISTER_TMP(TwoPointNPRSU5, TTwoPointNPR>, MScalarSUN); MODULE_REGISTER_TMP(TwoPointNPRSU6, TTwoPointNPR>, MScalarSUN); /****************************************************************************** * TTwoPointNPR implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TTwoPointNPR::TTwoPointNPR(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TTwoPointNPR::getInput(void) { std::vector in = par().op; in.push_back(par().field); return in; } template std::vector TTwoPointNPR::getOutput(void) { std::vector out; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TTwoPointNPR::setup(void) { const unsigned int nl = env().getDim(0); for (unsigned int mu = 1; mu < env().getNd(); ++mu) { if (nl != env().getDim(mu)) { HADRONS_ERROR(Size, "non-cubic grid"); } } envTmpLat(ComplexField, "ftBuf"); envTmpLat(Field, "ftMatBuf"); } // execution /////////////////////////////////////////////////////////////////// template void TTwoPointNPR::execute(void) { const unsigned int nd = env().getNd(); const unsigned int nl = env().getDim(0); FFT fft(env().getGrid()); std::vector result; TwoPointNPRResult twoPtp1, twoPtp2; auto &phi = envGet(Field, par().field); bool doTwoPt = true; envGetTmp(ComplexField, ftBuf); envGetTmp(Field, ftMatBuf); LOG(Message) << "FFT: field '" << par().field << "'" << std::endl; fft.FFT_all_dim(ftMatBuf, phi, FFT::forward); for (auto &opName: par().op) { auto &op = envGet(ComplexField, opName); std::vector p1, p2, p; Site phip1, phip2; TComplex opp; TwoPointNPRResult r; LOG(Message) << "FFT: operator '" << opName << "'" << std::endl; fft.FFT_all_dim(ftBuf, op, FFT::forward); LOG(Message) << "Generating vertex function" << std::endl; r.op = opName; r.data.resize(nl); if (doTwoPt) { twoPtp1.op = "phi_prop_p1"; twoPtp1.data.resize(nl); twoPtp2.op = "phi_prop_p2"; twoPtp2.data.resize(nl); } for (unsigned int n = 0; n < nl; ++n) { p1.assign(nd, 0); p2.assign(nd, 0); p.assign(nd, 0); // non-exceptional RI/SMOM kinematic // p1 = mu*(1,1,0): in mom // p2 = mu*(0,1,1): out mom // p = p1 - p2 = mu*(1,0,-1) // mu = 2*n*pi/L p1[0] = n; p1[1] = n; p2[1] = n; p2[2] = n; p[0] = n; p[2] = (nl - n) % nl; peekSite(phip1, ftMatBuf, p1); peekSite(phip2, ftMatBuf, p2); peekSite(opp, ftBuf, p); if (doTwoPt) { twoPtp1.data[n] = TensorRemove(trace(phip1*adj(phip1))); twoPtp2.data[n] = TensorRemove(trace(phip2*adj(phip2))); } r.data[n] = TensorRemove(trace(phip2*adj(phip1))*opp); } if (doTwoPt) { result.push_back(twoPtp1); result.push_back(twoPtp2); } result.push_back(r); doTwoPt = false; } saveResult(par().output, "twoptnpr", result); } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE #endif // Hadrons_MScalarSUN_TwoPointNPR_hpp_