mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Populating Clover fermions methods
This commit is contained in:
		@@ -142,11 +142,10 @@ typedef SymanzikGaugeAction<ConjugateGimplD>        ConjugateSymanzikGaugeAction
 | 
			
		||||
////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#include <Grid/qcd/action/fermion/WilsonFermion.h>       // 4d wilson like
 | 
			
		||||
#include <Grid/qcd/action/fermion/WilsonTMFermion.h>       // 4d wilson like
 | 
			
		||||
#include <Grid/qcd/action/fermion/WilsonTMFermion.h>     // 4d wilson like
 | 
			
		||||
#include <Grid/qcd/action/fermion/WilsonCloverFermion.h> // 4d wilson like
 | 
			
		||||
#include <Grid/qcd/action/fermion/WilsonFermion5D.h>     // 5d base used by all 5d overlap types
 | 
			
		||||
 | 
			
		||||
//#include <Grid/qcd/action/fermion/CloverFermion.h>
 | 
			
		||||
 | 
			
		||||
#include <Grid/qcd/action/fermion/CayleyFermion5D.h>     // Cayley types
 | 
			
		||||
#include <Grid/qcd/action/fermion/DomainWallFermion.h>
 | 
			
		||||
#include <Grid/qcd/action/fermion/DomainWallFermion.h>
 | 
			
		||||
@@ -188,10 +187,16 @@ typedef WilsonFermion<WilsonTwoIndexSymmetricImplR> WilsonTwoIndexSymmetricFermi
 | 
			
		||||
typedef WilsonFermion<WilsonTwoIndexSymmetricImplF> WilsonTwoIndexSymmetricFermionF;
 | 
			
		||||
typedef WilsonFermion<WilsonTwoIndexSymmetricImplD> WilsonTwoIndexSymmetricFermionD;
 | 
			
		||||
 | 
			
		||||
// Twisted mass fermion
 | 
			
		||||
typedef WilsonTMFermion<WilsonImplR> WilsonTMFermionR;
 | 
			
		||||
typedef WilsonTMFermion<WilsonImplF> WilsonTMFermionF;
 | 
			
		||||
typedef WilsonTMFermion<WilsonImplD> WilsonTMFermionD;
 | 
			
		||||
 | 
			
		||||
// Clover fermions
 | 
			
		||||
typedef WilsonCloverFermion<WilsonImplR> WilsonCloverFermionR;
 | 
			
		||||
typedef WilsonCloverFermion<WilsonImplF> WilsonCloverFermionF;
 | 
			
		||||
typedef WilsonCloverFermion<WilsonImplD> WilsonCloverFermionD;
 | 
			
		||||
 | 
			
		||||
typedef DomainWallFermion<WilsonImplR> DomainWallFermionR;
 | 
			
		||||
typedef DomainWallFermion<WilsonImplF> DomainWallFermionF;
 | 
			
		||||
typedef DomainWallFermion<WilsonImplD> DomainWallFermionD;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,13 @@
 | 
			
		||||
    /*************************************************************************************
 | 
			
		||||
/*************************************************************************************
 | 
			
		||||
 | 
			
		||||
    Grid physics library, www.github.com/paboyle/Grid
 | 
			
		||||
 | 
			
		||||
    Source file: ./lib/qcd/action/fermion/WilsonTMFermion.cc
 | 
			
		||||
    Source file: ./lib/qcd/action/fermion/WilsonCloverFermion.cc
 | 
			
		||||
 | 
			
		||||
    Copyright (C) 2015
 | 
			
		||||
    Copyright (C) 2017
 | 
			
		||||
 | 
			
		||||
Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
    Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
    Author: Guido Cossu <guido.cossu@ed.ac.uk>
 | 
			
		||||
 | 
			
		||||
    This program is free software; you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -24,75 +25,82 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
 | 
			
		||||
    See the full license in the file "LICENSE" in the top level distribution directory
 | 
			
		||||
    *************************************************************************************/
 | 
			
		||||
    /*  END LEGAL */
 | 
			
		||||
/*  END LEGAL */
 | 
			
		||||
#include <Grid/Grid.h>
 | 
			
		||||
#include <Grid/qcd/spin/Dirac.h>
 | 
			
		||||
 | 
			
		||||
namespace Grid {
 | 
			
		||||
namespace QCD {
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * BF sequence
 | 
			
		||||
     *
 | 
			
		||||
      void bfmbase<Float>::MooeeInv(Fermion_t psi, 
 | 
			
		||||
			       Fermion_t chi, 
 | 
			
		||||
			      int dag, int cb)
 | 
			
