mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Added momentum scaling to scalar HMC theories in order to follow UKQCD/CPS conventions
This commit is contained in:
parent
05ebc458e2
commit
2c22db841a
@ -1,5 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define CPS_MD_TIME
|
||||||
|
|
||||||
|
#ifdef CPS_MD_TIME
|
||||||
|
#define HMC_MOMENTUM_DENOMINATOR (2.0)
|
||||||
|
#else
|
||||||
|
#define HMC_MOMENTUM_DENOMINATOR (1.0)
|
||||||
|
#endif
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@ -20,13 +28,17 @@ public:
|
|||||||
typedef Field PropagatorField;
|
typedef Field PropagatorField;
|
||||||
|
|
||||||
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){
|
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){
|
||||||
|
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR);
|
||||||
|
// CPS and UKQCD conventions not yet implemented for U(1) scalars.
|
||||||
gaussian(pRNG, P);
|
gaussian(pRNG, P);
|
||||||
|
P *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field& P){return P;}
|
static inline Field projectForce(Field& P){return P;}
|
||||||
|
|
||||||
static inline void update_field(Field& P, Field& U, double ep) {
|
static inline void update_field(Field& P, Field& U, double ep) {
|
||||||
U += P*ep;
|
U += P*ep;
|
||||||
|
std::cout << "Field updated. Epsilon = " << std::setprecision(10) << ep << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RealD FieldSquareNorm(Field& U) {
|
static inline RealD FieldSquareNorm(Field& U) {
|
||||||
@ -139,14 +151,17 @@ public:
|
|||||||
|
|
||||||
static inline void generate_momenta(Field &P, GridParallelRNG &pRNG)
|
static inline void generate_momenta(Field &P, GridParallelRNG &pRNG)
|
||||||
{
|
{
|
||||||
|
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR); // Being consistent with CPS and UKQCD conventions
|
||||||
#ifndef USE_FFT_ACCELERATION
|
#ifndef USE_FFT_ACCELERATION
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Field Pgaussian(P.Grid()), Pp(P.Grid());
|
Field Pgaussian(P.Grid()), Pp(P.Grid());
|
||||||
ComplexField p2(P.Grid()); p2 = zero;
|
ComplexField p2(P.Grid()); p2 = zero;
|
||||||
RealD M = FFT_MASS;
|
RealD M = FFT_MASS;
|
||||||
|
|
||||||
|
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pgaussian);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pgaussian);
|
||||||
|
|
||||||
FFT theFFT((GridCartesian*)P.Grid());
|
FFT theFFT((GridCartesian*)P.Grid());
|
||||||
@ -156,8 +171,8 @@ public:
|
|||||||
p2 = sqrt(p2);
|
p2 = sqrt(p2);
|
||||||
Pp *= p2;
|
Pp *= p2;
|
||||||
theFFT.FFT_all_dim(P, Pp, FFT::backward);
|
theFFT.FFT_all_dim(P, Pp, FFT::backward);
|
||||||
|
|
||||||
#endif //USE_FFT_ACCELERATION
|
#endif //USE_FFT_ACCELERATION
|
||||||
|
P *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field& P) {return P;}
|
static inline Field projectForce(Field& P) {return P;}
|
||||||
@ -167,6 +182,7 @@ public:
|
|||||||
#ifndef USE_FFT_ACCELERATION
|
#ifndef USE_FFT_ACCELERATION
|
||||||
double t0=usecond();
|
double t0=usecond();
|
||||||
U += P*ep;
|
U += P*ep;
|
||||||
|
std::cout << "Field updated. Epsilon = " << std::setprecision(10) << ep << std::endl;
|
||||||
double t1=usecond();
|
double t1=usecond();
|
||||||
double total_time = (t1-t0)/1e6;
|
double total_time = (t1-t0)/1e6;
|
||||||
std::cout << GridLogIntegrator << "Total time for updating field (s) : " << total_time << std::endl;
|
std::cout << GridLogIntegrator << "Total time for updating field (s) : " << total_time << std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user