mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-10-31 20:14:32 +00:00 
			
		
		
		
	Merge pull request #387 from lehner/feature/gpt
Parity mass terms for domain wall fermions to enable 4d eofa
This commit is contained in:
		| @@ -209,26 +209,27 @@ public: | ||||
|   template<class GaugeStats=PeriodicGaugeStatistics> | ||||
|   static inline void writeConfiguration(Lattice<vLorentzColourMatrixD > &Umu, | ||||
| 					std::string file,  | ||||
| 					std::string ens_label = std::string("DWF")) | ||||
| 					std::string ens_label = std::string("DWF"), | ||||
| 					std::string ens_id = std::string("UKQCD"), | ||||
| 					unsigned int sequence_number = 1) | ||||
|   { | ||||
|     writeConfiguration(Umu,file,0,1,ens_label); | ||||
|     writeConfiguration(Umu,file,0,1,ens_label,ens_id,sequence_number); | ||||
|   } | ||||
|   template<class GaugeStats=PeriodicGaugeStatistics> | ||||
|   static inline void writeConfiguration(Lattice<vLorentzColourMatrixD > &Umu, | ||||
| 					std::string file,  | ||||
| 					int two_row, | ||||
| 					int bits32, | ||||
| 					std::string ens_label = std::string("DWF")) | ||||
| 					std::string ens_label = std::string("DWF"), | ||||
| 					std::string ens_id = std::string("UKQCD"), | ||||
| 					unsigned int sequence_number = 1) | ||||
|   { | ||||
|     typedef vLorentzColourMatrixD vobj; | ||||
|     typedef typename vobj::scalar_object sobj; | ||||
|  | ||||
|     FieldMetaData header; | ||||
|     /////////////////////////////////////////// | ||||
|     // Following should become arguments | ||||
|     /////////////////////////////////////////// | ||||
|     header.sequence_number = 1; | ||||
|     header.ensemble_id     = std::string("UKQCD"); | ||||
|     header.sequence_number = sequence_number; | ||||
|     header.ensemble_id     = ens_id; | ||||
|     header.ensemble_label  = ens_label; | ||||
|  | ||||
|     typedef LorentzColourMatrixD fobj3D; | ||||
|   | ||||
| @@ -68,9 +68,16 @@ public: | ||||
|   /////////////////////////////////////////////////////////////// | ||||
|   // Support for MADWF tricks | ||||
|   /////////////////////////////////////////////////////////////// | ||||
|   RealD Mass(void) { return mass; }; | ||||
|   RealD Mass(void) { return (mass_plus + mass_minus) / 2.0; }; | ||||
|   RealD MassPlus(void) { return mass_plus; }; | ||||
|   RealD MassMinus(void) { return mass_minus; }; | ||||
|   void  SetMass(RealD _mass) {  | ||||
|     mass=_mass;  | ||||
|     mass_plus=mass_minus=_mass;  | ||||
|     SetCoefficientsInternal(_zolo_hi,_gamma,_b,_c);  // Reset coeffs | ||||
|   } ; | ||||
|   void  SetMass(RealD _mass_plus, RealD _mass_minus) {  | ||||
|     mass_plus=_mass_plus; | ||||
|     mass_minus=_mass_minus; | ||||
|     SetCoefficientsInternal(_zolo_hi,_gamma,_b,_c);  // Reset coeffs | ||||
|   } ; | ||||
|   void  P(const FermionField &psi, FermionField &chi); | ||||
| @@ -108,7 +115,7 @@ public: | ||||
|   void   MeooeDag5D    (const FermionField &in, FermionField &out); | ||||
|  | ||||
|   //    protected: | ||||
|   RealD mass; | ||||
|   RealD mass_plus, mass_minus; | ||||
|  | ||||
|   // Save arguments to SetCoefficientsInternal | ||||
|   Vector<Coeff_t> _gamma; | ||||
|   | ||||
| @@ -47,7 +47,7 @@ CayleyFermion5D<Impl>::CayleyFermion5D(GaugeField &_Umu, | ||||
| 			FiveDimRedBlackGrid, | ||||
| 			FourDimGrid, | ||||
| 			FourDimRedBlackGrid,_M5,p), | ||||
|   mass(_mass) | ||||
|   mass_plus(_mass), mass_minus(_mass) | ||||
| {  | ||||
| } | ||||
|  | ||||
| @@ -209,8 +209,8 @@ void CayleyFermion5D<Impl>::M5D   (const FermionField &psi, FermionField &chi) | ||||
| { | ||||
|   int Ls=this->Ls; | ||||
|   Vector<Coeff_t> diag (Ls,1.0); | ||||
|   Vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1]=mass; | ||||
|   Vector<Coeff_t> lower(Ls,-1.0); lower[0]   =mass; | ||||
|   Vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1]=mass_minus; | ||||
|   Vector<Coeff_t> lower(Ls,-1.0); lower[0]   =mass_plus; | ||||
|   M5D(psi,chi,chi,lower,diag,upper); | ||||
| } | ||||
| template<class Impl> | ||||
| @@ -220,8 +220,8 @@ void CayleyFermion5D<Impl>::Meooe5D    (const FermionField &psi, FermionField &D | ||||
|   Vector<Coeff_t> diag = bs; | ||||
|   Vector<Coeff_t> upper= cs; | ||||
|   Vector<Coeff_t> lower= cs;  | ||||
|   upper[Ls-1]=-mass*upper[Ls-1]; | ||||
|   lower[0]   =-mass*lower[0]; | ||||
|   upper[Ls-1]=-mass_minus*upper[Ls-1]; | ||||
|   lower[0]   =-mass_plus*lower[0]; | ||||
|   M5D(psi,psi,Din,lower,diag,upper); | ||||
| } | ||||
| // FIXME Redunant with the above routine; check this and eliminate | ||||
| @@ -235,8 +235,8 @@ template<class Impl> void CayleyFermion5D<Impl>::Meo5D     (const FermionField & | ||||
|     upper[i]=-ceo[i]; | ||||
|     lower[i]=-ceo[i]; | ||||
|   } | ||||
|   upper[Ls-1]=-mass*upper[Ls-1]; | ||||
|   lower[0]   =-mass*lower[0]; | ||||
|   upper[Ls-1]=-mass_minus*upper[Ls-1]; | ||||
|   lower[0]   =-mass_plus*lower[0]; | ||||
|   M5D(psi,psi,chi,lower,diag,upper); | ||||
| } | ||||
| template<class Impl> | ||||
| @@ -250,8 +250,8 @@ void CayleyFermion5D<Impl>::Mooee       (const FermionField &psi, FermionField & | ||||
|     upper[i]=-cee[i]; | ||||
|     lower[i]=-cee[i]; | ||||
|   } | ||||
|   upper[Ls-1]=-mass*upper[Ls-1]; | ||||
|   lower[0]   =-mass*lower[0]; | ||||
|   upper[Ls-1]=-mass_minus*upper[Ls-1]; | ||||
|   lower[0]   =-mass_plus*lower[0]; | ||||
|   M5D(psi,psi,chi,lower,diag,upper); | ||||
| } | ||||
| template<class Impl> | ||||
| @@ -266,9 +266,9 @@ void CayleyFermion5D<Impl>::MooeeDag    (const FermionField &psi, FermionField & | ||||
|     // Assemble the 5d matrix | ||||
|     if ( s==0 ) { | ||||
|       upper[s] = -cee[s+1] ; | ||||
|       lower[s] = mass*cee[Ls-1]; | ||||
|       lower[s] = mass_minus*cee[Ls-1]; | ||||
|     } else if ( s==(Ls-1)) {  | ||||
|       upper[s] = mass*cee[0]; | ||||
|       upper[s] = mass_plus*cee[0]; | ||||
|       lower[s] = -cee[s-1]; | ||||
|     } else { | ||||
|       upper[s]=-cee[s+1]; | ||||
| @@ -291,8 +291,8 @@ void CayleyFermion5D<Impl>::M5Ddag (const FermionField &psi, FermionField &chi) | ||||
|   Vector<Coeff_t> diag(Ls,1.0); | ||||
|   Vector<Coeff_t> upper(Ls,-1.0); | ||||
|   Vector<Coeff_t> lower(Ls,-1.0); | ||||
|   upper[Ls-1]=-mass*upper[Ls-1]; | ||||
|   lower[0]   =-mass*lower[0]; | ||||
|   upper[Ls-1]=-mass_plus*upper[Ls-1]; | ||||
|   lower[0]   =-mass_minus*lower[0]; | ||||
|   M5Ddag(psi,chi,chi,lower,diag,upper); | ||||
| } | ||||
|  | ||||
| @@ -307,9 +307,9 @@ void CayleyFermion5D<Impl>::MeooeDag5D    (const FermionField &psi, FermionField | ||||
|   for (int s=0;s<Ls;s++){ | ||||
|     if ( s== 0 ) { | ||||
|       upper[s] = cs[s+1]; | ||||
|       lower[s] =-mass*cs[Ls-1]; | ||||
|       lower[s] =-mass_minus*cs[Ls-1]; | ||||
|     } else if ( s==(Ls-1) ) {  | ||||
|       upper[s] =-mass*cs[0]; | ||||
|       upper[s] =-mass_plus*cs[0]; | ||||
|       lower[s] = cs[s-1]; | ||||
|     } else {  | ||||
|       upper[s] = cs[s+1]; | ||||
| @@ -552,7 +552,7 @@ void CayleyFermion5D<Impl>::SetCoefficientsInternal(RealD zolo_hi,Vector<Coeff_t | ||||
|        | ||||
|       lee[i] =-cee[i+1]/bee[i]; // sub-diag entry on the ith column | ||||
|        | ||||
|       leem[i]=mass*cee[Ls-1]/bee[0]; | ||||
|       leem[i]=mass_minus*cee[Ls-1]/bee[0]; | ||||
|       for(int j=0;j<i;j++) { | ||||
| 	assert(bee[j+1]!=Coeff_t(0.0)); | ||||
| 	leem[i]*= aee[j]/bee[j+1]; | ||||
| @@ -560,7 +560,7 @@ void CayleyFermion5D<Impl>::SetCoefficientsInternal(RealD zolo_hi,Vector<Coeff_t | ||||
|        | ||||
|       uee[i] =-aee[i]/bee[i];   // up-diag entry on the ith row | ||||
|        | ||||
|       ueem[i]=mass; | ||||
|       ueem[i]=mass_plus; | ||||
|       for(int j=1;j<=i;j++) ueem[i]*= cee[j]/bee[j]; | ||||
|       ueem[i]*= aee[0]/bee[0]; | ||||
|        | ||||
| @@ -573,7 +573,7 @@ void CayleyFermion5D<Impl>::SetCoefficientsInternal(RealD zolo_hi,Vector<Coeff_t | ||||
|   } | ||||
| 	 | ||||
|   {  | ||||
|     Coeff_t delta_d=mass*cee[Ls-1]; | ||||
|     Coeff_t delta_d=mass_minus*cee[Ls-1]; | ||||
|     for(int j=0;j<Ls-1;j++) { | ||||
|       assert(bee[j] != Coeff_t(0.0)); | ||||
|       delta_d *= cee[j]/bee[j]; | ||||
| @@ -642,6 +642,10 @@ void CayleyFermion5D<Impl>::ContractConservedCurrent( PropagatorField &q_in_1, | ||||
| 						      Current curr_type, | ||||
| 						      unsigned int mu) | ||||
| { | ||||
|  | ||||
|   assert(mass_plus == mass_minus); | ||||
|   RealD mass = mass_plus; | ||||
|    | ||||
| #if (!defined(GRID_HIP)) | ||||
|   Gamma::Algebra Gmu [] = { | ||||
|     Gamma::Algebra::GammaX, | ||||
| @@ -777,6 +781,8 @@ void CayleyFermion5D<Impl>::SeqConservedCurrent(PropagatorField &q_in, | ||||
|   assert(mu>=0); | ||||
|   assert(mu<Nd); | ||||
|  | ||||
|   assert(mass_plus == mass_minus); | ||||
|   RealD mass = mass_plus; | ||||
|  | ||||
| #if 0 | ||||
|   int tshift = (mu == Nd-1) ? 1 : 0; | ||||
|   | ||||
| @@ -65,8 +65,11 @@ CompactWilsonCloverFermion<Impl, CloverHelpers>::CompactWilsonCloverFermion(Gaug | ||||
|     csw_r /= clover_anisotropy.xi_0; | ||||
|  | ||||
|   ImportGauge(_Umu); | ||||
|   if (open_boundaries) | ||||
|   if (open_boundaries) { | ||||
|     this->BoundaryMaskEven.Checkerboard() = Even; | ||||
|     this->BoundaryMaskOdd.Checkerboard() = Odd; | ||||
|     CompactHelpers::SetupMasks(this->BoundaryMask, this->BoundaryMaskEven, this->BoundaryMaskOdd); | ||||
|   } | ||||
| } | ||||
|  | ||||
| template<class Impl, class CloverHelpers> | ||||
|   | ||||
| @@ -81,8 +81,8 @@ int main (int argc, char ** argv) | ||||
|     Vector<Coeff_t> diag = Dw.bs; | ||||
|     Vector<Coeff_t> upper= Dw.cs; | ||||
|     Vector<Coeff_t> lower= Dw.cs; | ||||
|     upper[Ls-1]=-Dw.mass*upper[Ls-1]; | ||||
|     lower[0]   =-Dw.mass*lower[0]; | ||||
|     upper[Ls-1]=-Dw.mass_minus*upper[Ls-1]; | ||||
|     lower[0]   =-Dw.mass_plus*lower[0]; | ||||
|      | ||||
|     LatticeFermion r_eo(FGrid); | ||||
|     LatticeFermion src_e (FrbGrid); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user