2016-12-29 21:44:58 +00:00
|
|
|
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
2017-01-11 18:39:58 +00:00
|
|
|
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
2017-01-05 14:58:55 +00:00
|
|
|
|
2016-12-29 21:44:58 +00:00
|
|
|
using namespace Grid;
|
|
|
|
using namespace Hadrons;
|
|
|
|
using namespace MScalar;
|
|
|
|
|
|
|
|
/******************************************************************************
|
2017-01-05 14:58:55 +00:00
|
|
|
* TFreeProp implementation *
|
2016-12-29 21:44:58 +00:00
|
|
|
******************************************************************************/
|
|
|
|
// constructor /////////////////////////////////////////////////////////////////
|
|
|
|
TFreeProp::TFreeProp(const std::string name)
|
|
|
|
: Module<FreePropPar>(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// dependencies/products ///////////////////////////////////////////////////////
|
|
|
|
std::vector<std::string> TFreeProp::getInput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> in = {par().source};
|
|
|
|
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string> TFreeProp::getOutput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> out = {getName()};
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup ///////////////////////////////////////////////////////////////////////
|
|
|
|
void TFreeProp::setup(void)
|
|
|
|
{
|
2017-01-11 18:39:58 +00:00
|
|
|
freeMomPropName_ = FREEMOMPROP(par().mass);
|
2017-01-05 14:58:55 +00:00
|
|
|
|
2017-12-21 11:39:07 +00:00
|
|
|
freePropDone_ = env().hasCreatedObject(freeMomPropName_);
|
|
|
|
envCacheLat(ScalarField, freeMomPropName_);
|
|
|
|
envCreateLat(ScalarField, getName());
|
2016-12-29 21:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// execution ///////////////////////////////////////////////////////////////////
|
|
|
|
void TFreeProp::execute(void)
|
|
|
|
{
|
2017-12-21 11:39:07 +00:00
|
|
|
auto &freeMomProp = envGet(ScalarField, freeMomPropName_);
|
|
|
|
auto &prop = envGet(ScalarField, getName());
|
|
|
|
auto &source = envGet(ScalarField, par().source);
|
2017-01-05 14:58:55 +00:00
|
|
|
|
2017-12-21 11:39:07 +00:00
|
|
|
if (!freePropDone_)
|
2016-12-29 21:44:58 +00:00
|
|
|
{
|
|
|
|
LOG(Message) << "Caching momentum space free scalar propagator"
|
2017-01-05 14:58:55 +00:00
|
|
|
<< " (mass= " << par().mass << ")..." << std::endl;
|
2017-12-21 11:39:07 +00:00
|
|
|
SIMPL::MomentumSpacePropagator(freeMomProp, par().mass);
|
2016-12-29 21:44:58 +00:00
|
|
|
}
|
|
|
|
LOG(Message) << "Computing free scalar propagator..." << std::endl;
|
2017-12-21 11:39:07 +00:00
|
|
|
SIMPL::FreePropagator(source, prop, freeMomProp);
|
2017-01-05 14:58:55 +00:00
|
|
|
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
|
|
|
TextWriter writer(par().output + "." +
|
2017-12-21 11:39:07 +00:00
|
|
|
std::to_string(vm().getTrajectory()));
|
2017-01-05 14:58:55 +00:00
|
|
|
std::vector<TComplex> buf;
|
|
|
|
std::vector<Complex> result;
|
|
|
|
|
|
|
|
sliceSum(prop, buf, Tp);
|
|
|
|
result.resize(buf.size());
|
|
|
|
for (unsigned int t = 0; t < buf.size(); ++t)
|
|
|
|
{
|
|
|
|
result[t] = TensorRemove(buf[t]);
|
|
|
|
}
|
|
|
|
write(writer, "prop", result);
|
|
|
|
}
|
2016-12-29 21:44:58 +00:00
|
|
|
}
|