1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-04 19:25:56 +01:00

Hadrons: scalar SU(N) kinetic term saves trace

This commit is contained in:
Antonin Portelli 2018-04-24 19:51:22 +01:00
parent 047ee4ad0b
commit c1d0359aaa
2 changed files with 24 additions and 11 deletions

View File

@ -104,6 +104,7 @@ std::vector<std::string> TEMT<SImpl>::getInput(void)
in.push_back(varName(par().improvement, mu, nu));
}
}
in.push_back(varName(par().kinetic, "sum"));
in.push_back(varName(par().phiPow, 2));
in.push_back(varName(par().phiPow, 4));
@ -133,7 +134,6 @@ void TEMT<SImpl>::setup(void)
{
envCreateLat(ComplexField, varName(getName(), mu, nu));
}
envTmpLat(ComplexField, "sumkin");
}
// execution ///////////////////////////////////////////////////////////////////
@ -158,15 +158,8 @@ void TEMT<SImpl>::execute(void)
const unsigned int N = SImpl::Group::Dimension;
auto &trphi2 = envGet(ComplexField, varName(par().phiPow, 2));
auto &trphi4 = envGet(ComplexField, varName(par().phiPow, 4));
auto &sumkin = envGet(ComplexField, varName(par().kinetic, "sum"));
envGetTmp(ComplexField, sumkin);
sumkin = zero;
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
{
auto &trkin = envGet(ComplexField, varName(par().kinetic, mu, mu));
sumkin += trkin;
}
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
{

View File

@ -110,6 +110,7 @@ std::vector<std::string> TTrKinetic<SImpl>::getOutput(void)
{
out.push_back(varName(getName(), mu, nu));
}
out.push_back(varName(getName(), "sum"));
return out;
}
@ -123,6 +124,7 @@ void TTrKinetic<SImpl>::setup(void)
{
envCreateLat(ComplexField, varName(getName(), mu, nu));
}
envCreateLat(ComplexField, varName(getName(), "sum"));
envTmp(std::vector<Field>, "der", 1, env().getNd(), env().getGrid());
}
@ -134,9 +136,11 @@ void TTrKinetic<SImpl>::execute(void)
<< " derivative" << std::endl;
std::vector<Result> result;
auto &phi = envGet(Field, par().field);
auto &phi = envGet(Field, par().field);
auto &sumkin = envGet(ComplexField, varName(getName(), "sum"));
envGetTmp(std::vector<Field>, der);
sumkin = zero;
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
{
dmu(der[mu], phi, mu, par().type);
@ -147,8 +151,17 @@ void TTrKinetic<SImpl>::execute(void)
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
out = -trace(der[mu]*der[nu]);
if (!par().output.empty())
if (mu == nu)
{
sumkin += out;
}
}
if (!par().output.empty())
{
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
{
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
Result r;
r.op = "tr(d_" + std::to_string(mu) + "phi*d_"
@ -156,6 +169,13 @@ void TTrKinetic<SImpl>::execute(void)
r.value = TensorRemove(sum(out));
result.push_back(r);
}
{
Result r;
r.op = "sum_mu tr(d_mu phi*d_mu phi)";
r.value = TensorRemove(sum(sumkin));
result.push_back(r);
}
}
if (result.size() > 0)
{