2017-06-08 17:43:39 +01:00
|
|
|
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
2017-03-27 15:02:16 +01:00
|
|
|
#include <Grid/Hadrons/Modules/MScalar/ScalarVP.hpp>
|
2017-04-13 17:04:37 +01:00
|
|
|
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
2017-03-21 11:39:46 +00:00
|
|
|
|
|
|
|
using namespace Grid;
|
|
|
|
using namespace Hadrons;
|
|
|
|
using namespace MScalar;
|
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
/*
|
|
|
|
* Scalar QED vacuum polarisation up to O(alpha)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* _______
|
|
|
|
* / \ ( adj(S(a\hat{nu}|x)) U_mu(x) S(0|x+a\hat{mu}) U_nu(0) )
|
|
|
|
* Diagram notation: U_nu * * U_mu = 2 Re( - )
|
|
|
|
* \_______/ ( adj(S(a\hat{nu}|x+a\hat{mu})) adj(U_mu(x)) S(0|x) U_nu(0) )
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* _______
|
|
|
|
* / \
|
|
|
|
* free = 1 * * 1
|
|
|
|
* \_______/
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* _______
|
|
|
|
* / \
|
|
|
|
* S = iA_nu * * iA_mu
|
|
|
|
* \_______/
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Delta_1
|
|
|
|
* ___*___
|
|
|
|
* / \
|
|
|
|
* X = 1 * * 1
|
|
|
|
* \___*___/
|
|
|
|
* Delta_1
|
|
|
|
*
|
|
|
|
* Delta_1 Delta_1
|
|
|
|
* ___*___ ___*___
|
|
|
|
* / \ / \
|
|
|
|
* 1 * * iA_mu + iA_nu * * 1
|
|
|
|
* \_______/ \_______/
|
|
|
|
* 4C = _______ _______
|
|
|
|
* / \ / \
|
|
|
|
* + 1 * * iA_mu + iA_nu * * 1
|
|
|
|
* \___*___/ \___*___/
|
|
|
|
* Delta_1 Delta_1
|
|
|
|
*
|
|
|
|
* Delta_1 Delta_1
|
|
|
|
* _*___*_ _______
|
|
|
|
* / \ / \
|
|
|
|
* 2E = 1 * * 1 + 1 * * 1
|
|
|
|
* \_______/ \_*___*_/
|
|
|
|
* Delta_1 Delta_1
|
|
|
|
*
|
|
|
|
* Delta_2
|
|
|
|
* ___*___ _______
|
|
|
|
* / \ / \
|
|
|
|
* 2T = 1 * * 1 + 1 * * 1
|
|
|
|
* \_______/ \___*___/
|
|
|
|
* Delta_2
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* _______
|
|
|
|
* / \
|
|
|
|
* srcT = -A_nu^2/2 * * 1
|
|
|
|
* \_______/
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* _______
|
|
|
|
* / \
|
|
|
|
* snkT = 1 * * -A_mu^2/2
|
|
|
|
* \_______/
|
|
|
|
*
|
|
|
|
* Full VP to O(alpha) = free + q^2*(S+X+4C+2E+2T+srcT+snkT)
|
|
|
|
*/
|
|
|
|
|
2017-03-21 11:39:46 +00:00
|
|
|
/******************************************************************************
|
2017-03-27 15:02:16 +01:00
|
|
|
* TScalarVP implementation *
|
2017-03-21 11:39:46 +00:00
|
|
|
******************************************************************************/
|
|
|
|
// constructor /////////////////////////////////////////////////////////////////
|
2017-03-27 15:02:16 +01:00
|
|
|
TScalarVP::TScalarVP(const std::string name)
|
|
|
|
: Module<ScalarVPPar>(name)
|
2017-03-21 11:39:46 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
// dependencies/products ///////////////////////////////////////////////////////
|
2017-03-27 15:02:16 +01:00
|
|
|
std::vector<std::string> TScalarVP::getInput(void)
|
2017-03-21 11:39:46 +00:00
|
|
|
{
|
2017-06-08 17:43:39 +01:00
|
|
|
propQName_ = par().scalarProp + "_Q";
|
|
|
|
propSunName_ = par().scalarProp + "_Sun";
|
|
|
|
propTadName_ = par().scalarProp + "_Tad";
|
|
|
|
|
|
|
|
std::vector<std::string> in = {par().emField, propQName_, propSunName_,
|
|
|
|
propTadName_};
|
2017-03-21 11:39:46 +00:00
|
|
|
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
2017-03-27 15:02:16 +01:00
|
|
|
std::vector<std::string> TScalarVP::getOutput(void)
|
2017-03-21 11:39:46 +00:00
|
|
|
{
|
2017-06-08 17:43:39 +01:00
|
|
|
std::vector<std::string> out;
|
2017-03-21 11:39:46 +00:00
|
|
|
|
2017-04-25 10:04:03 +01:00
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
|
|
|
out.push_back(getName() + "_propQ_" + std::to_string(mu));
|
2017-05-03 12:53:41 +01:00
|
|
|
|
|
|
|
for (unsigned int nu = 0; nu < env().getNd(); ++nu)
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
out.push_back(getName() + "_" + std::to_string(mu)
|
|
|
|
+ "_" + std::to_string(nu));
|
2017-05-03 12:53:41 +01:00
|
|
|
}
|
2017-04-25 10:04:03 +01:00
|
|
|
}
|
|
|
|
|
2017-03-21 11:39:46 +00:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup ///////////////////////////////////////////////////////////////////////
|
2017-03-27 15:02:16 +01:00
|
|
|
void TScalarVP::setup(void)
|
2017-03-21 11:39:46 +00:00
|
|
|
{
|
2017-06-08 17:43:39 +01:00
|
|
|
freeMomPropName_ = FREEMOMPROP(static_cast<TChargedProp *>(env().getModule(par().scalarProp))->par().mass);
|
|
|
|
GFSrcName_ = "_" + par().scalarProp + "_DinvSrc";
|
|
|
|
prop0Name_ = par().scalarProp + "_0";
|
2017-04-10 16:33:54 +01:00
|
|
|
|
2017-03-27 16:49:18 +01:00
|
|
|
phaseName_.clear();
|
2017-04-10 16:33:54 +01:00
|
|
|
muPropQName_.clear();
|
2017-05-03 12:53:41 +01:00
|
|
|
vpTensorName_.clear();
|
|
|
|
|
2017-03-27 16:49:18 +01:00
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
|
|
|
phaseName_.push_back("_shiftphase_" + std::to_string(mu));
|
2017-04-10 16:33:54 +01:00
|
|
|
muPropQName_.push_back(getName() + "_propQ_" + std::to_string(mu));
|
2017-05-03 12:53:41 +01:00
|
|
|
|
|
|
|
std::vector<std::string> vpTensorName_mu;
|
|
|
|
for (unsigned int nu = 0; nu < env().getNd(); ++nu)
|
|
|
|
{
|
|
|
|
vpTensorName_mu.push_back(getName() + "_" + std::to_string(mu)
|
|
|
|
+ "_" + std::to_string(nu));
|
|
|
|
}
|
|
|
|
vpTensorName_.push_back(vpTensorName_mu);
|
2017-03-27 16:49:18 +01:00
|
|
|
}
|
2017-03-21 11:39:46 +00:00
|
|
|
|
2017-04-10 16:33:54 +01:00
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
2017-05-09 12:46:57 +01:00
|
|
|
env().registerLattice<ScalarField>(muPropQName_[mu]);
|
2017-06-08 17:43:39 +01:00
|
|
|
|
2017-05-03 12:53:41 +01:00
|
|
|
for (unsigned int nu = 0; nu < env().getNd(); ++nu)
|
|
|
|
{
|
|
|
|
env().registerLattice<ScalarField>(vpTensorName_[mu][nu]);
|
|
|
|
}
|
2017-06-08 17:43:39 +01:00
|
|
|
}
|
2017-03-21 11:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// execution ///////////////////////////////////////////////////////////////////
|
2017-03-27 15:02:16 +01:00
|
|
|
void TScalarVP::execute(void)
|
2017-03-21 11:39:46 +00:00
|
|
|
{
|
2017-06-12 18:27:32 +01:00
|
|
|
// Get objects cached by ChargedProp module
|
2017-04-10 16:33:54 +01:00
|
|
|
Complex ci(0.0,1.0);
|
|
|
|
FFT fft(env().getGrid());
|
2017-06-08 17:43:39 +01:00
|
|
|
Real q = static_cast<TChargedProp *>(env().getModule(par().scalarProp))->par().charge;
|
2017-04-10 16:33:54 +01:00
|
|
|
|
2017-06-08 17:43:39 +01:00
|
|
|
freeMomProp_ = env().getObject<ScalarField>(freeMomPropName_);
|
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
2017-04-10 16:33:54 +01:00
|
|
|
{
|
2017-06-08 17:43:39 +01:00
|
|
|
phase_.push_back(env().getObject<ScalarField>(phaseName_[mu]));
|
2017-04-10 16:33:54 +01:00
|
|
|
}
|
2017-06-08 17:43:39 +01:00
|
|
|
GFSrc_ = env().getObject<ScalarField>(GFSrcName_);
|
|
|
|
prop0_ = env().getObject<ScalarField>(prop0Name_);
|
2017-03-21 11:39:46 +00:00
|
|
|
|
2017-04-10 16:33:54 +01:00
|
|
|
// Propagator from unshifted source
|
2017-06-08 17:43:39 +01:00
|
|
|
ScalarField &propQ = *env().getObject<ScalarField>(propQName_);
|
|
|
|
ScalarField &propSun = *env().getObject<ScalarField>(propSunName_);
|
|
|
|
ScalarField &propTad = *env().getObject<ScalarField>(propTadName_);
|
2017-04-10 16:33:54 +01:00
|
|
|
|
|
|
|
// Propagators from shifted sources
|
2017-05-09 12:46:57 +01:00
|
|
|
LOG(Message) << "Computing O(q) charged scalar propagators..."
|
|
|
|
<< std::endl;
|
2017-05-09 11:46:25 +01:00
|
|
|
std::vector<ScalarField> muPropQ;
|
2017-04-10 16:33:54 +01:00
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
2017-05-09 11:46:25 +01:00
|
|
|
muPropQ.push_back(*env().createLattice<ScalarField>(muPropQName_[mu]));
|
2017-04-27 14:17:50 +01:00
|
|
|
|
2017-05-09 11:46:25 +01:00
|
|
|
// -G*momD1*G*F*tau_mu*Src (momD1 = F*D1*Finv)
|
|
|
|
muPropQ[mu] = adj(*phase_[mu])*(*GFSrc_);
|
|
|
|
momD1(muPropQ[mu], fft);
|
|
|
|
muPropQ[mu] = -(*freeMomProp_)*muPropQ[mu];
|
|
|
|
fft.FFT_all_dim(muPropQ[mu], muPropQ[mu], FFT::backward);
|
2017-04-10 16:33:54 +01:00
|
|
|
}
|
2017-04-27 14:17:50 +01:00
|
|
|
|
2017-05-03 12:53:41 +01:00
|
|
|
// CONTRACTIONS
|
2017-05-09 12:46:57 +01:00
|
|
|
ScalarField prop1(env().getGrid()), prop2(env().getGrid());
|
|
|
|
EmField &A = *env().getObject<EmField>(par().emField);
|
2018-01-23 17:07:45 +00:00
|
|
|
ScalarField Amu(env().getGrid()), U_snk(env().getGrid());
|
|
|
|
ScalarField tmp_vp1(env().getGrid()), tmp_vp2(env().getGrid());
|
|
|
|
TComplex Anu0, U_src;
|
2017-05-09 12:46:57 +01:00
|
|
|
std::vector<int> coor0 = {0, 0, 0, 0};
|
2018-01-19 17:14:11 +00:00
|
|
|
std::vector<std::vector<ScalarField> > vpTensor;
|
2017-05-03 12:53:41 +01:00
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
2017-05-05 17:12:41 +01:00
|
|
|
std::vector<ScalarField> vpTensor_mu;
|
2017-05-03 12:53:41 +01:00
|
|
|
for (unsigned int nu = 0; nu < env().getNd(); ++nu)
|
|
|
|
{
|
2017-05-05 17:12:41 +01:00
|
|
|
vpTensor_mu.push_back(*env().createLattice<ScalarField>(vpTensorName_[mu][nu]));
|
2017-05-03 12:53:41 +01:00
|
|
|
}
|
2017-05-05 17:12:41 +01:00
|
|
|
vpTensor.push_back(vpTensor_mu);
|
2017-05-03 12:53:41 +01:00
|
|
|
}
|
2017-05-09 11:46:25 +01:00
|
|
|
|
2017-06-09 18:08:40 +01:00
|
|
|
// Open output files if necessary
|
2018-01-23 17:07:45 +00:00
|
|
|
std::vector<CorrWriter *> writer;
|
2017-11-03 18:46:16 +00:00
|
|
|
std::vector<ScalarField> momphases;
|
2017-06-09 18:08:40 +01:00
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2017-11-03 18:46:16 +00:00
|
|
|
LOG(Message) << "Preparing output files..." << std::endl;
|
2017-06-12 18:27:32 +01:00
|
|
|
for (unsigned int i_p = 0; i_p < par().outputMom.size(); ++i_p)
|
|
|
|
{
|
|
|
|
std::vector<int> mom = strToVec<int>(par().outputMom[i_p]);
|
|
|
|
|
2017-11-03 18:46:16 +00:00
|
|
|
// Open output files
|
2018-01-23 17:07:45 +00:00
|
|
|
std::string filename = par().output + "_"
|
|
|
|
+ std::to_string(mom[0])
|
|
|
|
+ std::to_string(mom[1])
|
|
|
|
+ std::to_string(mom[2]) + "."
|
|
|
|
+ std::to_string(env().getTrajectory());
|
2017-06-12 18:27:32 +01:00
|
|
|
|
2017-11-07 14:46:39 +00:00
|
|
|
if (env().getGrid()->IsBoss())
|
|
|
|
{
|
|
|
|
CorrWriter *writer_i = new CorrWriter(filename);
|
|
|
|
writer.push_back(writer_i);
|
|
|
|
|
|
|
|
write(*writer[i_p], "charge", q);
|
|
|
|
write(*writer[i_p], "mass", static_cast<TChargedProp *>(env().getModule(par().scalarProp))->par().mass);
|
|
|
|
}
|
2017-11-03 18:46:16 +00:00
|
|
|
|
|
|
|
// Calculate phase factors
|
2018-01-23 17:07:45 +00:00
|
|
|
tmp_vp1 = Complex(1.0,0.0);
|
2017-11-03 18:46:16 +00:00
|
|
|
for (unsigned int j = 0; j < env().getNd()-1; ++j)
|
|
|
|
{
|
|
|
|
for (unsigned int momcount = 0; momcount < mom[j]; ++momcount)
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
tmp_vp1 = tmp_vp1*(*phase_[j]);
|
2017-11-03 18:46:16 +00:00
|
|
|
}
|
|
|
|
}
|
2018-01-23 17:07:45 +00:00
|
|
|
tmp_vp1 = adj(tmp_vp1);
|
|
|
|
momphases.push_back(tmp_vp1);
|
2017-06-12 18:27:32 +01:00
|
|
|
}
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
|
|
|
|
2017-06-12 18:27:32 +01:00
|
|
|
// Do contractions
|
2017-05-03 12:53:41 +01:00
|
|
|
for (unsigned int nu = 0; nu < env().getNd(); ++nu)
|
|
|
|
{
|
|
|
|
peekSite(Anu0, peekLorentz(A, nu), coor0);
|
|
|
|
|
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
|
|
|
LOG(Message) << "Computing Pi[" << mu << "][" << nu << "]..."
|
|
|
|
<< std::endl;
|
|
|
|
Amu = peekLorentz(A, mu);
|
2017-05-09 11:46:25 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// free
|
|
|
|
prop1 = *prop0_; // S_0(0|x)
|
|
|
|
prop2 = Cshift(*prop0_, nu, -1); // S_0(0|x-a\hat{\nu})
|
|
|
|
// = S_0(a\hat{\nu}|x)
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, mu);
|
|
|
|
vpTensor[mu][nu] = tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_free_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2018-01-19 17:14:11 +00:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// srcT
|
|
|
|
tmp_vp2 = tmp_vp1 * (-0.5)*q*q*Anu0*Anu0;
|
|
|
|
vpTensor[mu][nu] += tmp_vp2;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp2, momphases,
|
|
|
|
"Pi_srcT_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2017-05-09 11:46:25 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// snkT
|
|
|
|
tmp_vp2 = tmp_vp1 * (-0.5)*q*q*Amu*Amu;
|
|
|
|
vpTensor[mu][nu] += tmp_vp2;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp2, momphases,
|
|
|
|
"Pi_snkT_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2017-05-09 11:46:25 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// S
|
|
|
|
prop1 = *prop0_; // S_0(0|x)
|
|
|
|
prop2 = Cshift(*prop0_, nu, -1); // S_0(a\hat{\nu}|x)
|
|
|
|
U_src = ci*q*Anu0;
|
|
|
|
U_snk = ci*q*Amu;
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, U_snk, mu);
|
|
|
|
vpTensor[mu][nu] += tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_S_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2017-05-09 11:46:25 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// 4C
|
|
|
|
prop1 = q*propQ; // q*S_1(0|x)
|
|
|
|
prop2 = Cshift(*prop0_, nu, -1); // S_0(a\hat{\nu}|x)
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
U_snk = ci*q*Amu;
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, U_snk, mu);
|
|
|
|
U_src = ci*q*Anu0;
|
|
|
|
vpContraction(tmp_vp2, prop1, prop2, U_src, mu);
|
|
|
|
tmp_vp1 += tmp_vp2;
|
|
|
|
prop1 = *prop0_; // S_0(0|x)
|
|
|
|
prop2 = q*muPropQ[nu]; // q*S_1(a\hat{\nu}|x)
|
|
|
|
vpContraction(tmp_vp2, prop1, prop2, U_src, mu);
|
|
|
|
tmp_vp1 += tmp_vp2;
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
U_snk = ci*q*Amu;
|
|
|
|
vpContraction(tmp_vp2, prop1, prop2, U_src, U_snk, mu);
|
|
|
|
tmp_vp1 += tmp_vp2;
|
|
|
|
vpTensor[mu][nu] += tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_4C_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2017-05-03 12:53:41 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// X
|
|
|
|
prop1 = q*propQ; // q*S_1(0|x)
|
|
|
|
prop2 = q*muPropQ[nu]; // q*S_1(a\hat{\nu}|x)
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, mu);
|
|
|
|
vpTensor[mu][nu] += tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
2017-05-03 12:53:41 +01:00
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_X_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
2017-05-09 12:46:57 +01:00
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// 2E
|
|
|
|
prop1 = q*q*propSun; // q^2*S_\Sigma(0|x)
|
|
|
|
prop2 = Cshift(*prop0_, nu, -1); // S_0(a\hat{\nu}|x)
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, mu);
|
|
|
|
prop1 = *prop0_; // S_0(0|x)
|
|
|
|
prop2 = q*q*Cshift(propSun, nu, -1); // q^2*S_\Sigma(0|x-a\hat{\nu})
|
|
|
|
//(Note: <S(0|x-a\hat{\nu})> = <S(a\hat{\nu}|x)>)
|
|
|
|
vpContraction(tmp_vp2, prop1, prop2, U_src, mu);
|
|
|
|
tmp_vp1 += tmp_vp2;
|
|
|
|
vpTensor[mu][nu] += tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_2E_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// 2T
|
|
|
|
prop1 = q*q*propTad; // q^2*S_T(0|x)
|
|
|
|
prop2 = Cshift(*prop0_, nu, -1); // S_0(a\hat{\nu}|x)
|
|
|
|
U_src = Complex(1.0,0.0);
|
|
|
|
vpContraction(tmp_vp1, prop1, prop2, U_src, mu);
|
|
|
|
prop1 = *prop0_; // S_0(0|x)
|
|
|
|
prop2 = q*q*Cshift(propTad, nu, -1); // q^2*S_T(0|x-a\hat{\nu})
|
|
|
|
vpContraction(tmp_vp2, prop1, prop2, U_src, mu);
|
|
|
|
tmp_vp1 += tmp_vp2;
|
|
|
|
vpTensor[mu][nu] += tmp_vp1;
|
2017-06-09 18:08:40 +01:00
|
|
|
// Output if necessary
|
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, tmp_vp1, momphases,
|
|
|
|
"Pi_2T_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-06-09 18:08:40 +01:00
|
|
|
}
|
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
// Output full VP if necessary
|
2017-06-09 18:08:40 +01:00
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
2018-01-23 17:07:45 +00:00
|
|
|
writeVP(writer, vpTensor[mu][nu], momphases,
|
|
|
|
"Pi_"+std::to_string(mu)+"_"+std::to_string(nu));
|
2017-05-03 12:53:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-12 18:27:32 +01:00
|
|
|
if (!par().output.empty())
|
|
|
|
{
|
|
|
|
for (unsigned int i_p = 0; i_p < par().outputMom.size(); ++i_p)
|
|
|
|
{
|
2017-11-07 14:46:39 +00:00
|
|
|
if (env().getGrid()->IsBoss())
|
|
|
|
{
|
|
|
|
delete writer[i_p];
|
|
|
|
}
|
2017-06-12 18:27:32 +01:00
|
|
|
}
|
|
|
|
}
|
2017-04-10 16:33:54 +01:00
|
|
|
}
|
|
|
|
|
2018-01-23 17:07:45 +00:00
|
|
|
void TScalarVP::vpContraction(ScalarField &vp,
|
|
|
|
ScalarField &prop_0_x, ScalarField &prop_nu_x,
|
|
|
|
TComplex u_src, ScalarField &u_snk, int mu)
|
|
|
|
{
|
|
|
|
// Note: this function assumes a point source is used.
|
|
|
|
vp = adj(prop_nu_x) * u_snk * Cshift(prop_0_x, mu, 1) * u_src;
|
|
|
|
vp -= Cshift(adj(prop_nu_x), mu, 1) * adj(u_snk) * prop_0_x * u_src;
|
|
|
|
vp = 2.0*real(vp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TScalarVP::vpContraction(ScalarField &vp,
|
|
|
|
ScalarField &prop_0_x, ScalarField &prop_nu_x,
|
|
|
|
TComplex u_src, int mu)
|
|
|
|
{
|
|
|
|
// Note: this function assumes a point source is used.
|
|
|
|
vp = adj(prop_nu_x) * Cshift(prop_0_x, mu, 1) * u_src;
|
|
|
|
vp -= Cshift(adj(prop_nu_x), mu, 1) * prop_0_x * u_src;
|
|
|
|
vp = 2.0*real(vp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TScalarVP::writeVP(const std::vector<CorrWriter *> &writers, const ScalarField &vp,
|
|
|
|
const std::vector<ScalarField> &momphases, std::string dsetName)
|
|
|
|
{
|
|
|
|
std::vector<TComplex> vecBuf;
|
|
|
|
std::vector<Complex> result;
|
|
|
|
ScalarField vpPhase(env().getGrid());
|
|
|
|
|
|
|
|
for (unsigned int i_p = 0; i_p < momphases.size(); ++i_p)
|
|
|
|
{
|
|
|
|
vpPhase = vp*momphases[i_p];
|
|
|
|
sliceSum(vpPhase, vecBuf, Tp);
|
|
|
|
result.resize(vecBuf.size());
|
|
|
|
for (unsigned int t = 0; t < vecBuf.size(); ++t)
|
|
|
|
{
|
|
|
|
result[t] = TensorRemove(vecBuf[t]);
|
|
|
|
}
|
|
|
|
if (env().getGrid()->IsBoss())
|
|
|
|
{
|
|
|
|
write(*writers[i_p], dsetName, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-10 16:33:54 +01:00
|
|
|
void TScalarVP::momD1(ScalarField &s, FFT &fft)
|
2017-03-27 16:49:18 +01:00
|
|
|
{
|
2017-04-10 16:33:54 +01:00
|
|
|
EmField &A = *env().getObject<EmField>(par().emField);
|
2017-03-27 16:49:18 +01:00
|
|
|
ScalarField buf(env().getGrid()), result(env().getGrid()),
|
|
|
|
Amu(env().getGrid());
|
|
|
|
Complex ci(0.0,1.0);
|
|
|
|
|
|
|
|
result = zero;
|
|
|
|
|
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
|
|
|
Amu = peekLorentz(A, mu);
|
|
|
|
buf = (*phase_[mu])*s;
|
|
|
|
fft.FFT_all_dim(buf, buf, FFT::backward);
|
|
|
|
buf = Amu*buf;
|
|
|
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
|
|
|
result = result - ci*buf;
|
|
|
|
}
|
|
|
|
fft.FFT_all_dim(s, s, FFT::backward);
|
|
|
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
|
|
|
{
|
|
|
|
Amu = peekLorentz(A, mu);
|
|
|
|
buf = Amu*s;
|
|
|
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
|
|
|
result = result + ci*adj(*phase_[mu])*buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = result;
|
|
|
|
}
|