mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Even Odd two flavour ratio added and dH == small
This commit is contained in:
		@@ -150,8 +150,16 @@ typedef DomainWallFermion<GparityWilsonImplD> GparityDomainWallFermionD;
 | 
			
		||||
////////////////////////////////////////
 | 
			
		||||
// Pseudo fermion combinations for HMC
 | 
			
		||||
////////////////////////////////////////
 | 
			
		||||
#include <qcd/action/pseudofermion/EvenOddSchurDifferentiable.h>
 | 
			
		||||
#include <qcd/action/pseudofermion/TwoFlavour.h>
 | 
			
		||||
#include <qcd/action/pseudofermion/TwoFlavourEvenOdd.h>
 | 
			
		||||
#include <qcd/action/pseudofermion/TwoFlavourRatio.h>
 | 
			
		||||
#include <qcd/action/pseudofermion/TwoFlavourEvenOdd.h>
 | 
			
		||||
#include <qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h>
 | 
			
		||||
 | 
			
		||||
//Todo: RHMC
 | 
			
		||||
//#include <qcd/action/pseudofermion/OneFlavour.h>
 | 
			
		||||
//#include <qcd/action/pseudofermion/OneFlavourRatio.h>
 | 
			
		||||
//#include <qcd/action/pseudofermion/OneFlavourEvenOdd.h>
 | 
			
		||||
//#include <qcd/action/pseudofermion/OneFlavourEvenOddRatio.h>
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										112
									
								
								lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,112 @@
 | 
			
		||||
#ifndef QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H
 | 
			
		||||
#define QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H
 | 
			
		||||
 | 
			
		||||
namespace Grid{
 | 
			
		||||
  namespace QCD{
 | 
			
		||||
 | 
			
		||||
    // Base even odd HMC on the normal Mee based schur decomposition.
 | 
			
		||||
    //
 | 
			
		||||
    //     M = (Mee Meo) =  (1             0 )   (Mee   0               )  (1 Mee^{-1} Meo)
 | 
			
		||||
    //         (Moe Moo)    (Moe Mee^-1    1 )   (0   Moo-Moe Mee^-1 Meo)  (0   1         )
 | 
			
		||||
    //
 | 
			
		||||
    // Determinant is det of middle factor
 | 
			
		||||
    // This assumes Mee is indept of U.
 | 
			
		||||
    //
 | 
			
		||||
    template<class Impl>
 | 
			
		||||
    class SchurDifferentiableOperator :  public SchurDiagMooeeOperator<FermionOperator<Impl>,typename Impl::FermionField> 
 | 
			
		||||
      {
 | 
			
		||||
      public:
 | 
			
		||||
      INHERIT_IMPL_TYPES(Impl);
 | 
			
		||||
 | 
			
		||||
 	typedef FermionOperator<Impl> Matrix;
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator (Matrix &Mat) : SchurDiagMooeeOperator<Matrix,FermionField>(Mat) {};
 | 
			
		||||
 | 
			
		||||
	void MpcDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
 | 
			
		||||
	
 | 
			
		||||
	  GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
	  GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
	  FermionField tmp1(fcbgrid);
 | 
			
		||||
	  FermionField tmp2(fcbgrid);
 | 
			
		||||
 | 
			
		||||
	  conformable(fcbgrid,U._grid);
 | 
			
		||||
	  conformable(fcbgrid,V._grid);
 | 
			
		||||
 | 
			
		||||
	  // Assert the checkerboard?? or code for either
 | 
			
		||||
	  assert(U.checkerboard==Odd);
 | 
			
		||||
	  assert(V.checkerboard==U.checkerboard);
 | 
			
		||||
 | 
			
		||||
	  GaugeField ForceO(ucbgrid);
 | 
			
		||||
	  GaugeField ForceE(ucbgrid);
 | 
			
		||||
 | 
			
		||||
	  //  X^dag Der_oe MeeInv Meo Y
 | 
			
		||||
	  // Use Mooee as nontrivial but gauge field indept
 | 
			
		||||
	  this->_Mat.Meooe   (V,tmp1);      // odd->even -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInv(tmp1,tmp2);   // even->even 
 | 
			
		||||
	  this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerNo);
 | 
			
