1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-13 01:05:36 +00:00

QedFVol: Write to output files from one process only.

This commit is contained in:
James Harrison 2017-11-07 14:46:39 +00:00
parent 840814c776
commit 0c668bf46a
2 changed files with 134 additions and 128 deletions

View File

@ -151,22 +151,24 @@ void TChargedProp::execute(void)
buf = GFSrc;
momD1(buf, fft);
buf = -G*buf;
fft.FFT_all_dim(propQ, buf, FFT::backward);
fft.FFT_dim(propQ, buf, 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;
fft.FFT_all_dim(propSun, propSun, FFT::backward);
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_all_dim(propTad, buf, FFT::backward);
fft.FFT_dim(propTad, buf, env().getNd()-1, FFT::backward);
// full charged scalar propagator
prop = (*prop0_) + q*propQ + q*q*propSun + q*q*propTad;
buf = GFSrc;
fft.FFT_dim(buf, buf, env().getNd()-1, FFT::backward);
prop = buf + q*propQ + q*q*propSun + q*q*propTad;
// OUTPUT IF NECESSARY
if (!par().output.empty())
@ -183,95 +185,63 @@ void TChargedProp::execute(void)
LOG(Message) << "Saving (" << par().outputMom[i_p] << ") momentum projection to '"
<< filename << "'..." << std::endl;
CorrWriter writer(filename);
std::vector<TComplex> vecBuf;
std::vector<Complex> result;
// std::vector<TComplex> vecBuf;
std::vector<Complex> result, result0, resultQ, resultSun, resultTad;
result.resize(env().getGrid()->_fdimensions[env().getNd()-1]);
result0.resize(env().getGrid()->_fdimensions[env().getNd()-1]);
resultQ.resize(env().getGrid()->_fdimensions[env().getNd()-1]);
resultSun.resize(env().getGrid()->_fdimensions[env().getNd()-1]);
resultTad.resize(env().getGrid()->_fdimensions[env().getNd()-1]);
TComplex site;
std::vector<int> whichmom;
whichmom.resize(env().getNd());
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
whichmom[j] = mom[j];
}
for (unsigned int t = 0; t < env().getGrid()->_fdimensions[env().getNd()-1]; ++t)
{
whichmom[env().getNd()-1] = t;
// Write full propagator
peekSite(site, prop, whichmom);
result[t]=TensorRemove(site);
// Write free propagator
peekSite(site, buf, whichmom);
result0[t]=TensorRemove(site);
// Write propagator O(q) term
peekSite(site, propQ, whichmom);
resultQ[t]=TensorRemove(site);
// Write propagator sunset term
peekSite(site, propSun, whichmom);
resultSun[t]=TensorRemove(site);
// Write propagator tadpole term
peekSite(site, propTad, whichmom);
resultTad[t]=TensorRemove(site);
}
if (env().getGrid()->IsBoss())
{
CorrWriter writer(filename);
write(writer, "charge", q);
write(writer, "mass", par().mass);
// Write full propagator
buf = prop;
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
{
buf = buf*adj(*phase_[j]);
}
}
sliceSum(buf, vecBuf, Tp);
result.resize(vecBuf.size());
for (unsigned int t = 0; t < vecBuf.size(); ++t)
{
result[t] = TensorRemove(vecBuf[t]);
}
write(writer, "prop", result);
write(writer, "prop_0", result0);
write(writer, "prop_Q", resultQ);
write(writer, "prop_Sun", resultSun);
write(writer, "prop_Tad", resultTad);
}
}
}
// Write free propagator
buf = *prop0_;
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
{
buf = buf*adj(*phase_[j]);
}
}
sliceSum(buf, vecBuf, Tp);
for (unsigned int t = 0; t < vecBuf.size(); ++t)
{
result[t] = TensorRemove(vecBuf[t]);
}
write(writer, "prop_0", result);
// Write propagator O(q) term
buf = propQ;
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
{
buf = buf*adj(*phase_[j]);
}
}
sliceSum(buf, vecBuf, Tp);
for (unsigned int t = 0; t < vecBuf.size(); ++t)
{
result[t] = TensorRemove(vecBuf[t]);
}
write(writer, "prop_Q", result);
// Write propagator sunset term
buf = propSun;
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
{
buf = buf*adj(*phase_[j]);
}
}
sliceSum(buf, vecBuf, Tp);
for (unsigned int t = 0; t < vecBuf.size(); ++t)
{
result[t] = TensorRemove(vecBuf[t]);
}
write(writer, "prop_Sun", result);
// Write propagator tadpole term
buf = propTad;
for (unsigned int j = 0; j < env().getNd()-1; ++j)
{
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
{
buf = buf*adj(*phase_[j]);
}
}
sliceSum(buf, vecBuf, Tp);
for (unsigned int t = 0; t < vecBuf.size(); ++t)
{
result[t] = TensorRemove(vecBuf[t]);
}
write(writer, "prop_Tad", result);
}
}
std::vector<int> mask(env().getNd(),1);
mask[env().getNd()-1] = 0;
fft.FFT_dim_mask(prop, prop, mask, FFT::backward);
fft.FFT_dim_mask(propQ, propQ, mask, FFT::backward);
fft.FFT_dim_mask(propSun, propSun, mask, FFT::backward);
fft.FFT_dim_mask(propTad, propTad, mask, FFT::backward);
}
void TChargedProp::momD1(ScalarField &s, FFT &fft)

