mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
QedFVol: Fix bugs in StochEm.cc and ChargedProp.cc (still only works without MPI).
This commit is contained in:
parent
3db7a5387b
commit
cdf550845f
@ -57,10 +57,8 @@ std::vector<std::string> TStochEm::getOutput(void)
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
void TStochEm::setup(void)
|
||||
{
|
||||
if (!env().hasCreatedObject("_" + getName() + "_weight"))
|
||||
{
|
||||
envCacheLat(EmComp, "_" + getName() + "_weight");
|
||||
}
|
||||
weightDone_ = env().hasCreatedObject("_" + getName() + "_weight");
|
||||
envCacheLat(EmComp, "_" + getName() + "_weight");
|
||||
envCreateLat(EmField, getName());
|
||||
}
|
||||
|
||||
@ -73,7 +71,7 @@ void TStochEm::execute(void)
|
||||
auto &a = envGet(EmField, getName());
|
||||
auto &w = envGet(EmComp, "_" + getName() + "_weight");
|
||||
|
||||
if (!env().hasCreatedObject("_" + getName() + "_weight"))
|
||||
if (!weightDone_)
|
||||
{
|
||||
LOG(Message) << "Caching stochastic EM potential weight (gauge: "
|
||||
<< par().gauge << ", zero-mode scheme: "
|
||||
|
@ -66,6 +66,8 @@ protected:
|
||||
virtual void setup(void);
|
||||
// execution
|
||||
virtual void execute(void);
|
||||
private:
|
||||
bool weightDone_;
|
||||
};
|
||||
|
||||
MODULE_REGISTER_NS(StochEm, TStochEm, MGauge);
|
||||
|
@ -117,26 +117,25 @@ void TChargedProp::execute(void)
|
||||
envGetTmp(ScalarField, buf);
|
||||
|
||||
// -G*momD1*G*F*Src (momD1 = F*D1*Finv)
|
||||
buf = GFSrc;
|
||||
momD1(buf, fft);
|
||||
buf = -G*buf;
|
||||
fft.FFT_dim(propQ, buf, env().getNd()-1, FFT::backward);
|
||||
propQ = GFSrc;
|
||||
momD1(propQ, fft);
|
||||
propQ = -G*propQ;
|
||||
propSun = -propQ;
|
||||
fft.FFT_dim(propQ, propQ, env().getNd()-1, FFT::backward);
|
||||
|
||||
// G*momD1*G*momD1*G*F*Src (here buf = G*momD1*G*F*Src)
|
||||
buf = -buf;
|
||||
momD1(buf, fft);
|
||||
propSun = G*buf;
|
||||
momD1(propSun, fft);
|
||||
propSun = G*propSun;
|
||||
fft.FFT_dim(propSun, propSun, env().getNd()-1, FFT::backward);
|
||||
|
||||
// -G*momD2*G*F*Src (momD2 = F*D2*Finv)
|
||||
buf = GFSrc;
|
||||
momD2(buf, fft);
|
||||
buf = -G*buf;
|
||||
fft.FFT_dim(propTad, buf, env().getNd()-1, FFT::backward);
|
||||
propTad = GFSrc;
|
||||
momD2(propTad, fft);
|
||||
propTad = -G*propTad;
|
||||
fft.FFT_dim(propTad, propTad, env().getNd()-1, FFT::backward);
|
||||
|
||||
// full charged scalar propagator
|
||||
buf = GFSrc;
|
||||
fft.FFT_dim(buf, buf, env().getNd()-1, FFT::backward);
|
||||
fft.FFT_dim(buf, GFSrc, env().getNd()-1, FFT::backward);
|
||||
prop = buf + q*propQ + q*q*propSun + q*q*propTad;
|
||||
|
||||
// OUTPUT IF NECESSARY
|
||||
@ -189,13 +188,14 @@ void TChargedProp::execute(void)
|
||||
peekSite(site, propTad, whichmom);
|
||||
resultTad[t]=TensorRemove(site);
|
||||
}
|
||||
saveResult(filename, "charge", q);
|
||||
saveResult(filename, "mass", par().mass);
|
||||
saveResult(filename, "prop", result);
|
||||
saveResult(filename, "prop_0", result0);
|
||||
saveResult(filename, "prop_Q", resultQ);
|
||||
saveResult(filename, "prop_Sun", resultSun);
|
||||
saveResult(filename, "prop_Tad", resultTad);
|
||||
ResultWriter writer(RESULT_FILE_NAME(filename));
|
||||
write(writer, "charge", q);
|
||||
write(writer, "mass", par().mass);
|
||||
write(writer, "prop", result);
|
||||
write(writer, "prop_0", result0);
|
||||
write(writer, "prop_Q", resultQ);
|
||||
write(writer, "prop_Sun", resultSun);
|
||||
write(writer, "prop_Tad", resultTad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,8 @@ void TScalarVP::execute(void)
|
||||
vpTensor.push_back(vpTensor_mu);
|
||||
}
|
||||
|
||||
// Prepare output files if necessary
|
||||
// Open output files if necessary
|
||||
std::vector<ResultWriter *> writer;
|
||||
if (!par().output.empty())
|
||||
{
|
||||
LOG(Message) << "Preparing output files..." << std::endl;
|
||||
@ -247,8 +248,10 @@ void TScalarVP::execute(void)
|
||||
+ std::to_string(mom[0])
|
||||
+ std::to_string(mom[1])
|
||||
+ std::to_string(mom[2]);
|
||||
saveResult(filename, "charge", q);
|
||||
saveResult(filename, "mass", static_cast<TChargedProp *>(vm().getModule(par().scalarProp))->par().mass);
|
||||
ResultWriter *writer_i = new ResultWriter(RESULT_FILE_NAME(filename));
|
||||
writer.push_back(writer_i);
|
||||
write(*writer_i, "charge", q);
|
||||
write(*writer_i, "mass", static_cast<TChargedProp *>(vm().getModule(par().scalarProp))->par().mass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +275,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(buf,
|
||||
writeVP(writer, buf,
|
||||
"Pi_free_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -282,7 +285,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_srcT_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -292,7 +295,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_snkT_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -306,7 +309,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_S_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -329,7 +332,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_4C_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -341,7 +344,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_X_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -358,7 +361,7 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_2E_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
@ -374,18 +377,25 @@ void TScalarVP::execute(void)
|
||||
// Output if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(result,
|
||||
writeVP(writer, result,
|
||||
"Pi_2T_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
|
||||
// Output full VP if necessary
|
||||
if (!par().output.empty())
|
||||
{
|
||||
writeVP(*vpTensor[mu][nu],
|
||||
writeVP(writer, *vpTensor[mu][nu],
|
||||
"Pi_"+std::to_string(mu)+"_"+std::to_string(nu));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!par().output.empty())
|
||||
{
|
||||
for (unsigned int i_p = 0; i_p < par().outputMom.size(); ++i_p)
|
||||
{
|
||||
delete writer[i_p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TScalarVP::makeCaches(void)
|
||||
@ -438,7 +448,7 @@ void TScalarVP::vpContraction(ScalarField &vp,
|
||||
vp = 2.0*real(vp);
|
||||
}
|
||||
|
||||
void TScalarVP::writeVP(const ScalarField &vp, std::string dsetName)
|
||||
void TScalarVP::writeVP(std::vector<ResultWriter *> &writer, const ScalarField &vp, std::string dsetName)
|
||||
{
|
||||
std::vector<TComplex> vecBuf;
|
||||
std::vector<Complex> result;
|
||||
@ -446,11 +456,6 @@ void TScalarVP::writeVP(const ScalarField &vp, std::string dsetName)
|
||||
|
||||
for (unsigned int i_p = 0; i_p < par().outputMom.size(); ++i_p)
|
||||
{
|
||||
std::vector<int> mom = strToVec<int>(par().outputMom[i_p]);
|
||||
std::string filename = par().output + "_"
|
||||
+ std::to_string(mom[0])
|
||||
+ std::to_string(mom[1])
|
||||
+ std::to_string(mom[2]);
|
||||
buf = vp*(*momPhase_[i_p]);
|
||||
sliceSum(buf, vecBuf, Tp);
|
||||
result.resize(vecBuf.size());
|
||||
@ -458,7 +463,7 @@ void TScalarVP::writeVP(const ScalarField &vp, std::string dsetName)
|
||||
{
|
||||
result[t] = TensorRemove(vecBuf[t]);
|
||||
}
|
||||
saveResult(filename, dsetName, result);
|
||||
write(*writer[i_p], dsetName, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,8 @@ private:
|
||||
ScalarField &prop_0_x, ScalarField &prop_nu_x,
|
||||
TComplex u_src, int mu);
|
||||
// write momentum-projected vacuum polarisation to file(s)
|
||||
void writeVP(const ScalarField &vp, std::string dsetName);
|
||||
void writeVP(std::vector<ResultWriter *> &writer, const ScalarField &vp,
|
||||
std::string dsetName);
|
||||
// momentum-space Delta_1 insertion
|
||||
void momD1(ScalarField &s, FFT &fft);
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user