		||||
	  
 | 
			
		||||
	  //  Accumulate X^dag M_oe MeeInv Der_eo Y
 | 
			
		||||
	  this->_Mat.MeooeDag   (U,tmp1);    // even->odd -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInvDag(tmp1,tmp2); // even->even 
 | 
			
		||||
	  this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerNo);
 | 
			
		||||
	  
 | 
			
		||||
	  assert(ForceE.checkerboard==Even);
 | 
			
		||||
	  assert(ForceO.checkerboard==Odd);
 | 
			
		||||
 | 
			
		||||
	  setCheckerboard(Force,ForceE); 
 | 
			
		||||
	  setCheckerboard(Force,ForceO);
 | 
			
		||||
	  Force=-Force;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	void MpcDagDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
 | 
			
		||||
	
 | 
			
		||||
	  GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
	  GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
	  FermionField tmp1(fcbgrid);
 | 
			
		||||
	  FermionField tmp2(fcbgrid);
 | 
			
		||||
 | 
			
		||||
	  conformable(fcbgrid,U._grid);
 | 
			
		||||
	  conformable(fcbgrid,V._grid);
 | 
			
		||||
 | 
			
		||||
	  // Assert the checkerboard?? or code for either
 | 
			
		||||
	  assert(V.checkerboard==Odd);
 | 
			
		||||
	  assert(V.checkerboard==V.checkerboard);
 | 
			
		||||
 | 
			
		||||
	  GaugeField ForceO(ucbgrid);
 | 
			
		||||
	  GaugeField ForceE(ucbgrid);
 | 
			
		||||
 | 
			
		||||
	  //  X^dag Der_oe MeeInv Meo Y
 | 
			
		||||
	  // Use Mooee as nontrivial but gauge field indept
 | 
			
		||||
	  this->_Mat.MeooeDag   (V,tmp1);      // odd->even -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInvDag(tmp1,tmp2);   // even->even 
 | 
			
		||||
	  this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerYes);
 | 
			
		||||
	  
 | 
			
		||||
	  //  Accumulate X^dag M_oe MeeInv Der_eo Y
 | 
			
		||||
	  this->_Mat.Meooe   (U,tmp1);    // even->odd -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInv(tmp1,tmp2); // even->even 
 | 
			
		||||
	  this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerYes);
 | 
			
		||||
 | 
			
		||||
	  assert(ForceE.checkerboard==Even);
 | 
			
		||||
	  assert(ForceO.checkerboard==Odd);
 | 
			
		||||
 | 
			
		||||
	  setCheckerboard(Force,ForceE); 
 | 
			
		||||
	  setCheckerboard(Force,ForceO);
 | 
			
		||||
	  Force=-Force;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -4,108 +4,6 @@
 | 
			
		||||
namespace Grid{
 | 
			
		||||
  namespace QCD{
 | 
			
		||||
 | 
			
		||||
    // Base even odd HMC on the normal Mee based schur decomposition.
 | 
			
		||||
    //
 | 
			
		||||
    //     M = (Mee Meo) =  (1             0 )   (Mee   0               )  (1 Mee^{-1} Meo)
 | 
			
		||||
    //         (Moe Moo)    (Moe Mee^-1    1 )   (0   Moo-Moe Mee^-1 Meo)  (0   1         )
 | 
			
		||||
    //
 | 
			
		||||
    // Determinant is det of middle factor
 | 
			
		||||
    // This assumes Mee is indept of U.
 | 
			
		||||
    //
 | 
			
		||||
    template<class Impl>
 | 
			
