1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-12 20:27:06 +01:00

Merge branch 'develop' of github.com:fionnoh/Grid into feature/A2A_current_insertion

This commit is contained in:
Fionn O hOgain
2019-08-07 12:11:40 +01:00
17 changed files with 110 additions and 192 deletions

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

View File

@ -54,8 +54,9 @@ BEGIN_HADRONS_NAMESPACE
* - action: fermion action used for propagator (string)
* - emField: photon field A_mu (string)
* - mass: input mass for the lepton propagator
* - boundary: boundary conditions for the lepton propagator, e.g. "1 1 1 -1"
* - twist: twisted boundary for lepton propagator, e.g. "0.0 0.0 0.0 0.5"
* - deltat: source-sink separation
* - deltat: list of source-sink separations
*
*******************************************************************************/
@ -74,7 +75,7 @@ public:
double, mass,
std::string , boundary,
std::string, twist,
unsigned int, deltat);
std::vector<unsigned int>, deltat);
};
template <typename FImpl>
@ -124,7 +125,12 @@ std::vector<std::string> TEMLepton<FImpl>::getInput(void)
template <typename FImpl>
std::vector<std::string> TEMLepton<FImpl>::getOutput(void)
{
std::vector<std::string> out = {getName(), getName() + "_free"};
std::vector<std::string> out = {};
for(int i=0; i<par().deltat.size(); i++)
{
out.push_back(std::to_string(par().deltat[i]) + "_" + getName() + "_free");
out.push_back(std::to_string(par().deltat[i]) + "_" + getName());
}
return out;
}
@ -134,8 +140,11 @@ template <typename FImpl>
void TEMLepton<FImpl>::setup(void)
{
Ls_ = env().getObjectLs(par().action);
envCreateLat(PropagatorField, getName());
envCreateLat(PropagatorField, getName() + "_free");
for(int i=0; i<par().deltat.size(); i++)
{
envCreateLat(PropagatorField, std::to_string(par().deltat[i]) + "_" + getName() + "_free");
envCreateLat(PropagatorField, std::to_string(par().deltat[i]) + "_" + getName());
}
envTmpLat(FermionField, "source", Ls_);
envTmpLat(FermionField, "sol", Ls_);
envTmpLat(FermionField, "tmp");
@ -156,9 +165,6 @@ void TEMLepton<FImpl>::execute(void)
auto &mat = envGet(FMat, par().action);
RealD mass = par().mass;
Complex ci(0.0,1.0);
PropagatorField &Aslashlep = envGet(PropagatorField, getName());
PropagatorField &lep = envGet(PropagatorField, getName() + "_free");
envGetTmp(FermionField, source);
envGetTmp(FermionField, sol);
@ -227,6 +233,22 @@ void TEMLepton<FImpl>::execute(void)
}
}
for(unsigned int dt=0;dt<par().deltat.size();dt++){
PropagatorField &lep = envGet(PropagatorField, std::to_string(par().deltat[dt]) + "_" + getName() + "_free");
for(tl=0;tl<nt;tl++){
//shift free propagator to different source positions
//account for possible anti-periodic boundary in time
proptmp = Cshift(freetmp,Tp, -tl);
proptmp = where( tlat < tl, boundary[Tp]*proptmp, proptmp);
// free propagator for fixed source-sink separation
lep = where(tlat == (tl-par().deltat[dt]+nt)%nt, proptmp, lep);
}
//account for possible anti-periodic boundary in time
lep = where( tlat >= nt-par().deltat[dt], boundary[Tp]*lep, lep);
}
for(tl=0;tl<nt;tl++){
//shift free propagator to different source positions
@ -234,9 +256,6 @@ void TEMLepton<FImpl>::execute(void)
proptmp = Cshift(freetmp,Tp, -tl);
proptmp = where( tlat < tl, boundary[Tp]*proptmp, proptmp);
// free propagator for fixed source-sink separation
lep = where(tlat == (tl-par().deltat+nt)%nt, proptmp, lep);
// i*A_mu*gamma_mu
sourcetmp = zero;
for(unsigned int mu=0;mu<=3;mu++)
@ -276,13 +295,17 @@ void TEMLepton<FImpl>::execute(void)
}
}
// keep the result for the desired delta t
Aslashlep = where(tlat == (tl-par().deltat+nt)%nt, proptmp, Aslashlep);
for(unsigned int dt=0;dt<par().deltat.size();dt++){
PropagatorField &Aslashlep = envGet(PropagatorField, std::to_string(par().deltat[dt]) + "_" + getName());
Aslashlep = where(tlat == (tl-par().deltat[dt]+nt)%nt, proptmp, Aslashlep);
}
}
//account for possible anti-periodic boundary in time
Aslashlep = where( tlat >= nt-par().deltat, boundary[Tp]*Aslashlep, Aslashlep);
lep = where( tlat >= nt-par().deltat, boundary[Tp]*lep, lep);
for(unsigned int dt=0;dt<par().deltat.size();dt++){
PropagatorField &Aslashlep = envGet(PropagatorField, std::to_string(par().deltat[dt]) + "_" + getName());
Aslashlep = where( tlat >= nt-par().deltat[dt], boundary[Tp]*Aslashlep, Aslashlep);
}
}
END_MODULE_NAMESPACE