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