mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Hadrons: progress on the interface, genetic algorithm freezing
This commit is contained in:
@ -110,15 +110,16 @@ void TDWF<FImpl>::setup(void)
|
||||
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
||||
<< std::endl;
|
||||
env().createGrid(par().Ls);
|
||||
auto &U = mGetObj(LatticeGaugeField, par().gauge);
|
||||
auto &U = envGet(LatticeGaugeField, par().gauge);
|
||||
auto &g4 = *env().getGrid();
|
||||
auto &grb4 = *env().getRbGrid();
|
||||
auto &g5 = *env().getGrid(par().Ls);
|
||||
auto &grb5 = *env().getRbGrid(par().Ls);
|
||||
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
||||
typename DomainWallFermion<FImpl>::ImplParams implParams(boundary);
|
||||
mCreateObj(DomainWallFermion<FImpl>, getName(), par().Ls,
|
||||
U, g5, grb5, g4, grb4, par().mass, par().M5, implParams);
|
||||
envCreate(FMat, getName(), par().Ls,
|
||||
new DomainWallFermion<FImpl>(U, g5, grb5, g4, grb4, par().mass,
|
||||
par().M5, implParams));
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
|
@ -105,13 +105,14 @@ void TWilson<FImpl>::setup(void)
|
||||
<< " using gauge field '" << par().gauge << "'" << std::endl;
|
||||
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
||||
<< std::endl;
|
||||
auto &U = mGetObj(LatticeGaugeField, par().gauge);
|
||||
auto &U = envGet(LatticeGaugeField, par().gauge);
|
||||
auto &grid = *env().getGrid();
|
||||
auto &gridRb = *env().getRbGrid();
|
||||
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
||||
typename WilsonFermion<FImpl>::ImplParams implParams(boundary);
|
||||
mCreateObj(WilsonFermion<FImpl>, getName(), 1, U, grid, gridRb, par().mass,
|
||||
implParams);
|
||||
envCreate(FMat, getName(), 1, new WilsonFermion<FImpl>(U, grid, gridRb,
|
||||
par().mass,
|
||||
implParams));
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
|
@ -153,7 +153,6 @@ void TMeson<FImpl1, FImpl2>::parseGammaString(std::vector<GammaPair> &gammaList)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
#define mesonConnected(q1, q2, gSnk, gSrc) \
|
||||
(g5*(gSnk))*(q1)*(adj(gSrc)*g5)*adj(q2)
|
||||
@ -180,11 +179,11 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
||||
result[i].gamma_src = gammaList[i].second;
|
||||
result[i].corr.resize(nt);
|
||||
}
|
||||
if (env().template isObjectOfType<SlicedPropagator1>(par().q1) and
|
||||
env().template isObjectOfType<SlicedPropagator2>(par().q2))
|
||||
if (envIsType(SlicedPropagator1, par().q1) and
|
||||
envIsType(SlicedPropagator2, par().q2))
|
||||
{
|
||||
SlicedPropagator1 &q1 = *env().template getObject<SlicedPropagator1>(par().q1);
|
||||
SlicedPropagator2 &q2 = *env().template getObject<SlicedPropagator2>(par().q2);
|
||||
SlicedPropagator1 &q1 = envGet(SlicedPropagator1, par().q1);
|
||||
SlicedPropagator2 &q2 = envGet(SlicedPropagator2, par().q2);
|
||||
|
||||
LOG(Message) << "(propagator already sinked)" << std::endl;
|
||||
for (unsigned int i = 0; i < result.size(); ++i)
|
||||
@ -200,8 +199,8 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
|
||||
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
|
||||
PropagatorField1 &q1 = envGet(PropagatorField1, par().q1);
|
||||
PropagatorField2 &q2 = envGet(PropagatorField2, par().q2);
|
||||
LatticeComplex c(env().getGrid());
|
||||
|
||||
LOG(Message) << "(using sink '" << par().sink << "')" << std::endl;
|
||||
@ -214,15 +213,14 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
||||
ns = env().getModuleNamespace(env().getObjectModule(par().sink));
|
||||
if (ns == "MSource")
|
||||
{
|
||||
PropagatorField1 &sink =
|
||||
*env().template getObject<PropagatorField1>(par().sink);
|
||||
PropagatorField1 &sink = envGet(PropagatorField1, par().sink);
|
||||
|
||||
c = trace(mesonConnected(q1, q2, gSnk, gSrc)*sink);
|
||||
sliceSum(c, buf, Tp);
|
||||
}
|
||||
else if (ns == "MSink")
|
||||
{
|
||||
SinkFnScalar &sink = *env().template getObject<SinkFnScalar>(par().sink);
|
||||
SinkFnScalar &sink = envGet(SinkFnScalar, par().sink);
|
||||
|
||||
c = trace(mesonConnected(q1, q2, gSnk, gSrc));
|
||||
buf = sink(c);
|
||||
|
@ -127,10 +127,13 @@ template <typename FImpl>
|
||||
void TGaugeProp<FImpl>::setup(void)
|
||||
{
|
||||
Ls_ = env().getObjectLs(par().solver);
|
||||
env().template registerLattice<PropagatorField>(getName());
|
||||
envCreateLat(PropagatorField, getName());
|
||||
envTmpLat(FermionField, "source", Ls_);
|
||||
envTmpLat(FermionField, "sol", Ls_);
|
||||
envTmpLat(FermionField, "tmp");
|
||||
if (Ls_ > 1)
|
||||
{
|
||||
env().template registerLattice<PropagatorField>(getName() + "_5d", Ls_);
|
||||
envCreateLat(PropagatorField, getName() + "_5d", Ls_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,21 +142,18 @@ template <typename FImpl>
|
||||
void TGaugeProp<FImpl>::execute(void)
|
||||
{
|
||||
LOG(Message) << "Computing quark propagator '" << getName() << "'"
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
|
||||
FermionField source(env().getGrid(Ls_)), sol(env().getGrid(Ls_)),
|
||||
tmp(env().getGrid());
|
||||
FermionField &source = envGetTmp(FermionField, "source");
|
||||
FermionField &sol = envGetTmp(FermionField, "sol");
|
||||
FermionField &tmp = envGetTmp(FermionField, "tmp");
|
||||
std::string propName = (Ls_ == 1) ? getName() : (getName() + "_5d");
|
||||
PropagatorField &prop = *env().template createLattice<PropagatorField>(propName);
|
||||
PropagatorField &fullSrc = *env().template getObject<PropagatorField>(par().source);
|
||||
SolverFn &solver = *env().template getObject<SolverFn>(par().solver);
|
||||
if (Ls_ > 1)
|
||||
{
|
||||
env().template createLattice<PropagatorField>(getName());
|
||||
}
|
||||
PropagatorField &prop = envGet(PropagatorField, propName);
|
||||
PropagatorField &fullSrc = envGet(PropagatorField, par().source);
|
||||
SolverFn &solver = envGet(SolverFn, par().solver);
|
||||
|
||||
LOG(Message) << "Inverting using solver '" << par().solver
|
||||
<< "' on source '" << par().source << "'" << std::endl;
|
||||
<< "' on source '" << par().source << "'" << std::endl;
|
||||
for (unsigned int s = 0; s < Ns; ++s)
|
||||
for (unsigned int c = 0; c < Nc; ++c)
|
||||
{
|
||||
@ -190,8 +190,7 @@ void TGaugeProp<FImpl>::execute(void)
|
||||
// create 4D propagators from 5D one if necessary
|
||||
if (Ls_ > 1)
|
||||
{
|
||||
PropagatorField &p4d =
|
||||
*env().template getObject<PropagatorField>(getName());
|
||||
PropagatorField &p4d = envGet(PropagatorField, getName());
|
||||
make_4D(sol, tmp, Ls_);
|
||||
FermToProp(p4d, tmp, s, c);
|
||||
}
|
||||
|
@ -57,13 +57,13 @@ std::vector<std::string> TUnit::getOutput(void)
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
void TUnit::setup(void)
|
||||
{
|
||||
mCreateObj(LatticeGaugeField, getName(), 1, env().getGrid());
|
||||
envCreateLat(LatticeGaugeField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
void TUnit::execute(void)
|
||||
{
|
||||
LOG(Message) << "Creating unit gauge configuration" << std::endl;
|
||||
auto &U = mGetObj(LatticeGaugeField, getName());
|
||||
auto &U = envGet(LatticeGaugeField, getName());
|
||||
SU3::ColdConfiguration(*env().get4dRng(), U);
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
virtual void setup(void);
|
||||
// execution
|
||||
virtual void execute(void);
|
||||
private:
|
||||
bool hasPhase_{false};
|
||||
std::string momphName_;
|
||||
};
|
||||
|
||||
MODULE_REGISTER_NS(Point, TPoint<FIMPL>, MSink);
|
||||
@ -77,6 +80,7 @@ MODULE_REGISTER_NS(ScalarPoint, TPoint<ScalarImplCR>, MSink);
|
||||
template <typename FImpl>
|
||||
TPoint<FImpl>::TPoint(const std::string name)
|
||||
: Module<PointPar>(name)
|
||||
, momphName_ (name + "_momph")
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
@ -100,30 +104,36 @@ std::vector<std::string> TPoint<FImpl>::getOutput(void)
|
||||
template <typename FImpl>
|
||||
void TPoint<FImpl>::setup(void)
|
||||
{
|
||||
unsigned int size;
|
||||
|
||||
size = env().template lattice4dSize<LatticeComplex>();
|
||||
env().registerObject(getName(), size);
|
||||
envTmpLat(LatticeComplex, "coor");
|
||||
envCacheLat(LatticeComplex, momphName_);
|
||||
envCreate(SinkFn, getName(), 1, nullptr);
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
void TPoint<FImpl>::execute(void)
|
||||
{
|
||||
std::vector<Real> p = strToVec<Real>(par().mom);
|
||||
LatticeComplex ph(env().getGrid()), coor(env().getGrid());
|
||||
std::vector<Real> p = strToVec<Real>(par().mom);
|
||||
LatticeComplex &ph = envGet(LatticeComplex, momphName_);
|
||||
Complex i(0.0,1.0);
|
||||
|
||||
LOG(Message) << "Setting up point sink function for momentum ["
|
||||
<< par().mom << "]" << std::endl;
|
||||
ph = zero;
|
||||
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
||||
|
||||
if (!hasPhase_)
|
||||
{
|
||||
LatticeCoordinate(coor, mu);
|
||||
ph = ph + (p[mu]/env().getGrid()->_fdimensions[mu])*coor;
|
||||
LatticeComplex &coor = envGetTmp(LatticeComplex, "coor");
|
||||
|
||||
ph = zero;
|
||||
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
||||
{
|
||||
LatticeCoordinate(coor, mu);
|
||||
ph = ph + (p[mu]/env().getGrid()->_fdimensions[mu])*coor;
|
||||
}
|
||||
ph = exp((Real)(2*M_PI)*i*ph);
|
||||
hasPhase_ = true;
|
||||
}
|
||||
ph = exp((Real)(2*M_PI)*i*ph);
|
||||
auto sink = [ph](const PropagatorField &field)
|
||||
auto sink = [&ph](const PropagatorField &field)
|
||||
{
|
||||
SlicedPropagator res;
|
||||
PropagatorField tmp = ph*field;
|
||||
@ -132,7 +142,7 @@ void TPoint<FImpl>::execute(void)
|
||||
|
||||
return res;
|
||||
};
|
||||
env().setObject(getName(), new SinkFn(sink));
|
||||
envGet(SinkFn, getName()) = sink;
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
@ -105,7 +105,7 @@ void TRBPrecCG<FImpl>::setup(void)
|
||||
<< par().residual << std::endl;
|
||||
|
||||
auto Ls = env().getObjectLs(par().action);
|
||||
auto &mat = mGetObj(FMat, par().action);
|
||||
auto &mat = envGet(FMat, par().action);
|
||||
auto solver = [&mat, this](FermionField &sol, const FermionField &source)
|
||||
{
|
||||
ConjugateGradient<FermionField> cg(par().residual, 10000);
|
||||
@ -113,7 +113,7 @@ void TRBPrecCG<FImpl>::setup(void)
|
||||
|
||||
schurSolver(mat, source, sol);
|
||||
};
|
||||
mCreateObj(SolverFn, getName(), Ls, solver);
|
||||
envCreate(SolverFn, getName(), Ls, new SolverFn(solver));
|
||||
env().addOwnership(getName(), par().action);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ std::vector<std::string> TPoint<FImpl>::getOutput(void)
|
||||
template <typename FImpl>
|
||||
void TPoint<FImpl>::setup(void)
|
||||
{
|
||||
env().template registerLattice<PropagatorField>(getName());
|
||||
envCreateLat(PropagatorField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
@ -123,7 +123,7 @@ void TPoint<FImpl>::execute(void)
|
||||
|
||||
LOG(Message) << "Creating point source at position [" << par().position
|
||||
<< "]" << std::endl;
|
||||
PropagatorField &src = *env().template createLattice<PropagatorField>(getName());
|
||||
PropagatorField &src = envGet(PropagatorField, getName());
|
||||
id = 1.;
|
||||
src = zero;
|
||||
pokeSite(id, src, position);
|
||||
|
Reference in New Issue
Block a user