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

More progress in the HMC construction

This commit is contained in:
neo
2015-07-04 02:43:14 +09:00
parent 9655d43017
commit 30c9dc473d
12 changed files with 234 additions and 139 deletions

View File

@ -1,19 +1,20 @@
#ifndef QCD_GAUGE_ACTION_BASE
#define QCD_GAUGE_ACTION_BASE
#ifndef QCD_ACTION_BASE
#define QCD_ACTION_BASE
namespace Grid {
namespace QCD{
template<class GaugeField>
class GaugeActionBase { // derive this from TermInAction?
class Action {
public:
virtual void init(const GaugeField &U) = 0;
virtual RealD S(const GaugeField &U) = 0; // evaluate the action
virtual void deriv(const GaugeField &U,GaugeField & dSdU ) = 0; // evaluate the action derivative
virtual void staple(const GaugeField &U,GaugeField & dSdU ) = 0; // evaluate the action derivative
virtual void refresh(const GaugeField & ) {};
//virtual void refresh(const GaugeField & ) {} ;
// Boundary conditions?
// Heatbath?
virtual ~GaugeActionBase() {};
virtual ~Action() {};
};
}}

View File

@ -15,8 +15,17 @@
////////////////////////////////////////////
// Abstract base interface
////////////////////////////////////////////
#include <qcd/action/ActionBase.h>
#include <qcd/action/fermion/FermionOperator.h>
////////////////////////////////////////////
// Gauge Actions
////////////////////////////////////////////
#include <qcd/action/gauge/WilsonGaugeAction.h>
////////////////////////////////////////////
// Utility functions
////////////////////////////////////////////

View File

@ -1,24 +1,38 @@
#ifndef QCD_WILSON_GAUGE_ACTION_H
#define QCD_WILSON_GAUGE_ACTION_H
////////////////////////////////////////////////////////////////////////
// Wilson Gauge Action .. should I template the Nc etc..
////////////////////////////////////////////////////////////////////////
template<class GaugeField,class MatrixField>
class WilsonGaugeAction : public GaugeActionBase<GaugeField> {
public:
virtual RealD S(const GaugeField &U) {
return WilsonLoops<MatrixField,GaugeField>::sumPlaquette(U);
};
virtual RealD deriv(GaugeField &U,GaugeField & dSdU ) {
WilsonLoops<MatrixField,GaugeField>::Staple(dSdU,U,mu);
};
virtual void staple(const MatrixField &stap,GaugeField & U,int mu ) {
WilsonLoops<MatrixField,GaugeField>::Staple(stap,U,mu);
};
};
#endif
namespace Grid{
namespace QCD{
////////////////////////////////////////////////////////////////////////
// Wilson Gauge Action .. should I template the Nc etc..
////////////////////////////////////////////////////////////////////////
template<class GaugeField,class MatrixField>
class WilsonGaugeAction : public Action<GaugeField> {
private:
RealD beta;
public:
WilsonGaugeAction(RealD b):beta(b){};
virtual void init(const GaugeField &U) {//FIXME
};
virtual RealD S(const GaugeField &U) {
return WilsonLoops<MatrixField,GaugeField>::sumPlaquette(U);
};
virtual void deriv(const GaugeField &U,GaugeField & dSdU) {
//FIXME loop on directions
MatrixField dSdU_mu(U._grid);
WilsonLoops<MatrixField,GaugeField>::Staple(dSdU_mu,U,0);
};
virtual void staple(const GaugeField &stap,GaugeField & U) {
//FIXME loop on directions
MatrixField stap_mu(U._grid);
WilsonLoops<MatrixField,GaugeField>::Staple(stap_mu,U,0);
};
};
}
}
#endif