diff --git a/extras/Hadrons/Modules/MScalarSUN/EMT.hpp b/extras/Hadrons/Modules/MScalarSUN/EMT.hpp index fbc9c62a..025b7936 100644 --- a/extras/Hadrons/Modules/MScalarSUN/EMT.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/EMT.hpp @@ -104,6 +104,7 @@ std::vector TEMT::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::setup(void) { envCreateLat(ComplexField, varName(getName(), mu, nu)); } - envTmpLat(ComplexField, "sumkin"); } // execution /////////////////////////////////////////////////////////////////// @@ -158,15 +158,8 @@ void TEMT::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) { diff --git a/extras/Hadrons/Modules/MScalarSUN/TrKinetic.hpp b/extras/Hadrons/Modules/MScalarSUN/TrKinetic.hpp index a8c7f521..59aa27b8 100644 --- a/extras/Hadrons/Modules/MScalarSUN/TrKinetic.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/TrKinetic.hpp @@ -110,6 +110,7 @@ std::vector TTrKinetic::getOutput(void) { out.push_back(varName(getName(), mu, nu)); } + out.push_back(varName(getName(), "sum")); return out; } @@ -123,6 +124,7 @@ void TTrKinetic::setup(void) { envCreateLat(ComplexField, varName(getName(), mu, nu)); } + envCreateLat(ComplexField, varName(getName(), "sum")); envTmp(std::vector, "der", 1, env().getNd(), env().getGrid()); } @@ -134,9 +136,11 @@ void TTrKinetic::execute(void) << " derivative" << std::endl; std::vector result; - auto &phi = envGet(Field, par().field); + auto &phi = envGet(Field, par().field); + auto &sumkin = envGet(ComplexField, varName(getName(), "sum")); envGetTmp(std::vector, 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::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::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) {