mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	More progress in the HMC construction
This commit is contained in:
		@@ -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() {};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}}
 | 
			
		||||
@@ -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
 | 
			
		||||
////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user