1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

cleaning up Kl2 contraction

This commit is contained in:
Antonin Portelli 2019-05-24 13:08:35 +01:00
parent 0a71f8bb10
commit c3d0c176ab
2 changed files with 32 additions and 56 deletions

View File

@ -112,7 +112,8 @@ BASIC_TYPE_ALIASES(FImpl, suffix);\
typedef FermionOperator<FImpl> FMat##suffix;\ typedef FermionOperator<FImpl> FMat##suffix;\
typedef typename FImpl::FermionField FermionField##suffix;\ typedef typename FImpl::FermionField FermionField##suffix;\
typedef typename FImpl::GaugeField GaugeField##suffix;\ typedef typename FImpl::GaugeField GaugeField##suffix;\
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix; typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;\
typedef Lattice<iSpinMatrix<typename FImpl::Simd>> SpinMatrixField##suffix;
#define GAUGE_TYPE_ALIASES(GImpl, suffix)\ #define GAUGE_TYPE_ALIASES(GImpl, suffix)\
typedef typename GImpl::GaugeField GaugeField##suffix; typedef typename GImpl::GaugeField GaugeField##suffix;

View File

@ -83,14 +83,13 @@ class TWeakMesonDecayKl2: public Module<WeakMesonDecayKl2Par>
{ {
public: public:
FERM_TYPE_ALIASES(FImpl,); FERM_TYPE_ALIASES(FImpl,);
class Metadata: Serializable typedef typename SpinMatrixField::vector_object::scalar_object SpinMatrix;
class Result: Serializable
{ {
public: public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Metadata, GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
int, spinidx1, std::vector<SpinMatrix>, corr);
int, spinidx2);
}; };
typedef Correlator<Metadata> Result;
public: public:
// constructor // constructor
TWeakMesonDecayKl2(const std::string name); TWeakMesonDecayKl2(const std::string name);
@ -138,10 +137,10 @@ std::vector<std::string> TWeakMesonDecayKl2<FImpl>::getOutput(void)
template <typename FImpl> template <typename FImpl>
void TWeakMesonDecayKl2<FImpl>::setup(void) void TWeakMesonDecayKl2<FImpl>::setup(void)
{ {
envTmpLat(LatticeComplex, "c"); envTmpLat(ComplexField, "c");
envTmpLat(PropagatorField, "prop_buf"); envTmpLat(PropagatorField, "prop_buf");
envCreateLat(PropagatorField, getName()); envCreateLat(PropagatorField, getName());
envTmpLat(LatticeComplex, "buf"); envTmpLat(SpinMatrixField, "buf");
} }
// execution /////////////////////////////////////////////////////////////////// // execution ///////////////////////////////////////////////////////////////////
@ -152,22 +151,19 @@ void TWeakMesonDecayKl2<FImpl>::execute(void)
<< " quarks '" << par().q1 << "' and '" << par().q2 << "' and" << " quarks '" << par().q1 << "' and '" << par().q2 << "' and"
<< "lepton '" << par().lepton << "'" << std::endl; << "lepton '" << par().lepton << "'" << std::endl;
auto &res = envGet(PropagatorField, getName()); res = zero;
Gamma g5(Gamma::Algebra::Gamma5); Gamma g5(Gamma::Algebra::Gamma5);
int nt = env().getDim(Tp); int nt = env().getDim(Tp);
std::vector<SpinMatrix> res_summed;
Result r;
auto &res = envGet(PropagatorField, getName()); res = zero;
auto &q1 = envGet(PropagatorField, par().q1); auto &q1 = envGet(PropagatorField, par().q1);
auto &q2 = envGet(PropagatorField, par().q2); auto &q2 = envGet(PropagatorField, par().q2);
auto &lepton = envGet(PropagatorField, par().lepton); auto &lepton = envGet(PropagatorField, par().lepton);
envGetTmp(LatticeComplex, buf); envGetTmp(SpinMatrixField, buf);
std::vector<TComplex> res_summed; envGetTmp(ComplexField, c);
envGetTmp(LatticeComplex, c);
envGetTmp(PropagatorField, prop_buf); envGetTmp(PropagatorField, prop_buf);
std::vector<Result> result;
Result r;
for (unsigned int mu = 0; mu < 4; ++mu) for (unsigned int mu = 0; mu < 4; ++mu)
{ {
c = zero; c = zero;
@ -177,30 +173,9 @@ void TWeakMesonDecayKl2<FImpl>::execute(void)
//multiply lepton part //multiply lepton part
res += c * prop_buf * GammaL(Gamma::gmu[mu]) * lepton; res += c * prop_buf * GammaL(Gamma::gmu[mu]) * lepton;
} }
buf = peekColour(res, 0, 0);
//loop over spinor index of lepton part sliceSum(buf, r.corr, Tp);
unsigned int i = 0; saveResult(par().output, "weakdecay", r);
for (unsigned int s1 = 0; s1 < Ns ; ++s1)
for (unsigned int s2 = 0; s2 < Ns ; ++s2)
{
buf = peekColour(peekSpin(res,s1,s2),0,0);
sliceSum(buf, res_summed, Tp);
r.corr.clear();
for (unsigned int t = 0; t < nt; ++t)
{
r.corr.push_back(TensorRemove(res_summed[t]));
}
r.info.spinidx1 = s1;
r.info.spinidx2 = s2;
result.push_back(r);
i+=1;
}
saveResult(par().output, "weakdecay", result);
} }
END_MODULE_NAMESPACE END_MODULE_NAMESPACE