1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

cleaning up Kl2 contraction

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

View File

@ -109,10 +109,11 @@ typedef std::vector<typename ComplexField##suffix::vector_object::scalar_object>
#define FERM_TYPE_ALIASES(FImpl, suffix)\
BASIC_TYPE_ALIASES(FImpl, suffix);\
typedef FermionOperator<FImpl> FMat##suffix;\
typedef typename FImpl::FermionField FermionField##suffix;\
typedef typename FImpl::GaugeField GaugeField##suffix;\
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;
typedef FermionOperator<FImpl> FMat##suffix;\
typedef typename FImpl::FermionField FermionField##suffix;\
typedef typename FImpl::GaugeField GaugeField##suffix;\
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;\
typedef Lattice<iSpinMatrix<typename FImpl::Simd>> SpinMatrixField##suffix;
#define GAUGE_TYPE_ALIASES(GImpl, suffix)\
typedef typename GImpl::GaugeField GaugeField##suffix;

View File

@ -64,7 +64,7 @@ BEGIN_HADRONS_NAMESPACE
*/
/******************************************************************************
* TWeakMesonDecayKl2 *
* TWeakMesonDecayKl2 *
******************************************************************************/
BEGIN_MODULE_NAMESPACE(MContraction)
@ -75,7 +75,7 @@ public:
std::string, q1,
std::string, q2,
std::string, lepton,
std::string, output);
std::string, output);
};
template <typename FImpl>
@ -83,14 +83,13 @@ class TWeakMesonDecayKl2: public Module<WeakMesonDecayKl2Par>
{
public:
FERM_TYPE_ALIASES(FImpl,);
class Metadata: Serializable
typedef typename SpinMatrixField::vector_object::scalar_object SpinMatrix;
class Result: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Metadata,
int, spinidx1,
int, spinidx2);
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
std::vector<SpinMatrix>, corr);
};
typedef Correlator<Metadata> Result;
public:
// constructor
TWeakMesonDecayKl2(const std::string name);
@ -138,10 +137,10 @@ std::vector<std::string> TWeakMesonDecayKl2<FImpl>::getOutput(void)
template <typename FImpl>
void TWeakMesonDecayKl2<FImpl>::setup(void)
{
envTmpLat(LatticeComplex, "c");
envTmpLat(ComplexField, "c");
envTmpLat(PropagatorField, "prop_buf");
envCreateLat(PropagatorField, getName());
envTmpLat(LatticeComplex, "buf");
envTmpLat(SpinMatrixField, "buf");
}
// execution ///////////////////////////////////////////////////////////////////
@ -150,57 +149,33 @@ void TWeakMesonDecayKl2<FImpl>::execute(void)
{
LOG(Message) << "Computing QED Kl2 contractions '" << getName() << "' using"
<< " quarks '" << par().q1 << "' and '" << par().q2 << "' and"
<< "lepton '" << par().lepton << "'" << std::endl;
<< "lepton '" << par().lepton << "'" << std::endl;
Gamma g5(Gamma::Algebra::Gamma5);
int nt = env().getDim(Tp);
std::vector<SpinMatrix> res_summed;
Result r;
auto &res = envGet(PropagatorField, getName()); res = zero;
Gamma g5(Gamma::Algebra::Gamma5);
int nt = env().getDim(Tp);
auto &q1 = envGet(PropagatorField, par().q1);
auto &q2 = envGet(PropagatorField, par().q2);
auto &res = envGet(PropagatorField, getName()); res = zero;
auto &q1 = envGet(PropagatorField, par().q1);
auto &q2 = envGet(PropagatorField, par().q2);
auto &lepton = envGet(PropagatorField, par().lepton);
envGetTmp(LatticeComplex, buf);
std::vector<TComplex> res_summed;
envGetTmp(LatticeComplex, c);
envGetTmp(SpinMatrixField, buf);
envGetTmp(ComplexField, c);
envGetTmp(PropagatorField, prop_buf);
std::vector<Result> result;
Result r;
for (unsigned int mu = 0; mu < 4; ++mu)
{
c = zero;
//hadronic part: trace(q1*adj(q2)*g5*gL[mu])
c = trace(q1*adj(q2)*g5*GammaL(Gamma::gmu[mu]));
prop_buf = 1.;
//multiply lepton part
res += c * prop_buf * GammaL(Gamma::gmu[mu]) * lepton;
c = zero;
//hadronic part: trace(q1*adj(q2)*g5*gL[mu])
c = trace(q1*adj(q2)*g5*GammaL(Gamma::gmu[mu]));
prop_buf = 1.;
//multiply lepton part
res += c * prop_buf * GammaL(Gamma::gmu[mu]) * lepton;
}
//loop over spinor index of lepton part
unsigned int i = 0;
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);
buf = peekColour(res, 0, 0);
sliceSum(buf, r.corr, Tp);
saveResult(par().output, "weakdecay", r);
}
END_MODULE_NAMESPACE