		||||
    class SchurDifferentiableOperator :  public SchurDiagMooeeOperator<FermionOperator<Impl>,typename Impl::FermionField> 
 | 
			
		||||
      {
 | 
			
		||||
      public:
 | 
			
		||||
      INHERIT_IMPL_TYPES(Impl);
 | 
			
		||||
 | 
			
		||||
 	typedef FermionOperator<Impl> Matrix;
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator (Matrix &Mat) : SchurDiagMooeeOperator<Matrix,FermionField>(Mat) {};
 | 
			
		||||
 | 
			
		||||
	void MpcDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
 | 
			
		||||
	
 | 
			
		||||
	  GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
	  GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
	  FermionField tmp1(fcbgrid);
 | 
			
		||||
	  FermionField tmp2(fcbgrid);
 | 
			
		||||
 | 
			
		||||
	  conformable(fcbgrid,U._grid);
 | 
			
		||||
	  conformable(fcbgrid,V._grid);
 | 
			
		||||
 | 
			
		||||
	  // Assert the checkerboard?? or code for either
 | 
			
		||||
	  assert(U.checkerboard==Odd);
 | 
			
		||||
	  assert(V.checkerboard==U.checkerboard);
 | 
			
		||||
 | 
			
		||||
	  GaugeField ForceO(ucbgrid);
 | 
			
		||||
	  GaugeField ForceE(ucbgrid);
 | 
			
		||||
 | 
			
		||||
	  //  X^dag Der_oe MeeInv Meo Y
 | 
			
		||||
	  // Use Mooee as nontrivial but gauge field indept
 | 
			
		||||
	  this->_Mat.Meooe   (V,tmp1);      // odd->even -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInv(tmp1,tmp2);   // even->even 
 | 
			
		||||
	  this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerNo);
 | 
			
		||||
	  
 | 
			
		||||
	  //  Accumulate X^dag M_oe MeeInv Der_eo Y
 | 
			
		||||
	  this->_Mat.MeooeDag   (U,tmp1);    // even->odd -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInvDag(tmp1,tmp2); // even->even 
 | 
			
		||||
	  this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerNo);
 | 
			
		||||
	  
 | 
			
		||||
	  assert(ForceE.checkerboard==Even);
 | 
			
		||||
	  assert(ForceO.checkerboard==Odd);
 | 
			
		||||
 | 
			
		||||
	  setCheckerboard(Force,ForceE); 
 | 
			
		||||
	  setCheckerboard(Force,ForceO);
 | 
			
		||||
	  Force=-Force;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	void MpcDagDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
 | 
			
		||||
	
 | 
			
		||||
	  GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
	  GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
	  FermionField tmp1(fcbgrid);
 | 
			
		||||
	  FermionField tmp2(fcbgrid);
 | 
			
		||||
 | 
			
		||||
	  conformable(fcbgrid,U._grid);
 | 
			
		||||
	  conformable(fcbgrid,V._grid);
 | 
			
		||||
 | 
			
		||||
	  // Assert the checkerboard?? or code for either
 | 
			
		||||
	  assert(V.checkerboard==Odd);
 | 
			
		||||
	  assert(V.checkerboard==V.checkerboard);
 | 
			
		||||
 | 
			
		||||
	  GaugeField ForceO(ucbgrid);
 | 
			
		||||
	  GaugeField ForceE(ucbgrid);
 | 
			
		||||
 | 
			
		||||
	  //  X^dag Der_oe MeeInv Meo Y
 | 
			
		||||
	  // Use Mooee as nontrivial but gauge field indept
 | 
			
		||||
	  this->_Mat.MeooeDag   (V,tmp1);      // odd->even -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInvDag(tmp1,tmp2);   // even->even 
 | 
			
