diff --git a/Grid/qcd/utils/BaryonUtils.h b/Grid/qcd/utils/BaryonUtils.h index 468c1f78..19fb03c5 100644 --- a/Grid/qcd/utils/BaryonUtils.h +++ b/Grid/qcd/utils/BaryonUtils.h @@ -15,12 +15,25 @@ public: typedef typename FImpl::FermionField FermionField; typedef typename FImpl::PropagatorField PropagatorField; + typedef typename FImpl::SitePropagator pobj; typedef typename FImpl::SiteSpinor vobj; typedef typename vobj::scalar_object sobj; typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_type vector_type; + static void ContractBaryons_debug(const PropagatorField &q1, + const PropagatorField &q2, + const PropagatorField &q3, + const Gamma GammaA, + const Gamma GammaB, + ComplexField &bc1, + ComplexField &bc2, + ComplexField &bc3, + ComplexField &bc4, + ComplexField &bc5, + ComplexField &bc6, + ComplexField &baryon_corr); static void ContractBaryons(const PropagatorField &q1, const PropagatorField &q2, const PropagatorField &q3, @@ -28,11 +41,159 @@ public: const Gamma GammaB, ComplexField &baryon_corr); - static LatticeSpinColourMatrix quarkContract13(const PropagatorField &q1, - const PropagatorField &q2); +// static PropagatorField quarkContract13(const PropagatorField &q1, +// const PropagatorField &q2); + static void quarkContract13(const PropagatorField &q1, + const PropagatorField &q2, + PropagatorField &q_out); }; +template +void BaryonUtils::ContractBaryons_debug(const PropagatorField &q1, + const PropagatorField &q2, + const PropagatorField &q3, + const Gamma GammaA, + const Gamma GammaB, + ComplexField &bc1, + ComplexField &bc2, + ComplexField &bc3, + ComplexField &bc4, + ComplexField &bc5, + ComplexField &bc6, + ComplexField &baryon_corr) +{ + GridBase *grid = q1._grid; + + // C = i gamma_2 gamma_4 => C gamma_5 = - i gamma_1 gamma_3 + //Gamma GammaA(Gamma::Algebra::Identity); //Still hardcoded 1 + //Gamma GammaB(Gamma::Algebra::SigmaXZ); //Still hardcoded Cg5 + //Gamma GammaB(Gamma::Algebra::GammaZGamma5); //Still hardcoded CgX = i gamma_3 gamma_5 + Gamma g4(Gamma::Algebra::GammaT); //needed for parity P_\pm = 0.5*(1 \pm \gamma_4) + + 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}; + char left[] = "sss"; + char right[] = "sss"; + std::vector wick_contraction = {0,0,0,0,0,0}; + + for (int ie=0; ie < 6 ; ie++) + if (left[0] == right[epsilon[ie][0]] && left[1] == right[epsilon[ie][1]] && left[2] == right[epsilon[ie][2]]) + wick_contraction[ie]=1; + + + int parity = 1; + + + parallel_for(int ss=0;ssoSites();ss++){ + + typedef typename ComplexField::vector_object vobj; + + auto D1 = q1._odata[ss]; + auto D2 = q2._odata[ss]; + auto D3 = q3._odata[ss]; + + auto gD1a = GammaA * GammaA * D1; + auto gD1b = GammaA * g4 * GammaA * D1; + auto pD1 = 0.5* (gD1a + (double)parity * gD1b); + auto gD3 = GammaB * D3; + + vobj result=zero; + vobj result1=zero; + vobj result2=zero; + vobj result3=zero; + vobj result4=zero; + vobj result5=zero; + vobj result6=zero; + + for (int ie_src=0; ie_src < 6 ; ie_src++){ + int a_src = epsilon[ie_src][0]; //a + int b_src = epsilon[ie_src][1]; //b + int c_src = epsilon[ie_src][2]; //c + for (int ie_snk=0; ie_snk < 6 ; ie_snk++){ + int a_snk = epsilon[ie_snk][0]; //a' + int b_snk = epsilon[ie_snk][1]; //b' + int c_snk = epsilon[ie_snk][2]; //c' + //This is the \delta_{123}^{123} part + if (wick_contraction[0]){ + auto D2g = D2 * GammaB; + for (int alpha_snk=0; alpha_snk void BaryonUtils::ContractBaryons(const PropagatorField &q1, @@ -78,7 +239,7 @@ void BaryonUtils::ContractBaryons(const PropagatorField &q1, auto gD3 = GammaB * D3; vobj result=zero; - + for (int ie_src=0; ie_src < 6 ; ie_src++){ int a_src = epsilon[ie_src][0]; //a int b_src = epsilon[ie_src][1]; //b @@ -153,24 +314,24 @@ void BaryonUtils::ContractBaryons(const PropagatorField &q1, baryon_corr._odata[ss] = result; } //end loop over lattice sites - - } //QDP / CHROMA - style diquark construction // (q_out)^{c'c}_{alpha,beta} = epsilon^{abc} epsilon^{a'b'c'} (q1)^{aa'}_{rho alpha}^* (q2)^{bb'}_{rho beta} template -LatticeSpinColourMatrix BaryonUtils::quarkContract13(const PropagatorField &q1, - const PropagatorField &q2) +//typename FImpl::PropagatorField BaryonUtils::quarkContract13(const PropagatorField &q1, +// const PropagatorField &q2) +void BaryonUtils::quarkContract13(const PropagatorField &q1, + const PropagatorField &q2, + PropagatorField &q_out) { GridBase *grid = q1._grid; 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}; - std::vector wick_contraction = {0,0,0,0,0,0}; - LatticeSpinColourMatrix q_out=zero; + //PropagatorField q_out;//=zero; parallel_for(int ss=0;ssoSites();ss++){ @@ -181,7 +342,7 @@ LatticeSpinColourMatrix BaryonUtils::quarkContract13(const PropagatorFiel //auto D_out = q_out._odata[ss]; //D_out=zero; - SpinColourMatrix D_out=zero; + pobj D_out=zero; for (int ie_src=0; ie_src < 6 ; ie_src++){ int a_src = epsilon[ie_src][0]; //a @@ -194,7 +355,7 @@ LatticeSpinColourMatrix BaryonUtils::quarkContract13(const PropagatorFiel for (int alpha=0; alpha::quarkContract13(const PropagatorFiel } //end loop over lattice sites - return q_out; + //return q_out; } diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index 889763ea..047f0aff 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include diff --git a/Hadrons/Modules/MContraction/Baryon2.hpp b/Hadrons/Modules/MContraction/Baryon2.hpp index df928472..7bf977cf 100644 --- a/Hadrons/Modules/MContraction/Baryon2.hpp +++ b/Hadrons/Modules/MContraction/Baryon2.hpp @@ -116,7 +116,7 @@ template void TBaryon2::setup(void) { envTmpLat(LatticeComplex, "c"); - envTmpLat(LatticeComplex, "diquark"); + envTmpLat(PropagatorField1, "diquark"); // Translate the full string naming the desired gamma structure into the one we need to use const std::string gamma{ par().gamma }; int iGamma = 0; @@ -172,7 +172,7 @@ void TBaryon2::execute(void) auto &q2 = envGet(PropagatorField2, par().q2); auto &q3 = envGet(PropagatorField3, par().q3); envGetTmp(LatticeComplex, c); - //envGetTmp(LatticeComplex, diquark); + envGetTmp(PropagatorField1, diquark); //ACTUALLY MIX OF 2 AND 3!!!! Result result; int nt = env().getDim(Tp); result.corr.resize(nt); @@ -182,12 +182,11 @@ void TBaryon2::execute(void) const Gamma GammaA{ Gamma::Algebra::Identity }; const Gamma GammaB{ al }; - LatticeSpinColourMatrix diquark; - - diquark = BaryonUtils::quarkContract13(q2*GammaB,GammaB*q3); + //diquark = BaryonUtils::quarkContract13(q2*GammaB,GammaB*q3); + BaryonUtils::quarkContract13(q2*GammaB,GammaB*q3,diquark); //result = trace(GammaA*GammaA * traceColour(q1*traceSpin(diquark))) + 2.0 * trace(GammaA*GammaA*traceColour(q1*diquark)); - result = trace(q1*diquark); + //c = trace(q1*traceSpin(diquark)); //NO TRACESPIN??? sliceSum(c,buf,Tp); diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index a18afd53..36e6429b 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -55,6 +55,7 @@ modules_cc =\ Modules/MContraction/WeakEye3pt.cc \ Modules/MContraction/Meson.cc \ Modules/MContraction/A2AAslashField.cc \ + Modules/MContraction/SelfContract.cc \ Modules/MContraction/Baryon2.cc \ Modules/MContraction/Baryon.cc \ Modules/MContraction/Nucleon.cc \ @@ -147,6 +148,7 @@ modules_hpp =\ Modules/MContraction/A2ALoop.hpp \ Modules/MContraction/Gamma3pt.hpp \ Modules/MContraction/DiscLoop.hpp \ + Modules/MContraction/SelfContract.hpp \ Modules/MContraction/A2AMesonField.hpp \ Modules/MAction/WilsonClover.hpp \ Modules/MAction/ScaledDWF.hpp \