mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-10 19:36:56 +01:00
Added scalar action phi^4
Check Norm2 output (Complex type assumption)
This commit is contained in:
@ -34,16 +34,21 @@ namespace QCD {
|
||||
|
||||
// Virtual Class for HMC specific for gauge theories
|
||||
// implement a specific theory by defining the BuildTheAction
|
||||
template <class Implementation, class RepresentationsPolicy = NoHirep>
|
||||
template <class Implementation,
|
||||
class IOCheckpointer = BinaryHmcCheckpointer<Implementation>,
|
||||
class RepresentationsPolicy = NoHirep>
|
||||
class BinaryHmcRunnerTemplate {
|
||||
public:
|
||||
INHERIT_FIELD_TYPES(Implementation);
|
||||
typedef Implementation ImplPolicy;
|
||||
|
||||
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
||||
|
||||
ActionSet<Field, RepresentationsPolicy> TheAction;
|
||||
// Add here a vector of HmcObservable
|
||||
// that can be injected from outside
|
||||
std::vector< HmcObservable<typename Implementation::Field> > ObservablesList;
|
||||
|
||||
|
||||
GridCartesian *UGrid;
|
||||
GridCartesian *FGrid;
|
||||
@ -119,8 +124,7 @@ class BinaryHmcRunnerTemplate {
|
||||
std::string format = std::string("IEEE64BIG");
|
||||
std::string conf_prefix = std::string("ckpoint_lat");
|
||||
std::string rng_prefix = std::string("ckpoint_rng");
|
||||
BinaryHmcCheckpointer<Implementation> Checkpoint(conf_prefix, rng_prefix,
|
||||
SaveInterval, format);
|
||||
IOCheckpointer Checkpoint(conf_prefix, rng_prefix, SaveInterval, format);
|
||||
|
||||
HMCparameters HMCpar;
|
||||
HMCpar.StartTrajectory = StartTraj;
|
||||
@ -154,20 +158,31 @@ class BinaryHmcRunnerTemplate {
|
||||
SmearingPolicy.set_Field(U);
|
||||
|
||||
HybridMonteCarlo<IntegratorType> HMC(HMCpar, MDynamics, sRNG, pRNG, U);
|
||||
HMC.AddObservable(&Checkpoint);
|
||||
//HMC.AddObservable(&Checkpoint);
|
||||
|
||||
for (int obs = 0; obs < ObservablesList.size(); obs++)
|
||||
HMC.AddObservable(&ObservablesList[obs]);
|
||||
|
||||
// Run it
|
||||
HMC.evolve();
|
||||
}
|
||||
};
|
||||
|
||||
// These are for gauge fields
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplR> BinaryHmcRunner;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplF> BinaryHmcRunnerF;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplD> BinaryHmcRunnerD;
|
||||
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplR, NerscHmcCheckpointer<PeriodicGimplR> > NerscTestHmcRunner;
|
||||
|
||||
|
||||
template <class RepresentationsPolicy>
|
||||
using BinaryHmcRunnerTemplateHirep =
|
||||
BinaryHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
|
||||
|
||||
|
||||
|
||||
typedef BinaryHmcRunnerTemplate<ScalarImplR, BinaryHmcCheckpointer<ScalarImplR>, ScalarFields> ScalarBinaryHmcRunner;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
// Only for gauge fields
|
||||
// Only for Gauge fields
|
||||
template<class Gimpl>
|
||||
class NerscHmcCheckpointer : public HmcObservable<typename Gimpl::GaugeField> {
|
||||
private:
|
||||
@ -44,12 +44,13 @@ namespace Grid{
|
||||
std::string rngStem;
|
||||
int SaveInterval;
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
INHERIT_GIMPL_TYPES(Gimpl);//
|
||||
|
||||
NerscHmcCheckpointer(std::string cf, std::string rn,int savemodulo) {
|
||||
NerscHmcCheckpointer(std::string cf, std::string rn,int savemodulo, std::string format = "") {
|
||||
configStem = cf;
|
||||
rngStem = rn;
|
||||
SaveInterval= savemodulo;
|
||||
// format is fixed to IEEE64BIG for NERSC
|
||||
};
|
||||
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )
|
||||
|
@ -128,7 +128,7 @@ class Integrator {
|
||||
<< "Smearing (on/off): " << as[level].actions.at(a)->is_smeared
|
||||
<< std::endl;
|
||||
if (as[level].actions.at(a)->is_smeared) Smearer.smeared_force(force);
|
||||
force = Ta(force);
|
||||
force = FieldImplementation::projectForce(force); // Ta for gauge fields
|
||||
std::cout << GridLogIntegrator
|
||||
<< "Force average: " << norm2(force) / (U._grid->gSites())
|
||||
<< std::endl;
|
||||
@ -201,9 +201,10 @@ class Integrator {
|
||||
|
||||
// Initialization of momenta and actions
|
||||
void refresh(Field& U, GridParallelRNG& pRNG) {
|
||||
assert(P._grid == U._grid);
|
||||
std::cout << GridLogIntegrator << "Integrator refresh\n";
|
||||
FieldImplementation::generate_momenta(P, pRNG);
|
||||
|
||||
|
||||
// Update the smeared fields, can be implemented as observer
|
||||
// necessary to keep the fields updated even after a reject
|
||||
// of the Metropolis
|
||||
|
Reference in New Issue
Block a user