1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00

Added HMC utitities for the higher representations

TODO: Inherit types for the pseudofermions, Debugging, testing
This commit is contained in:
Guido Cossu
2016-07-15 13:39:47 +01:00
parent 9dc345e8e8
commit 7edf4c6c04
10 changed files with 201 additions and 80 deletions

View File

@ -32,14 +32,14 @@ directory
namespace Grid {
namespace QCD {
template <class Gimpl>
template <class Gimpl, class RepresentationsPolicy = NoHirep >
class NerscHmcRunnerTemplate {
public:
INHERIT_GIMPL_TYPES(Gimpl);
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
ActionSet<GaugeField> TheAction;
ActionSetHirep<GaugeField, RepresentationsPolicy> TheAction;
GridCartesian *UGrid;
GridCartesian *FGrid;
@ -111,7 +111,7 @@ class NerscHmcRunnerTemplate {
SmearedConfiguration<Gimpl> SmearingPolicy(UGrid, Nsmear, Stout);
std::cout << GridLogDebug << " done\n";
//////////////
typedef MinimumNorm2<GaugeField, SmearedConfiguration<Gimpl> >
typedef MinimumNorm2<GaugeField, SmearedConfiguration<Gimpl>, RepresentationsPolicy >
IntegratorType; // change here to change the algorithm
IntegratorParameters MDpar(20);
IntegratorType MDynamics(UGrid, MDpar, TheAction, SmearingPolicy);
@ -177,6 +177,12 @@ typedef NerscHmcRunnerTemplate<PeriodicGimplD> PeriodicNerscHmcRunnerD;
typedef NerscHmcRunnerTemplate<ConjugateGimplR> ConjugateNerscHmcRunner;
typedef NerscHmcRunnerTemplate<ConjugateGimplF> ConjugateNerscHmcRunnerF;
typedef NerscHmcRunnerTemplate<ConjugateGimplD> ConjugateNerscHmcRunnerD;
template <class RepresentationsPolicy>
using NerscHmcRunnerHirep = NerscHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
}
}
#endif

View File

@ -71,7 +71,7 @@ class Integrator {
IntegratorParameters Params;
const ActionSet<GaugeField> as;
const ActionSetHirep<GaugeField, RepresentationPolicy> as;
int levels; //
double t_U; // Track time passing on each level and for U and for P
@ -113,7 +113,7 @@ class Integrator {
// to be used by the actionlevel class to iterate
// over the representations
template <class Level>
void update_P_core(Level repr_level, GaugeField& Mom, GaugeField& U,
void update_P_hireps(Level repr_level, GaugeField& Mom, GaugeField& U,
double ep) {
typedef typename Level::LatticeField FieldType;
FieldType Ur = repr_level->getRepresentation();// update U is better
@ -128,10 +128,10 @@ class Integrator {
Mom -= force * ep;
}
}
// Add the specialized class for the fundamental case
void update_P(GaugeField& Mom, GaugeField& U, int level, double ep) {
// input U actually not used in the fundamental case
// Fundamental updates, include smearing
for (int a = 0; a < as[level].actions.size(); ++a) {
GaugeField force(U._grid);
GaugeField& Us = Smearer.get_U(as[level].actions.at(a)->is_smeared);
@ -148,7 +148,7 @@ class Integrator {
Mom -= force * ep;
}
// Add here the other representations
// as[level].apply(update_P_hireps, Args...)
//apply(update_P_hireps, as[level], Args...)
}
void update_U(GaugeField& U, double ep) {
@ -179,7 +179,7 @@ class Integrator {
public:
Integrator(GridBase* grid, IntegratorParameters Par,
ActionSet<GaugeField>& Aset, SmearingPolicy& Sm)
ActionSetHirep<GaugeField, RepresentationPolicy>& Aset, SmearingPolicy& Sm)
: Params(Par), as(Aset), P(grid), levels(Aset.size()), Smearer(Sm), Representations(grid) {
t_P.resize(levels, 0.0);
t_U = 0.0;

View File

@ -151,7 +151,7 @@ namespace Grid{
MinimumNorm2(GridBase* grid,
IntegratorParameters Par,
ActionSet<GaugeField> & Aset,
ActionSetHirep<GaugeField, RepresentationPolicy> & Aset,
SmearingPolicy& Sm):
Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset,Sm) {};