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

Merge remote-tracking branch 'paboyle/feature/hadrons' into feature/hadrons

# Conflicts:
#	extras/Hadrons/Modules/MContraction/Meson.hpp
#	tests/hadrons/Test_hadrons_meson_3pt.cc

Updated Meson.hpp to utilise zero-flop gamma matrices.
This commit is contained in:
Lanny91
2017-02-01 09:27:00 +00:00
43 changed files with 4551 additions and 1073 deletions

View File

@ -37,17 +37,17 @@ See the full license in the file "LICENSE" in the top level distribution directo
#include <Grid/Hadrons/ModuleFactory.hpp>
namespace Grid {
// Overload >> to extract gamma pair from "[g1 g2]" string.
// Overload >> to extract gamma pair from "<g1 g2>" string.
template <typename T1, typename T2>
inline std::istringstream &operator>>(std::istringstream &sstr,
std::pair<T1, T2> &buf)
{
T1 buf1;
T2 buf2;
unsigned int buf1;
unsigned int buf2;
char c;
sstr >> c >> buf1 >> buf2 >> c;
sstr.peek();
buf = std::make_pair(buf1, buf2);
buf = std::make_pair((T1)buf1, (T2)buf2);
return sstr;
}
}
@ -76,7 +76,7 @@ BEGIN_HADRONS_NAMESPACE
******************************************************************************/
BEGIN_MODULE_NAMESPACE(MContraction)
typedef std::pair<unsigned int, unsigned int> GammaPair;
typedef std::pair<Gamma::Algebra, Gamma::Algebra> GammaPair;
class MesonPar: Serializable
{
@ -99,8 +99,8 @@ public:
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
unsigned int, gamma_snk,
unsigned int, gamma_src,
Gamma::Algebra, gamma_snk,
Gamma::Algebra, gamma_src,
std::vector<Complex>, corr);
};
public:
@ -151,13 +151,14 @@ void TMeson<FImpl1, FImpl2>::parseGammaString(std::vector<GammaPair> &gammaList)
if (par().gammas.compare("all") == 0)
{
// Do all contractions.
unsigned int n_gam = Ns*Ns;
unsigned int n_gam = Ns * Ns;
gammaList.resize(n_gam*n_gam);
for (unsigned int i = 0; i < n_gam; ++i)
for (unsigned int i = 1; i < Gamma::nGamma; i += 2)
{
for (unsigned int j = 0; j < n_gam; ++j)
for (unsigned int j = 1; j < Gamma::nGamma; j += 2)
{
gammaList.push_back(std::make_pair(i, j));
gammaList.push_back(std::make_pair((Gamma::Algebra)i,
(Gamma::Algebra)j));
}
}
}
@ -181,7 +182,7 @@ void TMeson<FImpl1, FImpl2>::execute(void)
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
LatticeComplex c(env().getGrid());
SpinMatrix g[Ns*Ns], g5;
Gamma g5(Gamma::Algebra::Gamma5);
std::vector<GammaPair> gammaList;
std::vector<TComplex> buf;
std::vector<Result> result;
@ -198,17 +199,14 @@ void TMeson<FImpl1, FImpl2>::execute(void)
}
ph = exp(-2*M_PI*i*ph);
g5 = makeGammaProd(Ns*Ns - 1);
for (int i = 0; i < Ns*Ns; ++i)
{
g[i] = makeGammaProd(i);
}
parseGammaString(gammaList);
result.resize(gammaList.size());
for (unsigned int i = 0; i < result.size(); ++i)
{
c = trace(g[gammaList[i].first]*q1*g[gammaList[i].second]*g5*adj(q2)*g5*ph);
Gamma gSnk(gammaList[i].first);
Gamma gSrc(gammaList[i].second);
c = trace((g5*gSnk)*q1*(gSrc*g5)*adj(q2))*ph;
sliceSum(c, buf, Tp);
result[i].gamma_snk = gammaList[i].first;