1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-12-21 05:04:29 +00:00

Hadrons: scalar SU(N) kinetic term saves trace

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

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)
{