mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 20:57:06 +01:00
Charge conjugation boundary conditions for gauge fields implemented as a policy
class, changing the nature of covariant Cshifts used in plaquettes, rectangles and staples. As a result same code is used for the plaq and rect action independent of the BC type. Should probably isolate the BC in a separate class that Gimpl takes as a template param. Do the same with smearing policies. This would then allow composition of BC with smearing etc....
This commit is contained in:
@ -39,11 +39,12 @@ namespace Grid{
|
||||
virtual void TrajectoryComplete (int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )=0;
|
||||
};
|
||||
|
||||
template<class GaugeField>
|
||||
class PlaquetteLogger : public HmcObservable<GaugeField> {
|
||||
template<class Gimpl>
|
||||
class PlaquetteLogger : public HmcObservable<typename Gimpl::GaugeField> {
|
||||
private:
|
||||
std::string Stem;
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
PlaquetteLogger(std::string cf) {
|
||||
Stem = cf;
|
||||
};
|
||||
@ -52,11 +53,16 @@ namespace Grid{
|
||||
{
|
||||
std::string file; { std::ostringstream os; os << Stem <<"."<< traj; file = os.str(); }
|
||||
std::ofstream of(file);
|
||||
RealD plaq = WilsonLoops<GaugeField>::avgPlaquette(U);
|
||||
RealD rect = WilsonLoops<GaugeField>::avgRectangle(U);
|
||||
of << plaq << " " << rect << std::endl;
|
||||
std::cout<< GridLogMessage<< "Plaquette for trajectory "<< traj << " is " << plaq <<std::endl;
|
||||
std::cout<< GridLogMessage<< "Rectangle for trajectory "<< traj << " is " << rect <<std::endl;
|
||||
|
||||
RealD peri_plaq = WilsonLoops<PeriodicGimplR>::avgPlaquette(U);
|
||||
RealD peri_rect = WilsonLoops<PeriodicGimplR>::avgRectangle(U);
|
||||
|
||||
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(U);
|
||||
RealD impl_rect = WilsonLoops<Gimpl>::avgRectangle(U);
|
||||
|
||||
of << traj<<" "<< impl_plaq << " " << impl_rect << " "<< peri_plaq<<" "<<peri_rect<<std::endl;
|
||||
std::cout<< GridLogMessage<< "traj"<<" "<< "plaq " << " " << " rect " << " "<< "peri_plaq" <<" "<<"peri_rect"<<std::endl;
|
||||
std::cout<< GridLogMessage<< traj<<" "<< impl_plaq << " " << impl_rect << " "<< peri_plaq<<" "<<peri_rect<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5,12 +5,15 @@ namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
|
||||
class NerscHmcRunner {
|
||||
template<class Gimpl>
|
||||
class NerscHmcRunnerTemplate {
|
||||
public:
|
||||
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
|
||||
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
||||
|
||||
ActionSet<LatticeGaugeField> TheAction;
|
||||
ActionSet<GaugeField> TheAction;
|
||||
|
||||
GridCartesian * UGrid ;
|
||||
GridCartesian * FGrid ;
|
||||
@ -52,13 +55,13 @@ public:
|
||||
}
|
||||
|
||||
// Create integrator
|
||||
typedef MinimumNorm2<LatticeGaugeField> IntegratorType;// change here to change the algorithm
|
||||
typedef MinimumNorm2<GaugeField> IntegratorType;// change here to change the algorithm
|
||||
IntegratorParameters MDpar(20);
|
||||
IntegratorType MDynamics(UGrid,MDpar, TheAction);
|
||||
|
||||
// Checkpoint strategy
|
||||
NerscHmcCheckpointer<LatticeGaugeField> Checkpoint(std::string("ckpoint_lat"),std::string("ckpoint_rng"),1);
|
||||
PlaquetteLogger<LatticeGaugeField> PlaqLog(std::string("plaq"));
|
||||
NerscHmcCheckpointer<Gimpl> Checkpoint(std::string("ckpoint_lat"),std::string("ckpoint_rng"),1);
|
||||
PlaquetteLogger<Gimpl> PlaqLog(std::string("plaq"));
|
||||
|
||||
HMCparameters HMCpar;
|
||||
HMCpar.StartTrajectory = StartTraj;
|
||||
@ -99,7 +102,7 @@ public:
|
||||
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
||||
}
|
||||
|
||||
HybridMonteCarlo<LatticeGaugeField,IntegratorType> HMC(HMCpar, MDynamics,sRNG,pRNG,U);
|
||||
HybridMonteCarlo<GaugeField,IntegratorType> HMC(HMCpar, MDynamics,sRNG,pRNG,U);
|
||||
HMC.AddObservable(&Checkpoint);
|
||||
HMC.AddObservable(&PlaqLog);
|
||||
|
||||
@ -109,5 +112,18 @@ public:
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> NerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> NerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> NerscHmcRunnerD;
|
||||
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> PeriodicNerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> PeriodicNerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> PeriodicNerscHmcRunnerD;
|
||||
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplR> ConjugateNerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplF> ConjugateNerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplD> ConjugateNerscHmcRunnerD;
|
||||
|
||||
}}
|
||||
#endif
|
||||
|
@ -10,13 +10,15 @@ namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
|
||||
template<class GaugeField>
|
||||
class NerscHmcCheckpointer : public HmcObservable<GaugeField> {
|
||||
template<class Gimpl>
|
||||
class NerscHmcCheckpointer : public HmcObservable<typename Gimpl::GaugeField> {
|
||||
private:
|
||||
std::string configStem;
|
||||
std::string rngStem;
|
||||
int SaveInterval;
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
|
||||
NerscHmcCheckpointer(std::string cf, std::string rn,int savemodulo) {
|
||||
configStem = cf;
|
||||
rngStem = rn;
|
||||
|
Reference in New Issue
Block a user