1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

MSource::Gauss fix sign in exponent of normalization + use correct types

This commit is contained in:
Nils Asmussen 2019-06-02 11:52:05 +01:00
parent 7c3f400fc5
commit fc6e584f2c

View File

@ -115,6 +115,8 @@ void TGauss<FImpl>::execute(void)
const Real fact=-0.5/std::pow(par().width,2);
const Complex i(0.0, 1.0);
const SitePropagator idMat=[](){ SitePropagator s; s=1.; return s; }();
const vTInteger vTtA=par().tA;
const vTInteger vTtB=par().tB;
ScalarRho=zero;
for(int mu=0; mu<dim; mu++) {
@ -154,11 +156,18 @@ void TGauss<FImpl>::execute(void)
//time component of momentum phase
LatticeCoordinate(component, dim);
ScalarRho+=(i*(mom_.at(dim)*2*M_PI/env().getDim(dim)))*component;
ScalarRho=where((component>=par().tA && component<=tB),
//compute scalar result
ScalarRho=exp(ScalarRho)*Complex(std::pow(sqrt(2*M_PI)*par().width,-dim));
//select time slices
LatticeCoordinate(compHelper, dim);
ScalarRho=where((compHelper>=vTtA && compHelper<=vTtB),
ScalarRho,
0.*ScalarRho);
rho=(exp(ScalarRho)*Complex(std::pow(sqrt(2*M_PI)*par().width,dim)))*idMat;
//compute output field rho
rho=ScalarRho*idMat;
}
END_MODULE_NAMESPACE