mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +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:
@ -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;
|
||||
|
@ -61,11 +61,11 @@ class SeqGammaPar: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SeqGammaPar,
|
||||
std::string, q,
|
||||
unsigned int, tA,
|
||||
unsigned int, tB,
|
||||
unsigned int, gamma,
|
||||
std::string, mom);
|
||||
std::string, q,
|
||||
unsigned int, tA,
|
||||
unsigned int, tB,
|
||||
Gamma::Algebra, gamma,
|
||||
std::string, mom);
|
||||
};
|
||||
|
||||
template <typename FImpl>
|
||||
@ -141,11 +141,10 @@ void TSeqGamma<FImpl>::execute(void)
|
||||
PropagatorField &q = *env().template getObject<PropagatorField>(par().q);
|
||||
Lattice<iScalar<vInteger>> t(env().getGrid());
|
||||
LatticeComplex ph(env().getGrid()), coor(env().getGrid());
|
||||
SpinMatrix g;
|
||||
Gamma g(par().gamma);
|
||||
std::vector<Real> p;
|
||||
Complex i(0.0,1.0);
|
||||
|
||||
g = makeGammaProd(par().gamma);
|
||||
p = strToVec<Real>(par().mom);
|
||||
ph = zero;
|
||||
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
||||
@ -155,7 +154,7 @@ void TSeqGamma<FImpl>::execute(void)
|
||||
}
|
||||
ph = exp(2*M_PI*i*ph);
|
||||
LatticeCoordinate(t, Tp);
|
||||
src = where((t >= par().tA) and (t <= par().tB), g*ph*q, 0.*q);
|
||||
src = where((t >= par().tA) and (t <= par().tB), ph*(g*q), 0.*q);
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
Reference in New Issue
Block a user