		||||
	  this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerYes);
 | 
			
		||||
	  
 | 
			
		||||
	  //  Accumulate X^dag M_oe MeeInv Der_eo Y
 | 
			
		||||
	  this->_Mat.Meooe   (U,tmp1);    // even->odd -- implicit -0.5 factor to be applied
 | 
			
		||||
	  this->_Mat.MooeeInv(tmp1,tmp2); // even->even 
 | 
			
		||||
	  this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerYes);
 | 
			
		||||
 | 
			
		||||
	  assert(ForceE.checkerboard==Even);
 | 
			
		||||
	  assert(ForceO.checkerboard==Odd);
 | 
			
		||||
 | 
			
		||||
	  setCheckerboard(Force,ForceE); 
 | 
			
		||||
	  setCheckerboard(Force,ForceO);
 | 
			
		||||
	  Force=-Force;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    ////////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -123,7 +21,6 @@ namespace Grid{
 | 
			
		||||
      FermionOperator<Impl> & FermOp;// the basic operator
 | 
			
		||||
 | 
			
		||||
      OperatorFunction<FermionField> &DerivativeSolver;
 | 
			
		||||
 | 
			
		||||
      OperatorFunction<FermionField> &ActionSolver;
 | 
			
		||||
 | 
			
		||||
      FermionField PhiOdd;   // the pseudo fermion field for this trajectory
 | 
			
		||||
