From e29b97b3eac9b16bcb1e6f77ebd85c61e967b11e Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Thu, 14 Sep 2023 16:14:03 -0400 Subject: [PATCH] Qslash term added --- Grid/qcd/action/fermion/CayleyFermion5D.h | 5 +++ .../CayleyFermion5DImplementation.h | 40 ++++++++++++++++++- tests/solver/Test_dwf_cg_prec.cc | 8 +++- tests/solver/Test_dwf_cg_unprec.cc | 26 +++++++++++- 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/Grid/qcd/action/fermion/CayleyFermion5D.h b/Grid/qcd/action/fermion/CayleyFermion5D.h index cf39ec99..fb20a958 100644 --- a/Grid/qcd/action/fermion/CayleyFermion5D.h +++ b/Grid/qcd/action/fermion/CayleyFermion5D.h @@ -124,6 +124,11 @@ public: RealD _b; RealD _c; + // possible boost + std::vector qmu; + void set_qmu(std::vector _qmu) { qmu=_qmu; assert(qmu.size()==Nd);}; + void addQmu(const FermionField &in, FermionField &out, int dag); + // Cayley form Moebius (tanh and zolotarev) Vector omega; Vector bs; // S dependent coeffs diff --git a/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h b/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h index 2b8a3a18..befdf0ed 100644 --- a/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h +++ b/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h @@ -48,7 +48,8 @@ CayleyFermion5D::CayleyFermion5D(GaugeField &_Umu, FourDimGrid, FourDimRedBlackGrid,_M5,p), mass_plus(_mass), mass_minus(_mass) -{ +{ + // qmu defaults to zero size; } /////////////////////////////////////////////////////////////// @@ -270,6 +271,34 @@ void CayleyFermion5D::MeooeDag5D (const FermionField &psi, FermionField M5Ddag(psi,psi,Din,lower,diag,upper); } +template +void CayleyFermion5D::addQmu(const FermionField &psi,FermionField &chi, int dag) +{ + if ( qmu.size() ) { + + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT + }; + std::vector coeff(Nd); + ComplexD ci(0,1); + + assert(qmu.size()==Nd); + + for(int mu=0;mu void CayleyFermion5D::M (const FermionField &psi, FermionField &chi) { @@ -277,8 +306,12 @@ void CayleyFermion5D::M (const FermionField &psi, FermionField &chi) // Assemble Din Meooe5D(psi,Din); - + this->DW(Din,chi,DaggerNo); + + // add i q_mu gamma_mu here + addQmu(Din,chi,DaggerNo); + // ((b D_W + D_w hop terms +1) on s-diag axpby(chi,1.0,1.0,chi,psi); @@ -295,6 +328,9 @@ void CayleyFermion5D::Mdag (const FermionField &psi, FermionField &chi) FermionField Din(psi.Grid()); // Apply Dw this->DW(psi,Din,DaggerYes); + + // add -i conj(q_mu) gamma_mu here ... if qmu is real, gammm_5 hermitian, otherwise not. + addQmu(psi,Din,DaggerYes); MeooeDag5D(Din,chi); diff --git a/tests/solver/Test_dwf_cg_prec.cc b/tests/solver/Test_dwf_cg_prec.cc index f4e346bf..af3f4cf0 100644 --- a/tests/solver/Test_dwf_cg_prec.cc +++ b/tests/solver/Test_dwf_cg_prec.cc @@ -1,4 +1,4 @@ -/************************************************************************************* +************************************************************************************* Grid physics library, www.github.com/paboyle/Grid @@ -67,7 +67,13 @@ int main(int argc, char** argv) { result = Zero(); LatticeGaugeField Umu(UGrid); +#if 0 + FieldMetaData header; + std::string file("ckpoint_lat.4000"); + NerscIO::readConfiguration(Umu,header,file); +#else SU::HotConfiguration(RNG4, Umu); +#endif std::cout << GridLogMessage << "Lattice dimensions: " << GridDefaultLatt() << " Ls: " << Ls << std::endl; diff --git a/tests/solver/Test_dwf_cg_unprec.cc b/tests/solver/Test_dwf_cg_unprec.cc index 58614c49..7435bfae 100644 --- a/tests/solver/Test_dwf_cg_unprec.cc +++ b/tests/solver/Test_dwf_cg_unprec.cc @@ -54,15 +54,30 @@ int main (int argc, char ** argv) GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); + std::vector qmu; + qmu.push_back(ComplexD(0.1,0.0)); + qmu.push_back(ComplexD(0.0,0.0)); + qmu.push_back(ComplexD(0.0,0.0)); + qmu.push_back(ComplexD(0.0,0.01)); + + std::vector seeds4({1,2,3,4}); std::vector seeds5({5,6,7,8}); GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); + LatticeFermion tmp(FGrid); LatticeFermion src(FGrid); random(RNG5,src); LatticeFermion result(FGrid); result=Zero(); - LatticeGaugeField Umu(UGrid); SU::HotConfiguration(RNG4,Umu); - + LatticeGaugeField Umu(UGrid); +#if 0 + FieldMetaData header; + std::string file("ckpoint_lat.4000"); + NerscIO::readConfiguration(Umu,header,file); +#else + SU::HotConfiguration(RNG4,Umu); +#endif + std::vector U(4,UGrid); for(int mu=0;mu(Umu,mu); @@ -71,8 +86,15 @@ int main (int argc, char ** argv) RealD mass=0.1; RealD M5=1.8; DomainWallFermionD Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + Ddwf.qmu = qmu; + Ddwf.M(src,tmp); + std::cout << " |M src|^2 "< HermOp(Ddwf); + HermOp.HermOp(src,tmp); + + std::cout << " "< CG(1.0e-6,10000); CG(HermOp,src,result);