2017-12-26 13:16:47 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: extras/Hadrons/Modules/MScalar/FreeProp.cc
|
|
|
|
|
|
|
|
Copyright (C) 2015-2018
|
|
|
|
|
|
|
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
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
|
|
|
}
|