From b7f90aa011d17357df3bf3a82e2433f0f51c4f54 Mon Sep 17 00:00:00 2001 From: Lanny91 Date: Fri, 13 Jan 2017 15:54:19 +0000 Subject: [PATCH] Added momentum choice for wall source --- extras/Hadrons/Modules/MSource/Wall.hpp | 37 +++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/extras/Hadrons/Modules/MSource/Wall.hpp b/extras/Hadrons/Modules/MSource/Wall.hpp index 7a491fd2..c299a7bf 100644 --- a/extras/Hadrons/Modules/MSource/Wall.hpp +++ b/extras/Hadrons/Modules/MSource/Wall.hpp @@ -7,6 +7,19 @@ BEGIN_HADRONS_NAMESPACE +/* + + Wall source + ----------------------------- + * src_x = theta(x_3 - tA) * theta(tB - x_3) * exp(i x.mom) + + * options: + - tA: begin timeslice (integer) + - tB: end timeslice (integer) + - mom: momentum insertion, space-separated float sequence (e.g ".1 .2 1. 0.") + + */ + /****************************************************************************** * Wall * ******************************************************************************/ @@ -16,7 +29,8 @@ class WallPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(WallPar, - unsigned int, tW); + unsigned int, tW, + std::string, mom); }; template @@ -76,14 +90,27 @@ void TWall::setup(void) // execution /////////////////////////////////////////////////////////////////// template void TWall::execute(void) -{ - Lattice> t(env().getGrid()); +{ + LOG(Message) << "Generating wall source at t = " << par().tW + << " with momentum " << par().mom << std::endl; - LOG(Message) << "Generating wall source at t = " << par().tW << std::endl; PropagatorField &src = *env().template createLattice(getName()); + Lattice> t(env().getGrid()); + LatticeComplex ph(env().getGrid()), coor(env().getGrid()); + std::vector p; + Complex i(0.0,1.0); + + p = strToVec(par().mom); + ph = zero; + for(unsigned int mu = 0; mu < Nd; mu++) + { + LatticeCoordinate(coor, mu); + ph = ph + p[mu]*coor; + } + ph = exp(i*ph); LatticeCoordinate(t, Tp); src = 1.; - src = where((t == par().tW), src, 0.*src); + src = where((t == par().tW), src*ph, 0.*src); } END_MODULE_NAMESPACE