mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-14 13:57:07 +01:00
Merge remote-tracking branch 'upstream/feature/hadrons' into feature/hadrons
This commit is contained in:
@ -114,12 +114,12 @@ void Application::parseParameterFile(const std::string parameterFileName)
|
||||
setPar(par);
|
||||
if (!push(reader, "modules"))
|
||||
{
|
||||
HADRON_ERROR(Parsing, "Cannot open node 'modules' in parameter file '"
|
||||
HADRONS_ERROR(Parsing, "Cannot open node 'modules' in parameter file '"
|
||||
+ parameterFileName + "'");
|
||||
}
|
||||
if (!push(reader, "module"))
|
||||
{
|
||||
HADRON_ERROR(Parsing, "Cannot open node 'modules/module' in parameter file '"
|
||||
HADRONS_ERROR(Parsing, "Cannot open node 'modules/module' in parameter file '"
|
||||
+ parameterFileName + "'");
|
||||
}
|
||||
do
|
||||
@ -177,7 +177,7 @@ void Application::saveSchedule(const std::string filename)
|
||||
|
||||
if (!scheduled_)
|
||||
{
|
||||
HADRON_ERROR(Definition, "Computation not scheduled");
|
||||
HADRONS_ERROR(Definition, "Computation not scheduled");
|
||||
}
|
||||
|
||||
for (auto address: program_)
|
||||
@ -208,7 +208,7 @@ void Application::printSchedule(void)
|
||||
{
|
||||
if (!scheduled_)
|
||||
{
|
||||
HADRON_ERROR(Definition, "Computation not scheduled");
|
||||
HADRONS_ERROR(Definition, "Computation not scheduled");
|
||||
}
|
||||
auto peak = vm().memoryNeeded(program_);
|
||||
LOG(Message) << "Schedule (memory needed: " << sizeString(peak) << "):"
|
||||
|
@ -123,7 +123,7 @@ protected:
|
||||
binReader.readScidacFieldRecord(evec[k], vecRecord);
|
||||
if (vecRecord.index != k)
|
||||
{
|
||||
HADRON_ERROR(Io, "Eigenvector " + std::to_string(k) + " has a"
|
||||
HADRONS_ERROR(Io, "Eigenvector " + std::to_string(k) + " has a"
|
||||
+ " wrong index (expected " + std::to_string(vecRecord.index)
|
||||
+ ") in file '" + filename + "'");
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ using namespace QCD;
|
||||
using namespace Hadrons;
|
||||
|
||||
#define ERROR_NO_ADDRESS(address)\
|
||||
HADRON_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
|
||||
/******************************************************************************
|
||||
* Environment implementation *
|
||||
@ -85,7 +85,7 @@ void Environment::createCoarseGrid(const std::vector<int> &blockSize,
|
||||
coarseDim[d] = fineDim[d]/blockSize[d];
|
||||
if (coarseDim[d]*blockSize[d] != fineDim[d])
|
||||
{
|
||||
HADRON_ERROR(Size, "Fine dimension " + std::to_string(d)
|
||||
HADRONS_ERROR(Size, "Fine dimension " + std::to_string(d)
|
||||
+ " (" + std::to_string(fineDim[d])
|
||||
+ ") not divisible by coarse dimension ("
|
||||
+ std::to_string(coarseDim[d]) + ")");
|
||||
@ -96,7 +96,7 @@ void Environment::createCoarseGrid(const std::vector<int> &blockSize,
|
||||
cLs = Ls/blockSize[nd];
|
||||
if (cLs*blockSize[nd] != Ls)
|
||||
{
|
||||
HADRON_ERROR(Size, "Fine Ls (" + std::to_string(Ls)
|
||||
HADRONS_ERROR(Size, "Fine Ls (" + std::to_string(Ls)
|
||||
+ ") not divisible by coarse Ls ("
|
||||
+ std::to_string(cLs) + ")");
|
||||
}
|
||||
@ -128,7 +128,7 @@ GridCartesian * Environment::getGrid(const unsigned int Ls) const
|
||||
}
|
||||
catch(std::out_of_range &)
|
||||
{
|
||||
HADRON_ERROR(Definition, "no grid with Ls= " + std::to_string(Ls));
|
||||
HADRONS_ERROR(Definition, "no grid with Ls= " + std::to_string(Ls));
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ GridRedBlackCartesian * Environment::getRbGrid(const unsigned int Ls) const
|
||||
}
|
||||
catch(std::out_of_range &)
|
||||
{
|
||||
HADRON_ERROR(Definition, "no red-black grid with Ls= " + std::to_string(Ls));
|
||||
HADRONS_ERROR(Definition, "no red-black grid with Ls= " + std::to_string(Ls));
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ GridCartesian * Environment::getCoarseGrid(
|
||||
}
|
||||
catch(std::out_of_range &)
|
||||
{
|
||||
HADRON_ERROR(Definition, "no coarse grid with Ls= " + std::to_string(Ls));
|
||||
HADRONS_ERROR(Definition, "no coarse grid with Ls= " + std::to_string(Ls));
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ void Environment::addObject(const std::string name, const int moduleAddress)
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "object '" + name + "' already exists");
|
||||
HADRONS_ERROR(Definition, "object '" + name + "' already exists");
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ unsigned int Environment::getObjectAddress(const std::string name) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no object with name '" + name + "'");
|
||||
HADRONS_ERROR(Definition, "no object with name '" + name + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ void Environment::createDerivedObject(const std::string name,
|
||||
(object_[address].type != &typeid(B)) or
|
||||
(object_[address].derivedType != &typeid(T)))
|
||||
{
|
||||
HADRON_ERROR(Definition, "object '" + name + "' already allocated");
|
||||
HADRONS_ERROR(Definition, "object '" + name + "' already allocated");
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ T * Environment::getDerivedObject(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
HADRONS_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
" cannot be casted to '" + typeName(&typeid(T)) +
|
||||
"' (has type '" + typeName(&typeid(h->get())) + "')");
|
||||
}
|
||||
@ -287,20 +287,20 @@ T * Environment::getDerivedObject(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
HADRONS_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
" does not have type '" + typeName(&typeid(B)) +
|
||||
"' (has type '" + getObjectType(address) + "')");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
HADRONS_ERROR(Definition, "object with address " + std::to_string(address) +
|
||||
" is empty");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ bool Environment::isObjectOfType(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no object with address " + std::to_string(address));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@ See the full license in the file "LICENSE" in the top level distribution directo
|
||||
#include <Grid/Hadrons/Global.hpp>
|
||||
#endif
|
||||
|
||||
#define SRC_LOC std::string(__FUNCTION__) + " at " + std::string(__FILE__) + ":"\
|
||||
+ std::to_string(__LINE__)
|
||||
#define HADRON_ERROR(exc, msg)\
|
||||
throw(Exceptions::exc(msg, SRC_LOC));
|
||||
#define HADRONS_SRC_LOC std::string(__FUNCTION__) + " at " \
|
||||
+ std::string(__FILE__) + ":" + std::to_string(__LINE__)
|
||||
#define HADRONS_ERROR(exc, msg)\
|
||||
throw(Exceptions::exc(msg, HADRONS_SRC_LOC));
|
||||
|
||||
#define DECL_EXC(name, base) \
|
||||
class name: public base\
|
||||
|
@ -94,7 +94,7 @@ std::unique_ptr<T> Factory<T>::create(const std::string type,
|
||||
}
|
||||
catch (std::out_of_range &)
|
||||
{
|
||||
HADRON_ERROR(Argument, "object of type '" + type + "' unknown");
|
||||
HADRONS_ERROR(Argument, "object of type '" + type + "' unknown");
|
||||
}
|
||||
|
||||
return func(name);
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
};
|
||||
|
||||
#define LOG(channel) std::cout << HadronsLog##channel
|
||||
#define DEBUG_VAR(var) LOG(Debug) << #var << "= " << (var) << std::endl;
|
||||
#define HADRONS_DEBUG_VAR(var) LOG(Debug) << #var << "= " << (var) << std::endl;
|
||||
|
||||
extern HadronsLogger HadronsLogError;
|
||||
extern HadronsLogger HadronsLogWarning;
|
||||
|
@ -184,7 +184,7 @@ void Graph<T>::removeVertex(const T &value)
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Range, "vertex does not exists");
|
||||
HADRONS_ERROR(Range, "vertex does not exists");
|
||||
}
|
||||
|
||||
// remove all edges containing the vertex
|
||||
@ -213,7 +213,7 @@ void Graph<T>::removeEdge(const Edge &e)
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Range, "edge does not exists");
|
||||
HADRONS_ERROR(Range, "edge does not exists");
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ void Graph<T>::mark(const T &value, const bool doMark)
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Range, "vertex does not exists");
|
||||
HADRONS_ERROR(Range, "vertex does not exists");
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ bool Graph<T>::isMarked(const T &value) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Range, "vertex does not exists");
|
||||
HADRONS_ERROR(Range, "vertex does not exists");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -543,7 +543,7 @@ std::vector<T> Graph<T>::topoSort(void)
|
||||
{
|
||||
if (tmpMarked.at(v))
|
||||
{
|
||||
HADRON_ERROR(Range, "cannot topologically sort a cyclic graph");
|
||||
HADRONS_ERROR(Range, "cannot topologically sort a cyclic graph");
|
||||
}
|
||||
if (!isMarked(v))
|
||||
{
|
||||
@ -602,7 +602,7 @@ std::vector<T> Graph<T>::topoSort(Gen &gen)
|
||||
{
|
||||
if (tmpMarked.at(v))
|
||||
{
|
||||
HADRON_ERROR(Range, "cannot topologically sort a cyclic graph");
|
||||
HADRONS_ERROR(Range, "cannot topologically sort a cyclic graph");
|
||||
}
|
||||
if (!isMarked(v))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ std::string ModuleBase::getName(void) const
|
||||
// get factory registration name if available
|
||||
std::string ModuleBase::getRegisteredName(void)
|
||||
{
|
||||
HADRON_ERROR(Definition, "module '" + getName() + "' has no registered type"
|
||||
HADRONS_ERROR(Definition, "module '" + getName() + "' has no registered type"
|
||||
+ " in the factory");
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ if (env().getGrid()->IsBoss())\
|
||||
\
|
||||
if (mkdir(_dirname))\
|
||||
{\
|
||||
HADRON_ERROR(Io, "cannot create directory '" + _dirname + "'");\
|
||||
HADRONS_ERROR(Io, "cannot create directory '" + _dirname + "'");\
|
||||
}\
|
||||
{\
|
||||
ResultWriter _writer(RESULT_FILE_NAME(ioStem));\
|
||||
|
@ -119,7 +119,7 @@ void TWardIdentity<FImpl>::setup(void)
|
||||
Ls_ = env().getObjectLs(par().q);
|
||||
if (Ls_ != env().getObjectLs(par().action))
|
||||
{
|
||||
HADRON_ERROR(Size, "Ls mismatch between quark action and propagator");
|
||||
HADRONS_ERROR(Size, "Ls mismatch between quark action and propagator");
|
||||
}
|
||||
envTmpLat(PropagatorField, "tmp");
|
||||
envTmpLat(PropagatorField, "vector_WI");
|
||||
|
@ -177,7 +177,7 @@ void TGaugeProp<FImpl>::execute(void)
|
||||
{
|
||||
if (Ls_ != env().getObjectLs(par().source))
|
||||
{
|
||||
HADRON_ERROR(Size, "Ls mismatch between quark action and source");
|
||||
HADRONS_ERROR(Size, "Ls mismatch between quark action and source");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class DivResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(DivResult,
|
||||
DiffType, type,
|
||||
Complex, value);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TDiv: public Module<DivPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
DiffType, type,
|
||||
Complex, value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TDiv(const std::string name);
|
||||
@ -112,7 +113,7 @@ void TDiv<SImpl>::setup(void)
|
||||
{
|
||||
if (par().op.size() != env().getNd())
|
||||
{
|
||||
HADRON_ERROR(Size, "the number of components differs from number of dimensions");
|
||||
HADRONS_ERROR(Size, "the number of components differs from number of dimensions");
|
||||
}
|
||||
envCreateLat(ComplexField, getName());
|
||||
}
|
||||
@ -139,7 +140,7 @@ void TDiv<SImpl>::execute(void)
|
||||
}
|
||||
if (!par().output.empty())
|
||||
{
|
||||
Result r;
|
||||
DivResult r;
|
||||
|
||||
r.type = par().type;
|
||||
r.value = TensorRemove(sum(div));
|
||||
|
@ -54,6 +54,17 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class EMTResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(EMTResult,
|
||||
std::vector<std::vector<Complex>>, value,
|
||||
double, m2,
|
||||
double, lambda,
|
||||
double, g,
|
||||
double, xi);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TEMT: public Module<EMTPar>
|
||||
{
|
||||
@ -155,13 +166,22 @@ void TEMT<SImpl>::execute(void)
|
||||
LOG(Message) << " xi= " << par().xi << std::endl;
|
||||
}
|
||||
|
||||
const unsigned int N = SImpl::Group::Dimension;
|
||||
const unsigned int N = SImpl::Group::Dimension, nd = env().getNd();
|
||||
auto &trphi2 = envGet(ComplexField, varName(par().phiPow, 2));
|
||||
auto &trphi4 = envGet(ComplexField, varName(par().phiPow, 4));
|
||||
auto &sumkin = envGet(ComplexField, varName(par().kinetic, "sum"));
|
||||
EMTResult result;
|
||||
|
||||
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
result.m2 = par().m2;
|
||||
result.g = par().g;
|
||||
result.lambda = par().lambda;
|
||||
result.xi = par().xi;
|
||||
result.value.resize(nd, std::vector<Complex>(nd));
|
||||
}
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
for (unsigned int nu = mu; nu < nd; ++nu)
|
||||
{
|
||||
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
|
||||
auto &trkin = envGet(ComplexField, varName(par().kinetic, mu, nu));
|
||||
@ -178,6 +198,15 @@ void TEMT<SImpl>::execute(void)
|
||||
out -= sumkin + par().m2*trphi2 + par().lambda*trphi4;
|
||||
}
|
||||
out *= N/par().g;
|
||||
if (!par().output.empty())
|
||||
{
|
||||
result.value[mu][nu] = TensorRemove(sum(out));
|
||||
result.value[mu][nu] = result.value[nu][mu];
|
||||
}
|
||||
}
|
||||
if (!par().output.empty())
|
||||
{
|
||||
saveResult(par().output, "emt", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class GradResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(GradResult,
|
||||
DiffType, type,
|
||||
std::vector<Complex>, value);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TGrad: public Module<GradPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
DiffType, type,
|
||||
Complex, value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TGrad(const std::string name);
|
||||
@ -130,14 +131,18 @@ void TGrad<SImpl>::setup(void)
|
||||
template <typename SImpl>
|
||||
void TGrad<SImpl>::execute(void)
|
||||
{
|
||||
const auto nd = env().getNd();
|
||||
|
||||
LOG(Message) << "Computing the " << par().type << " gradient of '"
|
||||
<< par().op << "'" << std::endl;
|
||||
|
||||
std::vector<Result> result;
|
||||
auto &op = envGet(ComplexField, par().op);
|
||||
const unsigned int nd = env().getNd();
|
||||
GradResult result;
|
||||
auto &op = envGet(ComplexField, par().op);
|
||||
|
||||
if (!par().output.empty())
|
||||
{
|
||||
result.type = par().type;
|
||||
result.value.resize(nd);
|
||||
}
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
{
|
||||
auto &der = envGet(ComplexField, varName(getName(), mu));
|
||||
@ -145,14 +150,10 @@ void TGrad<SImpl>::execute(void)
|
||||
dmu(der, op, mu, par().type);
|
||||
if (!par().output.empty())
|
||||
{
|
||||
Result r;
|
||||
|
||||
r.type = par().type;
|
||||
r.value = TensorRemove(sum(der));
|
||||
result.push_back(r);
|
||||
result.value[mu] = TensorRemove(sum(der));
|
||||
}
|
||||
}
|
||||
if (result.size() > 0)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
saveResult(par().output, "grad", result);
|
||||
}
|
||||
|
@ -51,20 +51,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class ShiftProbeResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(ShiftProbeResult,
|
||||
std::string, shifts,
|
||||
Complex, value);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TShiftProbe: public Module<ShiftProbePar>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, op,
|
||||
Complex , value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TShiftProbe(const std::string name);
|
||||
@ -134,14 +134,14 @@ void TShiftProbe<SImpl>::execute(void)
|
||||
shift = strToVec<ShiftPair>(par().shifts);
|
||||
if (shift.size() % 2 != 0)
|
||||
{
|
||||
HADRON_ERROR(Size, "the number of shifts is odd");
|
||||
HADRONS_ERROR(Size, "the number of shifts is odd");
|
||||
}
|
||||
sign = (shift.size() % 4 == 0) ? 1 : -1;
|
||||
for (auto &s: shift)
|
||||
{
|
||||
if (s.first >= env().getNd())
|
||||
{
|
||||
HADRON_ERROR(Size, "dimension to large for shift <"
|
||||
HADRONS_ERROR(Size, "dimension to large for shift <"
|
||||
+ std::to_string(s.first) + " "
|
||||
+ std::to_string(s.second) + ">" );
|
||||
}
|
||||
@ -160,6 +160,14 @@ void TShiftProbe<SImpl>::execute(void)
|
||||
}
|
||||
}
|
||||
probe = real(sign*trace(acc));
|
||||
if (!par().output.empty())
|
||||
{
|
||||
ShiftProbeResult r;
|
||||
|
||||
r.shifts = par().shifts;
|
||||
r.value = TensorRemove(sum(probe));
|
||||
saveResult(par().output, "probe", r);
|
||||
}
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class TrKineticResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(TrKineticResult,
|
||||
std::vector<std::vector<Complex>>, value,
|
||||
DiffType, type);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TTrKinetic: public Module<TrKineticPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, op,
|
||||
Complex , value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TTrKinetic(const std::string name);
|
||||
@ -135,18 +136,24 @@ void TTrKinetic<SImpl>::execute(void)
|
||||
LOG(Message) << "Computing tr(d_mu phi*d_nu phi) using " << par().type
|
||||
<< " derivative" << std::endl;
|
||||
|
||||
std::vector<Result> result;
|
||||
auto &phi = envGet(Field, par().field);
|
||||
auto &sumkin = envGet(ComplexField, varName(getName(), "sum"));
|
||||
const unsigned int nd = env().getNd();
|
||||
TrKineticResult result;
|
||||
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)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
result.type = par().type;
|
||||
result.value.resize(nd, std::vector<Complex>(nd));
|
||||
}
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
{
|
||||
dmu(der[mu], phi, mu, par().type);
|
||||
}
|
||||
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
for (unsigned int nu = mu; nu < nd; ++nu)
|
||||
{
|
||||
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
|
||||
|
||||
@ -155,32 +162,13 @@ void TTrKinetic<SImpl>::execute(void)
|
||||
{
|
||||
sumkin += out;
|
||||
}
|
||||
}
|
||||
if (!par().output.empty())
|
||||
{
|
||||
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
|
||||
Result r;
|
||||
|
||||
r.op = "tr(d_" + std::to_string(mu) + "phi*d_"
|
||||
+ std::to_string(nu) + "phi)";
|
||||
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);
|
||||
result.value[mu][nu] = TensorRemove(sum(out));
|
||||
result.value[mu][nu] = result.value[nu][mu];
|
||||
}
|
||||
}
|
||||
if (result.size() > 0)
|
||||
{
|
||||
saveResult(par().output, "trkinetic", result);
|
||||
}
|
||||
saveResult(par().output, "trkinetic", result);
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class TrMagResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(TrMagResult,
|
||||
std::string, op,
|
||||
Real, value);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TTrMag: public Module<TrMagPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, op,
|
||||
Real, value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TTrMag(const std::string name);
|
||||
@ -120,8 +121,8 @@ void TTrMag<SImpl>::execute(void)
|
||||
LOG(Message) << "Computing tr(mag^n) for n even up to " << par().maxPow
|
||||
<< std::endl;
|
||||
|
||||
std::vector<Result> result;
|
||||
auto &phi = envGet(Field, par().field);
|
||||
std::vector<TrMagResult> result;
|
||||
auto &phi = envGet(Field, par().field);
|
||||
|
||||
auto m2 = sum(phi), mn = m2;
|
||||
|
||||
@ -129,7 +130,7 @@ void TTrMag<SImpl>::execute(void)
|
||||
mn = 1.;
|
||||
for (unsigned int n = 2; n <= par().maxPow; n += 2)
|
||||
{
|
||||
Result r;
|
||||
TrMagResult r;
|
||||
|
||||
mn = mn*m2;
|
||||
r.op = "tr(mag^" + std::to_string(n) + ")";
|
||||
|
@ -49,19 +49,21 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class TrPhiResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(TrPhiResult,
|
||||
std::string, op,
|
||||
Real, value);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TTrPhi: public Module<TrPhiPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, op,
|
||||
Real, value);
|
||||
};
|
||||
|
||||
public:
|
||||
// constructor
|
||||
TTrPhi(const std::string name);
|
||||
@ -119,7 +121,7 @@ void TTrPhi<SImpl>::setup(void)
|
||||
{
|
||||
if (par().maxPow < 2)
|
||||
{
|
||||
HADRON_ERROR(Size, "'maxPow' should be at least equal to 2");
|
||||
HADRONS_ERROR(Size, "'maxPow' should be at least equal to 2");
|
||||
}
|
||||
envTmpLat(Field, "phi2");
|
||||
envTmpLat(Field, "buf");
|
||||
@ -136,8 +138,8 @@ void TTrPhi<SImpl>::execute(void)
|
||||
LOG(Message) << "Computing tr(phi^n) for n even up to " << par().maxPow
|
||||
<< std::endl;
|
||||
|
||||
std::vector<Result> result;
|
||||
auto &phi = envGet(Field, par().field);
|
||||
std::vector<TrPhiResult> result;
|
||||
auto &phi = envGet(Field, par().field);
|
||||
|
||||
envGetTmp(Field, phi2);
|
||||
envGetTmp(Field, buf);
|
||||
@ -151,7 +153,7 @@ void TTrPhi<SImpl>::execute(void)
|
||||
phin = trace(buf);
|
||||
if (!par().output.empty())
|
||||
{
|
||||
Result r;
|
||||
TrPhiResult r;
|
||||
|
||||
r.op = "tr(phi^" + std::to_string(n) + ")";
|
||||
r.value = TensorRemove(sum(phin)).real();
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class TransProjResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(TransProjResult,
|
||||
std::vector<std::vector<Complex>>, value,
|
||||
DiffType, type);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TTransProj: public Module<TransProjPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, op,
|
||||
Complex , value);
|
||||
};
|
||||
public:
|
||||
// constructor
|
||||
TTransProj(const std::string name);
|
||||
@ -137,21 +138,27 @@ void TTransProj<SImpl>::execute(void)
|
||||
<< par().type << " derivatives and op= '" << par().op
|
||||
<< "'" << std::endl;
|
||||
|
||||
std::vector<Result> result;
|
||||
auto &op = envGet(ComplexField, par().op);
|
||||
const unsigned int nd = env().getNd();
|
||||
TransProjResult result;
|
||||
auto &op = envGet(ComplexField, par().op);
|
||||
|
||||
envGetTmp(ComplexField, buf1);
|
||||
envGetTmp(ComplexField, buf2);
|
||||
envGetTmp(ComplexField, lap);
|
||||
lap = zero;
|
||||
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
result.type = par().type;
|
||||
result.value.resize(nd, std::vector<Complex>(nd));
|
||||
}
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
{
|
||||
dmu(buf1, op, mu, par().type);
|
||||
dmu(buf2, buf1, mu, par().type);
|
||||
lap += buf2;
|
||||
}
|
||||
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||
for (unsigned int nu = mu; nu < env().getNd(); ++nu)
|
||||
for (unsigned int mu = 0; mu < nd; ++mu)
|
||||
for (unsigned int nu = mu; nu < nd; ++nu)
|
||||
{
|
||||
auto &out = envGet(ComplexField, varName(getName(), mu, nu));
|
||||
dmu(buf1, op, mu, par().type);
|
||||
@ -163,16 +170,11 @@ void TTransProj<SImpl>::execute(void)
|
||||
}
|
||||
if (!par().output.empty())
|
||||
{
|
||||
Result r;
|
||||
|
||||
r.op = "(delta_" + std::to_string(mu) + "," + std::to_string(nu)
|
||||
+ " d^2 - d_" + std::to_string(mu) + "*d_"
|
||||
+ std::to_string(nu) + ")*op";
|
||||
r.value = TensorRemove(sum(out));
|
||||
result.push_back(r);
|
||||
result.value[mu][nu] = TensorRemove(sum(out));
|
||||
result.value[mu][nu] = result.value[nu][mu];
|
||||
}
|
||||
}
|
||||
if (result.size() > 0)
|
||||
if (!par().output.empty())
|
||||
{
|
||||
saveResult(par().output, "transproj", result);
|
||||
}
|
||||
|
@ -50,23 +50,23 @@ public:
|
||||
std::string, output);
|
||||
};
|
||||
|
||||
class TwoPointResult: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(TwoPointResult,
|
||||
std::string, sink,
|
||||
std::string, source,
|
||||
std::vector<int>, mom,
|
||||
std::vector<Complex>, data);
|
||||
};
|
||||
|
||||
template <typename SImpl>
|
||||
class TTwoPoint: public Module<TwoPointPar>
|
||||
{
|
||||
public:
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
typedef std::vector<TComplex> SlicedOp;
|
||||
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||
std::string, sink,
|
||||
std::string, source,
|
||||
std::vector<int>, mom,
|
||||
std::vector<Complex>, data);
|
||||
};
|
||||
typedef typename SImpl::Field Field;
|
||||
typedef typename SImpl::ComplexField ComplexField;
|
||||
typedef std::vector<Complex> SlicedOp;
|
||||
public:
|
||||
// constructor
|
||||
TTwoPoint(const std::string name);
|
||||
@ -143,7 +143,7 @@ void TTwoPoint<SImpl>::setup(void)
|
||||
mom_[i] = strToVec<int>(par().mom[i]);
|
||||
if (mom_[i].size() != nd - 1)
|
||||
{
|
||||
HADRON_ERROR(Size, "momentum number of components different from "
|
||||
HADRONS_ERROR(Size, "momentum number of components different from "
|
||||
+ std::to_string(nd-1));
|
||||
}
|
||||
}
|
||||
@ -160,18 +160,24 @@ void TTwoPoint<SImpl>::execute(void)
|
||||
LOG(Message) << " <" << p.first << " " << p.second << ">" << std::endl;
|
||||
}
|
||||
|
||||
const unsigned int nd = env().getDim().size();
|
||||
const unsigned int nt = env().getDim().back();
|
||||
const unsigned int nop = par().op.size();
|
||||
const unsigned int nmom = mom_.size();
|
||||
const unsigned int nd = env().getNd();
|
||||
const unsigned int nt = env().getDim().back();
|
||||
const unsigned int nop = par().op.size();
|
||||
const unsigned int nmom = mom_.size();
|
||||
double partVol = 1.;
|
||||
std::vector<int> dMask(nd, 1);
|
||||
std::set<std::string> ops;
|
||||
std::vector<Result> result;
|
||||
std::vector<TwoPointResult> result;
|
||||
std::map<std::string, std::vector<SlicedOp>> slicedOp;
|
||||
FFT fft(env().getGrid());
|
||||
TComplex buf;
|
||||
|
||||
envGetTmp(ComplexField, ftBuf);
|
||||
dMask[nd - 1] = 0;
|
||||
for (unsigned int mu = 0; mu < nd - 1; ++mu)
|
||||
{
|
||||
partVol *= env().getDim()[mu];
|
||||
}
|
||||
for (auto &p: par().op)
|
||||
{
|
||||
ops.insert(p.first);
|
||||
@ -183,7 +189,7 @@ void TTwoPoint<SImpl>::execute(void)
|
||||
|
||||
slicedOp[o].resize(nmom);
|
||||
LOG(Message) << "Operator '" << o << "' FFT" << std::endl;
|
||||
fft.FFT_dim_mask(ftBuf, op, dMask, FFT::backward);
|
||||
fft.FFT_dim_mask(ftBuf, op, dMask, FFT::forward);
|
||||
for (unsigned int m = 0; m < nmom; ++m)
|
||||
{
|
||||
auto qt = mom_[m];
|
||||
@ -193,7 +199,8 @@ void TTwoPoint<SImpl>::execute(void)
|
||||
for (unsigned int t = 0; t < nt; ++t)
|
||||
{
|
||||
qt[nd - 1] = t;
|
||||
peekSite(slicedOp[o][m][t], ftBuf, qt);
|
||||
peekSite(buf, ftBuf, qt);
|
||||
slicedOp[o][m][t] = TensorRemove(buf)/partVol;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -201,7 +208,7 @@ void TTwoPoint<SImpl>::execute(void)
|
||||
for (unsigned int m = 0; m < nmom; ++m)
|
||||
for (auto &p: par().op)
|
||||
{
|
||||
Result r;
|
||||
TwoPointResult r;
|
||||
|
||||
r.sink = p.first;
|
||||
r.source = p.second;
|
||||
@ -228,7 +235,7 @@ std::vector<Complex> TTwoPoint<SImpl>::makeTwoPoint(
|
||||
{
|
||||
for (unsigned int t = 0; t < nt; ++t)
|
||||
{
|
||||
res[dt] += TensorRemove(trace(sink[(t+dt)%nt]*adj(source[t])));
|
||||
res[dt] += sink[(t+dt)%nt]*adj(source[t]);
|
||||
}
|
||||
res[dt] *= 1./static_cast<double>(nt);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ inline void dmu(Field &out, const Field &in, const unsigned int mu, const DiffTy
|
||||
|
||||
if (mu >= env.getNd())
|
||||
{
|
||||
HADRON_ERROR(Range, "Derivative direction out of range");
|
||||
HADRONS_ERROR(Range, "Derivative direction out of range");
|
||||
}
|
||||
switch(type)
|
||||
{
|
||||
@ -58,7 +58,7 @@ inline void dmu(Field &out, const Field &in, const unsigned int mu, const DiffTy
|
||||
out = 0.5*(Cshift(in, mu, 1) - Cshift(in, mu, -1));
|
||||
break;
|
||||
default:
|
||||
HADRON_ERROR(Argument, "Derivative type invalid");
|
||||
HADRONS_ERROR(Argument, "Derivative type invalid");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ inline void dmuAcc(Field &out, const Field &in, const unsigned int mu, const Dif
|
||||
|
||||
if (mu >= env.getNd())
|
||||
{
|
||||
HADRON_ERROR(Range, "Derivative direction out of range");
|
||||
HADRONS_ERROR(Range, "Derivative direction out of range");
|
||||
}
|
||||
switch(type)
|
||||
{
|
||||
@ -84,7 +84,7 @@ inline void dmuAcc(Field &out, const Field &in, const unsigned int mu, const Dif
|
||||
out += 0.5*(Cshift(in, mu, 1) - Cshift(in, mu, -1));
|
||||
break;
|
||||
default:
|
||||
HADRON_ERROR(Argument, "Derivative type invalid");
|
||||
HADRONS_ERROR(Argument, "Derivative type invalid");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void TRBPrecCG<FImpl, nBasis>::setup(void)
|
||||
{
|
||||
if (par().maxIteration == 0)
|
||||
{
|
||||
HADRON_ERROR(Argument, "zero maximum iteration");
|
||||
HADRONS_ERROR(Argument, "zero maximum iteration");
|
||||
}
|
||||
|
||||
LOG(Message) << "setting up Schur red-black preconditioned CG for"
|
||||
|
@ -123,7 +123,7 @@ void TTestSeqConserved<FImpl>::setup(void)
|
||||
auto Ls = env().getObjectLs(par().q);
|
||||
if (Ls != env().getObjectLs(par().action))
|
||||
{
|
||||
HADRON_ERROR(Size, "Ls mismatch between quark action and propagator");
|
||||
HADRONS_ERROR(Size, "Ls mismatch between quark action and propagator");
|
||||
}
|
||||
envTmpLat(PropagatorField, "tmp");
|
||||
envTmpLat(LatticeComplex, "c");
|
||||
|
@ -123,7 +123,7 @@ void VirtualMachine::pushModule(VirtualMachine::ModPt &pt)
|
||||
else
|
||||
{
|
||||
// output already fully registered, error
|
||||
HADRON_ERROR(Definition, "object '" + out
|
||||
HADRONS_ERROR(Definition, "object '" + out
|
||||
+ "' is already produced by module '"
|
||||
+ module_[env().getObjectModule(out)].name
|
||||
+ "' (while pushing module '" + name + "')");
|
||||
@ -158,7 +158,7 @@ void VirtualMachine::pushModule(VirtualMachine::ModPt &pt)
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "module '" + name + "' already exists");
|
||||
HADRONS_ERROR(Definition, "module '" + name + "' already exists");
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ ModuleBase * VirtualMachine::getModule(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ unsigned int VirtualMachine::getModuleAddress(const std::string name) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no module with name '" + name + "'");
|
||||
HADRONS_ERROR(Definition, "no module with name '" + name + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ std::string VirtualMachine::getModuleName(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ std::string VirtualMachine::getModuleType(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
HADRONS_ERROR(Definition, "no module with address " + std::to_string(address));
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ void VirtualMachine::makeModuleGraph(void)
|
||||
|
||||
if (min < 0)
|
||||
{
|
||||
HADRON_ERROR(Definition, "dependency '"
|
||||
HADRONS_ERROR(Definition, "dependency '"
|
||||
+ env().getObjectName(in) + "' (address "
|
||||
+ std::to_string(in)
|
||||
+ ") is not produced by any module");
|
||||
|
@ -195,7 +195,7 @@ M * VirtualMachine::getModule(const unsigned int address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
HADRON_ERROR(Definition, "module '" + module_[address].name
|
||||
HADRONS_ERROR(Definition, "module '" + module_[address].name
|
||||
+ "' does not have type " + typeid(M).name()
|
||||
+ "(has type: " + getModuleType(address) + ")");
|
||||
}
|
||||
|
Reference in New Issue
Block a user