@@ -154,6 +51,7 @@ namespace Grid{
 | 
			
		||||
	// P(eta) = e^{- eta^dag eta}
 | 
			
		||||
	//
 | 
			
		||||
	// e^{x^2/2 sig^2} => sig^2 = 0.5.
 | 
			
		||||
 | 
			
		||||
	RealD scale = std::sqrt(0.5);
 | 
			
		||||
 | 
			
		||||
	FermionField eta    (FermOp.FermionGrid());
 | 
			
		||||
@@ -169,6 +67,7 @@ namespace Grid{
 | 
			
		||||
	FermOp.ImportGauge(U);
 | 
			
		||||
 | 
			
		||||
	PCop.MpcDag(etaOdd,PhiOdd);
 | 
			
		||||
 | 
			
		||||
	FermOp.MooeeDag(etaEven,PhiEven);
 | 
			
		||||
 | 
			
		||||
	PhiOdd =PhiOdd*scale;
 | 
			
		||||
@@ -219,17 +118,16 @@ namespace Grid{
 | 
			
		||||
	FermionField Y(FermOp.FermionRedBlackGrid());
 | 
			
		||||
	GaugeField tmp(FermOp.GaugeGrid());
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator<Impl> PCop(FermOp);
 | 
			
		||||
 | 
			
		||||
	X=zero;
 | 
			
		||||
	DerivativeSolver(PCop,PhiOdd,X);
 | 
			
		||||
	PCop.Op(X,Y);
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Mpc(FermOp);
 | 
			
		||||
 | 
			
		||||
	// Our conventions really make this UdSdU; We do not differentiate wrt Udag here.
 | 
			
		||||
	// So must take dSdU - adj(dSdU) and left multiply by mom to get dS/dt.
 | 
			
		||||
 | 
			
		||||
  	PCop.MpcDeriv(tmp , Y, X );    dSdU=tmp;
 | 
			
		||||
	PCop.MpcDagDeriv(tmp , X, Y);  dSdU=dSdU+tmp;
 | 
			
		||||
	X=zero;
 | 
			
		||||
	DerivativeSolver(Mpc,PhiOdd,X);
 | 
			
		||||
	Mpc.Mpc(X,Y);
 | 
			
		||||
  	Mpc.MpcDeriv(tmp , Y, X );    dSdU=tmp;
 | 
			
		||||
	Mpc.MpcDagDeriv(tmp , X, Y);  dSdU=dSdU+tmp;
 | 
			
		||||
 | 
			
		||||
	// Treat the EE case. (MdagM)^-1 = Minv Minvdag
 | 
			
		||||
	// Deriv defaults to zero.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										163
									
								
								lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,163 @@
 | 
			
		||||
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_RATIO_H
 | 
			
		||||
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_RATIO_H
 | 
			
		||||
 | 
			
		||||
namespace Grid{
 | 
			
		||||
  namespace QCD{
 | 
			
		||||
 | 
			
		||||
    ///////////////////////////////////////
 | 
			
		||||
    // Two flavour ratio
 | 
			
		||||
    ///////////////////////////////////////
 | 
			
		||||
    template<class Impl>
 | 
			
		||||
    class TwoFlavourEvenOddRatioPseudoFermionAction : public Action<typename Impl::GaugeField> {
 | 
			
		||||
    public:
 | 
			
		||||
      INHERIT_IMPL_TYPES(Impl);
 | 
			
		||||
 | 
			
		||||
    private:
 | 
			
		||||
      FermionOperator<Impl> & NumOp;// the basic operator
 | 
			
		||||
      FermionOperator<Impl> & DenOp;// the basic operator
 | 
			
		||||
 | 
			
		||||
      OperatorFunction<FermionField> &DerivativeSolver;
 | 
			
		||||
      OperatorFunction<FermionField> &ActionSolver;
 | 
			
		||||
 | 
			
		||||
      FermionField PhiOdd;   // the pseudo fermion field for this trajectory
 | 
			
		||||
      FermionField PhiEven;  // the pseudo fermion field for this trajectory
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
      TwoFlavourEvenOddRatioPseudoFermionAction(FermionOperator<Impl>  &_NumOp, 
 | 
			
		||||
						FermionOperator<Impl>  &_DenOp, 
 | 
			
		||||
						OperatorFunction<FermionField> & DS,
 | 
			
		||||
						OperatorFunction<FermionField> & AS) :
 | 
			
		||||
      NumOp(_NumOp), 
 | 
			
		||||
      DenOp(_DenOp), 
 | 
			
		||||
      DerivativeSolver(DS), 
 | 
			
		||||
      ActionSolver(AS),
 | 
			
		||||
      PhiEven(_NumOp.FermionRedBlackGrid()),
 | 
			
		||||
      PhiOdd(_NumOp.FermionRedBlackGrid()) 
 | 
			
		||||
	{
 | 
			
		||||
	  conformable(_NumOp.FermionGrid(), _DenOp.FermionGrid());
 | 
			
		||||
	  conformable(_NumOp.FermionRedBlackGrid(), _DenOp.FermionRedBlackGrid());
 | 
			
		||||
	  conformable(_NumOp.GaugeGrid(), _DenOp.GaugeGrid());
 | 
			
		||||
	  conformable(_NumOp.GaugeRedBlackGrid(), _DenOp.GaugeRedBlackGrid());
 | 
			
		||||
	};
 | 
			
		||||
      
 | 
			
		||||
      virtual void init(const GaugeField &U, GridParallelRNG& pRNG) {
 | 
			
		||||
 | 
			
		||||
	// P(phi) = e^{- phi^dag Vpc (MpcdagMpc)^-1 Vpcdag phi}
 | 
			
		||||
	//
 | 
			
		||||
	// NumOp == V
 | 
			
		||||
	// DenOp == M
 | 
			
		||||
	//
 | 
			
		||||
	// Take phi_o = Vpcdag^{-1} Mpcdag eta_o  ; eta_o = Mpcdag^{-1} Vpcdag Phi
 | 
			
		||||
	//
 | 
			
		||||
	// P(eta_o) = e^{- eta_o^dag eta_o}
 | 
			
		||||
	//
 | 
			
		||||
	// e^{x^2/2 sig^2} => sig^2 = 0.5.
 | 
			
		||||
	// 
 | 
			
		||||
	RealD scale = std::sqrt(0.5);
 | 
			
		||||
 | 
			
		||||
	FermionField eta    (NumOp.FermionGrid());
 | 
			
		||||
	FermionField etaOdd (NumOp.FermionRedBlackGrid());
 | 
			
		||||
	FermionField etaEven(NumOp.FermionRedBlackGrid());
 | 
			
		||||
	FermionField tmp    (NumOp.FermionRedBlackGrid());
 | 
			
		||||
 | 
			
		||||
	gaussian(pRNG,eta);
 | 
			
		||||
	pickCheckerboard(Even,etaEven,eta);
 | 
			
		||||
	pickCheckerboard(Odd,etaOdd,eta);
 | 
			
		||||
 | 
			
		||||
	NumOp.ImportGauge(U);
 | 
			
		||||
	DenOp.ImportGauge(U);
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Mpc(DenOp);
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Vpc(NumOp);
 | 
			
		||||
 | 
			
		||||
	// Odd det factors
 | 
			
		||||
	Mpc.MpcDag(etaOdd,PhiOdd);
 | 
			
		||||
	ActionSolver(Vpc,PhiOdd,tmp);
 | 
			
		||||
	Vpc.Mpc(tmp,PhiOdd);            
 | 
			
		||||
 | 
			
		||||
	// Even det factors
 | 
			
		||||
	DenOp.MooeeDag(etaEven,tmp);
 | 
			
		||||
	NumOp.MooeeInvDag(tmp,PhiEven);
 | 
			
		||||
 | 
			
		||||
	PhiOdd =PhiOdd*scale;
 | 
			
		||||
	PhiEven=PhiEven*scale;
 | 
			
		||||
	
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      //////////////////////////////////////////////////////
 | 
			
		||||
      // S = phi^dag V (Mdag M)^-1 Vdag phi
 | 
			
		||||
      //////////////////////////////////////////////////////
 | 
			
		||||
      virtual RealD S(const GaugeField &U) {
 | 
			
		||||
 | 
			
		||||
	NumOp.ImportGauge(U);
 | 
			
		||||
	DenOp.ImportGauge(U);
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Mpc(DenOp);
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Vpc(NumOp);
 | 
			
		||||
 | 
			
		||||
	FermionField X(NumOp.FermionRedBlackGrid());
 | 
			
		||||
	FermionField Y(NumOp.FermionRedBlackGrid());
 | 
			
		||||
 | 
			
		||||
	X=zero;
 | 
			
		||||
	Vpc.MpcDag(PhiOdd,Y);           // Y= Vdag phi
 | 
			
		||||
	ActionSolver(Mpc,Y,X);          // X= (MdagM)^-1 Vdag phi
 | 
			
		||||
	Mpc.Mpc(X,Y);                   // Y=  Mdag^-1 Vdag phi
 | 
			
		||||
 | 
			
		||||
	RealD action = norm2(Y);
 | 
			
		||||
 | 
			
		||||
	// The EE factorised block; normally can replace with zero if det is constant (gauge field indept)
 | 
			
		||||
	// Only really clover term that creates this. Leave the EE portion as a future to do to make most
 | 
			
		||||
	// rapid progresss on DWF for now.
 | 
			
		||||
	//
 | 
			
		||||
	// Vpc.MooeeDag(PhiEven,X);
 | 
			
		||||
	// Mpc.MooeeInvDag(X,Y);
 | 
			
		||||
	// action = action + norm2(Y);
 | 
			
		||||
 | 
			
		||||
	return action;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      //////////////////////////////////////////////////////
 | 
			
		||||
      // dS/du = phi^dag dV (Mdag M)^-1 V^dag  phi
 | 
			
		||||
      //       - phi^dag V (Mdag M)^-1 [ Mdag dM + dMdag M ]  (Mdag M)^-1 V^dag  phi
 | 
			
		||||
      //       + phi^dag V (Mdag M)^-1 dV^dag  phi
 | 
			
		||||
      //////////////////////////////////////////////////////
 | 
			
		||||
      virtual void deriv(const GaugeField &U,GaugeField & dSdU) {
 | 
			
		||||
 | 
			
		||||
	NumOp.ImportGauge(U);
 | 
			
		||||
	DenOp.ImportGauge(U);
 | 
			
		||||
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Mpc(DenOp);
 | 
			
		||||
	SchurDifferentiableOperator<Impl> Vpc(NumOp);
 | 
			
		||||
 | 
			
		||||
	FermionField  X(NumOp.FermionRedBlackGrid());
 | 
			
		||||
	FermionField  Y(NumOp.FermionRedBlackGrid());
 | 
			
		||||
 | 
			
		||||
	GaugeField   force(NumOp.GaugeGrid());	
 | 
			
		||||
 | 
			
		||||
	X=zero;
 | 
			
		||||
 | 
			
		||||
	//Y=Vdag phi
 | 
			
		||||
	//X = (Mdag M)^-1 V^dag phi
 | 
			
		||||
	//Y = (Mdag)^-1 V^dag  phi
 | 
			
		||||
	Vpc.MpcDag(PhiOdd,Y);          // Y= Vdag phi
 | 
			
		||||
	DerivativeSolver(Mpc,Y,X);     // X= (MdagM)^-1 Vdag phi
 | 
			
		||||
	Mpc.Mpc(X,Y);                  // Y=  Mdag^-1 Vdag phi
 | 
			
		||||
 | 
			
		||||
	// phi^dag V (Mdag M)^-1 dV^dag  phi
 | 
			
		||||
	Vpc.MpcDagDeriv(force , X, PhiOdd );  dSdU=force;
 | 
			
		||||
  
 | 
			
		||||
	// phi^dag dV (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	Vpc.MpcDeriv(force , PhiOdd, X );  dSdU=dSdU+force;
 | 
			
		||||
 | 
			
		||||
	//    -    phi^dag V (Mdag M)^-1 Mdag dM   (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	//    -    phi^dag V (Mdag M)^-1 dMdag M   (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	Mpc.MpcDeriv(force,Y,X);   dSdU=dSdU-force;
 | 
			
		||||
	Mpc.MpcDagDeriv(force,X,Y);  dSdU=dSdU-force;
 | 
			
		||||
 | 
			
		||||
	dSdU = -Ta(dSdU);
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,10 +1,5 @@
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_RATIO_H
 | 
			
		||||
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_RATIO_H
 | 
			
		||||
=======
 | 
			
		||||
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_H
 | 
			
		||||
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_H
 | 
			
		||||
>>>>>>> ef6a9e6b07b80aea909c0a62f223fa3e66f53b3a
 | 
			
		||||
 | 
			
		||||
namespace Grid{
 | 
			
		||||
  namespace QCD{
 | 
			
		||||
@@ -107,7 +102,6 @@ namespace Grid{
 | 
			
		||||
 | 
			
		||||
	FermionField  X(NumOp.FermionGrid());
 | 
			
		||||
	FermionField  Y(NumOp.FermionGrid());
 | 
			
		||||
	FermionField f1(NumOp.FermionGrid());
 | 
			
		||||
 | 
			
		||||
	GaugeField   force(NumOp.GaugeGrid());	
 | 
			
		||||
 | 
			
		||||
@@ -130,8 +124,8 @@ namespace Grid{
 | 
			
		||||
	//    -    phi^dag V (Mdag M)^-1 dMdag M   (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	DenOp.MDeriv(force,Y,X,DaggerNo);   dSdU=dSdU-force;
 | 
			
		||||
	DenOp.MDeriv(force,X,Y,DaggerYes);  dSdU=dSdU-force;
 | 
			
		||||
	dSdU = - dSdU;
 | 
			
		||||
	dSdU = Ta(dSdU);
 | 
			
		||||
 | 
			
		||||
	dSdU = - Ta(dSdU);
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user