1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-04 19:25:56 +01:00

Scalar: more action generalisation

This commit is contained in:
Antonin Portelli 2017-10-03 14:26:20 +01:00
parent a021933002
commit 05c1c88440

View File

@ -46,6 +46,7 @@ public:
private:
RealD mass_square;
RealD lambda;
RealD g;
const unsigned int N = Impl::Group::Dimension;
typedef typename Field::vector_object vobj;
@ -57,7 +58,7 @@ private:
std::vector<int> displacements; // = {1,1,1,1, -1,-1,-1,-1};
public:
ScalarInteractionAction(RealD ms, RealD l) : mass_square(ms), lambda(l), displacements(2 * Ndim, 0), directions(2 * Ndim, 0)
ScalarInteractionAction(RealD ms, RealD l, RealD gval) : mass_square(ms), lambda(l), g(gval), displacements(2 * Ndim, 0), directions(2 * Ndim, 0)
{
for (int mu = 0; mu < Ndim; mu++)
{
@ -73,6 +74,7 @@ public:
std::stringstream sstream;
sstream << GridLogMessage << "[ScalarAction] lambda : " << lambda << std::endl;
sstream << GridLogMessage << "[ScalarAction] mass_square : " << mass_square << std::endl;
sstream << GridLogMessage << "[ScalarAction] g : " << g << std::endl;
return sstream.str();
}
@ -86,8 +88,8 @@ public:
static Stencil phiStencil(p._grid, npoint, 0, directions, displacements);
phiStencil.HaloExchange(p, compressor);
Field action(p._grid), pshift(p._grid), phisquared(p._grid);
phisquared = p*p;
action = (2.*Ndim + mass_square) * phisquared - phisquared * phisquared;
phisquared = p * p;
action = (2.0 * Ndim + mass_square) * phisquared - lambda * phisquared * phisquared;
for (int mu = 0; mu < Ndim; mu++)
{
// pshift = Cshift(p, mu, +1); // not efficient, implement with stencils
@ -122,13 +124,13 @@ public:
}
// NB the trace in the algebra is normalised to 1/2
// minus sign coming from the antihermitian fields
return -(TensorRemove(sum(trace(action)))).real()*N/lambda;
return -(TensorRemove(sum(trace(action)))).real()*N/g;
};
virtual void deriv(const Field &p, Field &force)
{
assert(p._grid->Nd() == Ndim);
force = (2.0 * Ndim + mass_square) * p - 2. * p * p * p;
force = (2. * Ndim + mass_square) * p - 2. * lambda * p * p * p;
// move this outside
static Stencil phiStencil(p._grid, npoint, 0, directions, displacements);
phiStencil.HaloExchange(p, compressor);
@ -163,7 +165,7 @@ public:
}
}
}
force *= N/lambda;
force *= N/g;
}
};