2016-12-21 23:29:41 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
2018-09-01 21:30:30 +01:00
|
|
|
Source file: Hadrons/Modules/MGauge/StochEm.cc
|
2016-12-21 23:29:41 +00:00
|
|
|
|
2019-02-05 18:55:24 +00:00
|
|
|
Copyright (C) 2015-2019
|
2016-12-21 23:29:41 +00:00
|
|
|
|
2017-12-26 13:16:47 +00:00
|
|
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
2018-08-07 18:40:48 +01:00
|
|
|
Author: James Harrison <jch1g10@soton.ac.uk>
|
2018-04-23 17:36:20 +01:00
|
|
|
Author: Vera Guelpers <vmg1n14@soton.ac.uk>
|
2016-12-21 23:29:41 +00:00
|
|
|
|
|
|
|
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 */
|
2018-08-28 15:00:40 +01:00
|
|
|
#include <Hadrons/Modules/MGauge/StochEm.hpp>
|
2016-12-21 23:29:41 +00:00
|
|
|
|
|
|
|
using namespace Grid;
|
|
|
|
using namespace Hadrons;
|
|
|
|
using namespace MGauge;
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* TStochEm implementation *
|
|
|
|
******************************************************************************/
|
|
|
|
// constructor /////////////////////////////////////////////////////////////////
|
|
|
|
TStochEm::TStochEm(const std::string name)
|
|
|
|
: Module<StochEmPar>(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// dependencies/products ///////////////////////////////////////////////////////
|
|
|
|
std::vector<std::string> TStochEm::getInput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> in;
|
|
|
|
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string> TStochEm::getOutput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> out = {getName()};
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup ///////////////////////////////////////////////////////////////////////
|
|
|
|
void TStochEm::setup(void)
|
|
|
|
{
|
2018-01-26 21:25:20 +00:00
|
|
|
weightDone_ = env().hasCreatedObject("_" + getName() + "_weight");
|
|
|
|
envCacheLat(EmComp, "_" + getName() + "_weight");
|
2017-12-13 19:41:41 +00:00
|
|
|
envCreateLat(EmField, getName());
|
2016-12-21 23:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// execution ///////////////////////////////////////////////////////////////////
|
|
|
|
void TStochEm::execute(void)
|
|
|
|
{
|
2018-01-24 16:41:44 +00:00
|
|
|
LOG(Message) << "Generating stochastic EM potential..." << std::endl;
|
2017-12-13 19:41:41 +00:00
|
|
|
|
2018-02-02 11:56:51 +00:00
|
|
|
std::vector<Real> improvements = strToVec<Real>(par().improvement);
|
2018-12-13 21:52:38 +00:00
|
|
|
PhotonR photon(envGetGrid(EmField), par().gauge, par().zmScheme, improvements);
|
2017-12-13 19:41:41 +00:00
|
|
|
auto &a = envGet(EmField, getName());
|
|
|
|
auto &w = envGet(EmComp, "_" + getName() + "_weight");
|
2016-12-21 23:29:41 +00:00
|
|
|
|
2018-01-26 21:25:20 +00:00
|
|
|
if (!weightDone_)
|
2016-12-21 23:29:41 +00:00
|
|
|
{
|
2018-01-24 16:41:44 +00:00
|
|
|
LOG(Message) << "Caching stochastic EM potential weight (gauge: "
|
2016-12-21 23:29:41 +00:00
|
|
|
<< par().gauge << ", zero-mode scheme: "
|
|
|
|
<< par().zmScheme << ")..." << std::endl;
|
2017-12-13 19:41:41 +00:00
|
|
|
photon.StochasticWeight(w);
|
2016-12-21 23:29:41 +00:00
|
|
|
}
|
2018-08-10 18:27:00 +01:00
|
|
|
photon.StochasticField(a, rng4d(), w);
|
2016-12-21 23:29:41 +00:00
|
|
|
}
|