2017-01-26 15:24:49 +00:00
|
|
|
#ifndef SCALAR_IMPL
|
|
|
|
#define SCALAR_IMPL
|
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
NAMESPACE_BEGIN(Grid);
|
2017-01-26 15:24:49 +00:00
|
|
|
|
2017-03-14 05:55:18 +00:00
|
|
|
template <class S>
|
|
|
|
class ScalarImplTypes {
|
2018-01-14 22:39:24 +00:00
|
|
|
public:
|
|
|
|
typedef S Simd;
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
template <typename vtype>
|
|
|
|
using iImplField = iScalar<iScalar<iScalar<vtype> > >;
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
typedef iImplField<Simd> SiteField;
|
|
|
|
typedef SiteField SitePropagator;
|
|
|
|
typedef SiteField SiteComplex;
|
2017-01-26 15:24:49 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
typedef Lattice<SiteField> Field;
|
|
|
|
typedef Field ComplexField;
|
|
|
|
typedef Field FermionField;
|
|
|
|
typedef Field PropagatorField;
|
2017-01-26 15:24:49 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){
|
|
|
|
gaussian(pRNG, P);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline Field projectForce(Field& P){return P;}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void update_field(Field& P, Field& U, double ep) {
|
|
|
|
U += P*ep;
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline RealD FieldSquareNorm(Field& U) {
|
|
|
|
return (- sum(trace(U*U))/2.0);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
gaussian(pRNG, U);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
gaussian(pRNG, U);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
U = 1.0;
|
|
|
|
}
|
2017-01-26 15:24:49 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static void MomentumSpacePropagator(Field &out, RealD m)
|
|
|
|
{
|
|
|
|
GridBase *grid = out._grid;
|
|
|
|
Field kmu(grid), one(grid);
|
|
|
|
const unsigned int nd = grid->_ndimension;
|
|
|
|
std::vector<int> &l = grid->_fdimensions;
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
one = Complex(1.0,0.0);
|
|
|
|
out = m*m;
|
|
|
|
for(int mu = 0; mu < nd; mu++)
|
2017-06-05 22:37:47 +01:00
|
|
|
{
|
|
|
|
Real twoPiL = M_PI*2./l[mu];
|
|
|
|
|
|
|
|
LatticeCoordinate(kmu,mu);
|
|
|
|
kmu = 2.*sin(.5*twoPiL*kmu);
|
|
|
|
out = out + kmu*kmu;
|
|
|
|
}
|
2018-01-14 22:39:24 +00:00
|
|
|
out = one/out;
|
|
|
|
}
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static void FreePropagator(const Field &in, Field &out,
|
|
|
|
const Field &momKernel)
|
|
|
|
{
|
|
|
|
FFT fft((GridCartesian *)in._grid);
|
|
|
|
Field inFT(in._grid);
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
fft.FFT_all_dim(inFT, in, FFT::forward);
|
|
|
|
inFT = inFT*momKernel;
|
|
|
|
fft.FFT_all_dim(out, inFT, FFT::backward);
|
|
|
|
}
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static void FreePropagator(const Field &in, Field &out, RealD m)
|
|
|
|
{
|
|
|
|
Field momKernel(in._grid);
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
MomentumSpacePropagator(momKernel, m);
|
|
|
|
FreePropagator(in, out, momKernel);
|
|
|
|
}
|
2017-06-05 22:37:47 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
};
|
2017-02-09 15:18:38 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
template <class S, unsigned int N>
|
|
|
|
class ScalarAdjMatrixImplTypes {
|
|
|
|
public:
|
|
|
|
typedef S Simd;
|
2018-01-15 09:37:58 +00:00
|
|
|
typedef SU<N> Group;
|
2017-06-24 23:04:05 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
template <typename vtype>
|
|
|
|
using iImplField = iScalar<iScalar<iMatrix<vtype, N>>>;
|
|
|
|
template <typename vtype>
|
|
|
|
using iImplComplex = iScalar<iScalar<iScalar<vtype>>>;
|
|
|
|
|
|
|
|
typedef iImplField<Simd> SiteField;
|
|
|
|
typedef SiteField SitePropagator;
|
|
|
|
typedef iImplComplex<Simd> SiteComplex;
|
2017-06-20 17:24:55 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
typedef Lattice<SiteField> Field;
|
|
|
|
typedef Lattice<SiteComplex> ComplexField;
|
|
|
|
typedef Field FermionField;
|
|
|
|
typedef Field PropagatorField;
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG) {
|
|
|
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline Field projectForce(Field& P) {return P;}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void update_field(Field& P, Field& U, double ep) {
|
|
|
|
U += P*ep;
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline RealD FieldSquareNorm(Field& U) {
|
|
|
|
return (TensorRemove(sum(trace(U*U))).real());
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U, 0.01);
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
|
|
|
U = zero;
|
|
|
|
}
|
2017-03-14 05:55:18 +00:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
};
|
2017-02-09 15:18:38 +00:00
|
|
|
|
|
|
|
|
2017-03-14 05:55:18 +00:00
|
|
|
|
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
typedef ScalarImplTypes<vReal> ScalarImplR;
|
|
|
|
typedef ScalarImplTypes<vRealF> ScalarImplF;
|
|
|
|
typedef ScalarImplTypes<vRealD> ScalarImplD;
|
|
|
|
typedef ScalarImplTypes<vComplex> ScalarImplCR;
|
|
|
|
typedef ScalarImplTypes<vComplexF> ScalarImplCF;
|
|
|
|
typedef ScalarImplTypes<vComplexD> ScalarImplCD;
|
2017-06-16 17:59:55 +01:00
|
|
|
|
2018-01-14 22:39:24 +00:00
|
|
|
// Hardcoding here the size of the matrices
|
2018-01-15 09:37:58 +00:00
|
|
|
typedef ScalarAdjMatrixImplTypes<vComplex, Nc> ScalarAdjImplR;
|
|
|
|
typedef ScalarAdjMatrixImplTypes<vComplexF, Nc> ScalarAdjImplF;
|
|
|
|
typedef ScalarAdjMatrixImplTypes<vComplexD, Nc> ScalarAdjImplD;
|
2018-01-14 22:39:24 +00:00
|
|
|
|
|
|
|
template <int Colours > using ScalarNxNAdjImplR = ScalarAdjMatrixImplTypes<vComplex, Colours >;
|
|
|
|
template <int Colours > using ScalarNxNAdjImplF = ScalarAdjMatrixImplTypes<vComplexF, Colours >;
|
|
|
|
template <int Colours > using ScalarNxNAdjImplD = ScalarAdjMatrixImplTypes<vComplexD, Colours >;
|
|
|
|
|
|
|
|
NAMESPACE_END(Grid);
|
2017-01-26 15:24:49 +00:00
|
|
|
|
|
|
|
#endif
|