		||||
  template <class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::AddCloverTerm(const FermionField& in,
 | 
			
		||||
                                                FermionField& out){
 | 
			
		||||
      FermionField tmp(out._grid);
 | 
			
		||||
      tmp = zero;
 | 
			
		||||
      // the product sigma_munu Fmunu is hermitian
 | 
			
		||||
      tmp += Bx*(Gamma(Gamma::Algebra::SigmaYZ)*in);
 | 
			
		||||
      tmp += By*(Gamma(Gamma::Algebra::MinusSigmaXZ)*in);
 | 
			
		||||
      tmp += Bz*(Gamma(Gamma::Algebra::SigmaXY)*in);
 | 
			
		||||
      tmp += Ex*(Gamma(Gamma::Algebra::MinusSigmaXT)*in);
 | 
			
		||||
      tmp += Ey*(Gamma(Gamma::Algebra::MinusSigmaYT)*in);
 | 
			
		||||
      tmp += Ez*(Gamma(Gamma::Algebra::MinusSigmaZT)*in);
 | 
			
		||||
      out += tmp*csw; // check signs
 | 
			
		||||
 | 
			
		||||
    double m    = this->mass;
 | 
			
		||||
    double tm   = this->twistedmass;
 | 
			
		||||
    double mtil = 4.0+this->mass;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    double sq = mtil*mtil + tm*tm;
 | 
			
		||||
 | 
			
		||||
    double a = mtil/sq;
 | 
			
		||||
    double b = -tm /sq;
 | 
			
		||||
    if(dag) b=-b;
 | 
			
		||||
    axpibg5x(chi,psi,a,b);
 | 
			
		||||
 | 
			
		||||
      void bfmbase<Float>::Mooee(Fermion_t psi, 
 | 
			
		||||
			   Fermion_t chi, 
 | 
			
		||||
			   int dag,int cb)
 | 
			
		||||
    double a = 4.0+this->mass;
 | 
			
		||||
    double b = this->twistedmass;
 | 
			
		||||
    if(dag) b=-b;
 | 
			
		||||
    axpibg5x(chi,psi,a,b);
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonTMFermion<Impl>::Mooee(const FermionField &in, FermionField &out) {
 | 
			
		||||
    RealD a = 4.0+this->mass;
 | 
			
		||||
    RealD b = this->mu;
 | 
			
		||||
  template <class Impl>
 | 
			
		||||
  RealD WilsonCloverFermion<Impl>::M(const FermionField& in, FermionField& out) {
 | 
			
		||||
    // Wilson term
 | 
			
		||||
    out.checkerboard = in.checkerboard;
 | 
			
		||||
    axpibg5x(out,in,a,b);
 | 
			
		||||
  }
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonTMFermion<Impl>::MooeeDag(const FermionField &in, FermionField &out) {
 | 
			
		||||
    RealD a = 4.0+this->mass;
 | 
			
		||||
    RealD b = -this->mu;
 | 
			
		||||
    out.checkerboard = in.checkerboard;
 | 
			
		||||
    axpibg5x(out,in,a,b);
 | 
			
		||||
  }
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonTMFermion<Impl>::MooeeInv(const FermionField &in, FermionField &out) {
 | 
			
		||||
    RealD m    = this->mass;
 | 
			
		||||
    RealD tm   = this->mu;
 | 
			
		||||
    RealD mtil = 4.0+this->mass;
 | 
			
		||||
    RealD sq   = mtil*mtil+tm*tm;
 | 
			
		||||
    RealD a    = mtil/sq;
 | 
			
		||||
    RealD b    = -tm /sq;
 | 
			
		||||
    axpibg5x(out,in,a,b);
 | 
			
		||||
  }
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonTMFermion<Impl>::MooeeInvDag(const FermionField &in, FermionField &out) {
 | 
			
		||||
    RealD m    = this->mass;
 | 
			
		||||
    RealD tm   = this->mu;
 | 
			
		||||
    RealD mtil = 4.0+this->mass;
 | 
			
		||||
    RealD sq   = mtil*mtil+tm*tm;
 | 
			
		||||
    RealD a    = mtil/sq;
 | 
			
		||||
    RealD b    = tm /sq;
 | 
			
		||||
    axpibg5x(out,in,a,b);
 | 
			
		||||
    this->Dhop(in, out, DaggerNo);
 | 
			
		||||
    // Clover term
 | 
			
		||||
    // apply the sigma and Fmunu
 | 
			
		||||
    AddCloverTerm(in, out);
 | 
			
		||||
    // overall factor
 | 
			
		||||
    return axpy_norm(out, 4 + this->mass, in, out);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  FermOpTemplateInstantiate(WilsonTMFermion);
 | 
			
		||||
  template <class Impl>
 | 
			
		||||
  RealD WilsonCloverFermion<Impl>::Mdag(const FermionField& in, FermionField& out) {
 | 
			
		||||
    // Wilson term
 | 
			
		||||
    out.checkerboard = in.checkerboard;
 | 
			
		||||
    this->Dhop(in, out, DaggerYes);
 | 
			
		||||
    // Clover term
 | 
			
		||||
    // apply the sigma and Fmunu
 | 
			
		||||
    AddCloverTerm(in, out);
 | 
			
		||||
    return axpy_norm(out, 4 + this->mass, in, out);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  template <class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField& _Umu) {
 | 
			
		||||
    this->ImportGauge(_Umu);
 | 
			
		||||
    // Compute the field strength terms
 | 
			
		||||
 | 
			
		||||
    // Invert the Moo, Mee terms (?)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::Mooee(const FermionField &in, FermionField &out) {
 | 
			
		||||
    out.checkerboard = in.checkerboard;
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::MooeeDag(const FermionField &in, FermionField &out) {
 | 
			
		||||
    assert(0); // not implemented yet
 | 
			
		||||
  }
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::MooeeInv(const FermionField &in, FermionField &out) {
 | 
			
		||||
    assert(0); // not implemented yet
 | 
			
		||||
  }
 | 
			
		||||
  template<class Impl>
 | 
			
		||||
  void WilsonCloverFermion<Impl>::MooeeInvDag(const FermionField &in, FermionField &out) {
 | 
			
		||||
    assert(0); // not implemented yet
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  FermOpTemplateInstantiate(WilsonCloverFermion);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,12 @@
 | 
			
		||||
 | 
			
		||||
    Grid physics library, www.github.com/paboyle/Grid
 | 
			
		||||
 | 
			
		||||
    Source file: ./lib/qcd/action/fermion/WilsonTMFermion.h
 | 
			
		||||
    Source file: ./lib/qcd/action/fermion/WilsonCloverFermion.h
 | 
			
		||||
 | 
			
		||||
    Copyright (C) 2017
 | 
			
		||||
 | 
			
		||||
Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
 | 
			
		||||
    Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
    Author: Guido Cossu <guido.cossu@ed.ac.uk>
 | 
			
		||||
 | 
			
		||||
    This program is free software; you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -40,6 +40,8 @@ public:
 | 
			
		||||
  INHERIT_IMPL_TYPES(Impl);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  typedef WilsonFermion<Impl> WilsonBase;
 | 
			
		||||
 | 
			
		||||
  virtual void Instantiatable(void){};
 | 
			
		||||
  // Constructors
 | 
			
		||||
  WilsonCloverFermion(GaugeField &_Umu, GridCartesian &Fgrid,
 | 
			
		||||
@@ -49,9 +51,17 @@ public:
 | 
			
		||||
                      const ImplParams &p = ImplParams()) : WilsonFermion<Impl>(_Umu,
 | 
			
		||||
                                                                                Fgrid,
 | 
			
		||||
                                                                                Hgrid,
 | 
			
		||||
                                                                                _mass, p)
 | 
			
		||||
                                                                                _mass, p), 
 | 
			
		||||
                                                                                Bx(_Umu._grid),
 | 
			
		||||
                                                                                By(_Umu._grid),
 | 
			
		||||
                                                                                Bz(_Umu._grid),
 | 
			
		||||
                                                                                Ex(_Umu._grid),
 | 
			
		||||
                                                                                Ey(_Umu._grid),
 | 
			
		||||
                                                                                Ez(_Umu._grid)
 | 
			
		||||
  {
 | 
			
		||||
    csw = _csw;
 | 
			
		||||
    assert(Nd == 4); // require 4 dimensions
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual RealD M(const FermionField& in, FermionField& out);
 | 
			
		||||
@@ -62,8 +72,18 @@ public:
 | 
			
		||||
  virtual void MooeeInv(const FermionField &in, FermionField &out);
 | 
			
		||||
  virtual void MooeeInvDag(const FermionField &in, FermionField &out);
 | 
			
		||||
 | 
			
		||||
  void ImportGauge(const GaugeField &_Umu);
 | 
			
		||||
private:
 | 
			
		||||
  // here fixing the 4 dimensions, make it more general?
 | 
			
		||||
 | 
			
		||||
  // Field strengths
 | 
			
		||||
  GaugeLinkField Bx, By, Bz, Ex, Ey, Ez;
 | 
			
		||||
 | 
			
		||||
  RealD csw; // Clover coefficient
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // Methods
 | 
			
		||||
  void AddCloverTerm(const FermionField& in, FermionField& out);
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user