View File

@ -173,6 +173,8 @@ void TScalarVP::execute(void)
+ "_diagrams." +
std::to_string(env().getTrajectory());
if (env().getGrid()->IsBoss())
{
CorrWriter *writer_i = new CorrWriter(filename);
writer.push_back(writer_i);
CorrWriter *writer0_i = new CorrWriter(filename0);
@ -186,6 +188,7 @@ void TScalarVP::execute(void)
write(*writer0[i_p], "mass", static_cast<TChargedProp *>(env().getModule(par().scalarProp))->par().mass);
write(*writerD[i_p], "charge", q);
write(*writerD[i_p], "mass", static_cast<TChargedProp *>(env().getModule(par().scalarProp))->par().mass);
}
// Calculate phase factors
vpPhase = Complex(1.0,0.0);
@ -231,11 +234,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writer0[i_p],
"Pi_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// "Exchange" terms
prop1 += q*propQ;
@ -259,11 +265,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_exchange_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Subtract O(alpha^2) term
prop1 = q*propQ;
@ -287,11 +296,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_alpha2_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Sunset from unshifted source
prop1 = q*q*propSun;
@ -313,11 +325,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_sunset_unshifted_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Sunset from shifted source
prop1 = Cshift(prop1, nu, -1);
@ -338,11 +353,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_sunset_shifted_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Tadpole from unshifted source
prop1 = q*q*propTad;
@ -364,11 +382,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_tadpole_unshifted_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Tadpole from shifted source
prop1 = Cshift(prop1, nu, -1);
@ -389,11 +410,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_tadpole_shifted_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Source tadpole
prop1 = *prop0_;
@ -418,11 +442,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_sourcetadpole_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Sink tadpole
tmp_vp = adj(prop2)
@ -446,11 +473,14 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writerD[i_p],
"Pi_sinktadpole_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
}
}
}
// Output if necessary
if (!par().output.empty())
@ -464,6 +494,8 @@ void TScalarVP::execute(void)
{
result[t] = TensorRemove(vecBuf[t]);
}
if (env().getGrid()->IsBoss())
{
write(*writer[i_p],
"Pi_"+std::to_string(mu)+"_"+std::to_string(nu),
result);
@ -471,9 +503,12 @@ void TScalarVP::execute(void)
}
}
}
}
if (!par().output.empty())
{
for (unsigned int i_p = 0; i_p < par().outputMom.size(); ++i_p)
{
if (env().getGrid()->IsBoss())
{
delete writer[i_p];
delete writer0[i_p];
@ -481,6 +516,7 @@ void TScalarVP::execute(void)
}
}
}
}
void TScalarVP::momD1(ScalarField &s, FFT &fft)
{