#ifndef Hadrons_MDistil_BContraction_hpp_ #define Hadrons_MDistil_BContraction_hpp_ #include #include #include #include #include #include #include // These are members of Distillation #include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * BContraction * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MDistil) class BContractionPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(BContractionPar, std::string, one, std::string, two, std::string, three, std::string, output, std::vector, mom); }; template class TBContraction: public Module { public: FERM_TYPE_ALIASES(FImpl,); public: // constructor TBContraction(const std::string name); // destructor virtual ~TBContraction(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); private: bool hasPhase_{false}; std::string momphName_; std::vector gamma12_; std::vector gamma23_; std::vector> mom_; protected: GridCartesian * grid4d; GridCartesian * grid3d; }; MODULE_REGISTER_TMP(BContraction, TBContraction, MDistil); /****************************************************************************** * TBContraction implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TBContraction::TBContraction(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TBContraction::getInput(void) { std::vector in = {par().one, par().two, par().three}; return in; } template std::vector TBContraction::getOutput(void) { std::vector out = {}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TBContraction::setup(void) { } // execution /////////////////////////////////////////////////////////////////// template void TBContraction::execute(void) { auto &one = envGet(std::vector, par().one); auto &two = envGet(std::vector, par().two); auto &three = envGet(std::vector, par().three); int N_1 = one.size(); int N_2 = two.size(); int N_3 = three.size(); LOG(Message) << "Computing distillation baryon fields" << std::endl; LOG(Message) << "One: '" << par().one << "' Two: '" << par().two << "' Three: '" << par().three << "'" << std::endl; LOG(Message) << "Momenta:" << std::endl; for (auto &p: mom_) { LOG(Message) << " " << p << std::endl; } grid4d = env().getGrid(); grid3d = MakeLowerDimGrid(grid4d); int Nmom=1; int Nt=64; std::vector BField(Nmom*Nt*N_1*N_2*N_3); int Bindex; int Nc=3; //Num colours FermionField tmp1(grid3d); FermionField tmp2(grid3d); FermionField tmp3(grid3d); //std::complex * tmp33 = reinterpret_cast *>(&(tmp3[0]()(0)(0))); SpinColourVector * tmp11 = reinterpret_cast(&(tmp1[0]()(0)(0))); SpinColourVector * tmp22 = reinterpret_cast(&(tmp2[0]()(0)(0))); SpinColourVector * tmp33 = reinterpret_cast(&(tmp3[0]()(0)(0))); SpinVector tmp33s; SpinColourVector * tmp333; SpinColourVector * diquark; SpinColourVector * tmp222; std::vector> epsilon = {{0,1,2},{1,2,0},{2,0,1},{0,2,1},{2,1,0},{1,0,2}}; std::vector epsilon_sgn = {1,1,1,-1,-1,-1}; gamma12_ = { Gamma::Algebra::Identity, // I Gamma::Algebra::Gamma5, // gamma_5 Gamma::Algebra::Identity, // I }; gamma23_ = { // C = i gamma_2 gamma_4 Gamma::Algebra::SigmaXZ, // C gamma_5 = -i gamma_1 gamma_3 Gamma::Algebra::SigmaYT, // C = i gamma_2 gamma_4 Gamma::Algebra::GammaYGamma5, // i gamma_4 C gamma_5 = i gamma_2 gamma_5 }; std::vector factor23 = {(0.,-1.),(0.,1.),(0.,1.)}; // SpinColourVector a; // SpinVector b; // b = peekColour(a,0); //b= a()(0)(); //tmp33s = peekColour(a,0); for (int i1=0 ; i1 < N_1 ; i1++){ for (int i2=0 ; i2 < N_2 ; i2++){ for (int i3=0 ; i3 < N_3 ; i3++){ for (int imom=0 ; imom < Nmom ; imom++){ Bindex = i1 + N_1*(i2 + N_2*(i3 + N_3*imom)); for (int t=0 ; t < Nt ; t++){ ExtractSliceLocal(tmp1,one[i1],0,t,3); parallel_for (unsigned int sU = 0; sU < grid3d->oSites(); ++sU) { for (int ie=0 ; ie < 6 ; ie++){ //tmp33s = peekColour(tmp33[sU],epsilon[ie][2]); //tmp333 = Gamma(gamma23_[0])*tmp33s; //tmp333 = Gamma(gamma23_[0])*tmp33[sU]()()(epsilon[ie][2]); /*diquark = tmp22[sU]()()(epsilon[ie][1])*factor23[0]*tmp333; tmp222 = Gamma(gamma12_[0])*diquark; BField[Bindex]+=(double)epsilon_sgn[ie]*(tmp11[sU]()()(epsilon[ie][0])*tmp222); */ } } } } } } } } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE #endif // Hadrons_MDistil_BContraction_hpp_