1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 01:05:38 +01:00

Consolidating HMC interface

Uniformed interface for standard action in fundamental rep and Hirep
This commit is contained in:
Guido Cossu 2016-09-23 10:47:42 +01:00
parent 510e340e16
commit c4ac6e7e8f
7 changed files with 22 additions and 43 deletions

View File

@ -45,27 +45,6 @@ class Action {
virtual ~Action(){};
};
// Could derive PseudoFermion action with a PF field, FermionField, and a Grid;
// implement refresh
/*
template<class GaugeField, class FermionField>
class PseudoFermionAction : public Action<GaugeField> {
public:
FermionField Phi;
GridParallelRNG &pRNG;
GridBase &Grid;
PseudoFermionAction(GridBase &_Grid,GridParallelRNG &_pRNG) : Grid(_Grid),
Phi(&_Grid), pRNG(_pRNG) {
};
virtual void refresh(const GaugeField &gauge) {
gaussian(Phi,pRNG);
};
};
*/
// Indexing of tuple types
template <class T, class Tuple>
struct Index;
@ -80,6 +59,7 @@ struct Index<T, std::tuple<U, Types...>> {
static const std::size_t value = 1 + Index<T, std::tuple<Types...>>::value;
};
/*
template <class GaugeField>
struct ActionLevel {
public:
@ -99,10 +79,10 @@ struct ActionLevel {
void push_back(ActPtr ptr) { actions.push_back(ptr); }
};
*/
template <class GaugeField, class Repr>
struct ActionLevelHirep {
template <class GaugeField, class Repr = NoHirep >
struct ActionLevel {
public:
unsigned int multiplier;
@ -118,9 +98,9 @@ struct ActionLevelHirep {
std::vector<ActPtr>& actions;
// Temporary conversion between ActionLevel and ActionLevelHirep
ActionLevelHirep(ActionLevel<GaugeField>& AL ):actions(AL.actions), multiplier(AL.multiplier){}
//ActionLevelHirep(ActionLevel<GaugeField>& AL ):actions(AL.actions), multiplier(AL.multiplier){}
ActionLevelHirep(unsigned int mul = 1) : actions(std::get<0>(actions_hirep)), multiplier(mul) {
ActionLevel(unsigned int mul = 1) : actions(std::get<0>(actions_hirep)), multiplier(mul) {
// initialize the hirep vectors to zero.
//apply(this->resize, actions_hirep, 0); //need a working resize
assert(mul >= 1);
@ -162,11 +142,11 @@ struct ActionLevelHirep {
};
template <class GaugeField>
using ActionSet = std::vector<ActionLevel<GaugeField> >;
//template <class GaugeField>
//using ActionSet = std::vector<ActionLevel<GaugeField> >;
template <class GaugeField, class R>
using ActionSetHirep = std::vector<ActionLevelHirep<GaugeField, R> >;
using ActionSet = std::vector<ActionLevel<GaugeField, R> >;
}
}

View File

@ -39,7 +39,7 @@ class NerscHmcRunnerTemplate {
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
ActionSetHirep<GaugeField, RepresentationsPolicy> TheAction;
ActionSet<GaugeField, RepresentationsPolicy> TheAction;
GridCartesian *UGrid;
GridCartesian *FGrid;

View File

@ -71,7 +71,7 @@ class Integrator {
IntegratorParameters Params;
const ActionSetHirep<GaugeField, RepresentationPolicy> as;
const ActionSet<GaugeField, RepresentationPolicy> as;
int levels; //
double t_U; // Track time passing on each level and for U and for P
@ -180,7 +180,7 @@ class Integrator {
public:
Integrator(GridBase* grid, IntegratorParameters Par,
ActionSetHirep<GaugeField, RepresentationPolicy>& Aset,
ActionSet<GaugeField, RepresentationPolicy>& Aset,
SmearingPolicy& Sm)
: Params(Par),
as(Aset),

View File

@ -101,7 +101,7 @@ namespace Grid{
LeapFrog(GridBase* grid,
IntegratorParameters Par,
ActionSet<GaugeField> & Aset,
ActionSet<GaugeField, RepresentationPolicy> & Aset,
SmearingPolicy & Sm):
Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset,Sm) {};
@ -151,7 +151,7 @@ namespace Grid{
MinimumNorm2(GridBase* grid,
IntegratorParameters Par,
ActionSetHirep<GaugeField, RepresentationPolicy> & Aset,
ActionSet<GaugeField, RepresentationPolicy> & Aset,
SmearingPolicy& Sm):
Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset,Sm) {};
@ -215,7 +215,7 @@ namespace Grid{
// Looks like dH scales as dt^4. tested wilson/wilson 2 level.
ForceGradient(GridBase* grid,
IntegratorParameters Par,
ActionSet<GaugeField> & Aset,
ActionSet<GaugeField, RepresentationPolicy> & Aset,
SmearingPolicy &Sm):
Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset, Sm) {};

View File

@ -40,7 +40,6 @@ namespace QCD {
// Here change the allowed (higher) representations
typedef Representations< FundamentalRepresentation, AdjointRepresentation > TheRepresentations;
//typedef Representations< FundamentalRepresentation > TheRepresentations;
class HmcRunner : public NerscHmcRunnerHirep< TheRepresentations > {
@ -80,10 +79,10 @@ class HmcRunner : public NerscHmcRunnerHirep< TheRepresentations > {
Nf2.is_smeared = false;
// Collect actions
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level1(1);
ActionLevel<LatticeGaugeField, TheRepresentations > Level1(1);
Level1.push_back(&Nf2);
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level2(4);
ActionLevel<LatticeGaugeField, TheRepresentations > Level2(4);
Level2.push_back(&Waction);
TheAction.push_back(Level1);

View File

@ -69,7 +69,7 @@ class HmcRunner : public NerscHmcRunnerHirep< TheRepresentations > {
TwoIndexSymmetricRepresentation::LatticeField US(UGrid);
// Gauge action
WilsonGaugeActionR Waction(2.25);
WilsonGaugeActionR Waction(5.6);
Real adjoint_mass = -0.1;
Real symm_mass = -0.5;
@ -84,11 +84,11 @@ class HmcRunner : public NerscHmcRunnerHirep< TheRepresentations > {
TwoFlavourPseudoFermionAction<SymmImplPolicy> Nf2_Symm(SymmFermOp, CG_symm, CG_symm);
// Collect actions
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level1(1);
ActionLevel<LatticeGaugeField, TheRepresentations > Level1(1);
Level1.push_back(&Nf2_Adj);
Level1.push_back(&Nf2_Symm);
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level2(4);
ActionLevel<LatticeGaugeField, TheRepresentations > Level2(4);
Level2.push_back(&Waction);
TheAction.push_back(Level1);

View File

@ -75,10 +75,10 @@ class HmcRunner : public NerscHmcRunnerHirep< TheRepresentations > {
Nf2.is_smeared = false;
// Collect actions
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level1(1);
ActionLevel<LatticeGaugeField, TheRepresentations > Level1(1);
Level1.push_back(&Nf2);
ActionLevelHirep<LatticeGaugeField, TheRepresentations > Level2(4);
ActionLevel<LatticeGaugeField, TheRepresentations > Level2(4);
Level2.push_back(&Waction);
TheAction.push_back(Level1);