49 RealD _M5,
const ImplParams &p) :
62 _tmp(&FiveDimRedBlackGrid),
94 if ( p.dirichlet.size() ==
Nd+1) {
96 if ( block[0] || block[1] || block[2] || block[3] || block[4] ){
98 std::cout <<
GridLogMessage <<
" WilsonFermion: non-trivial Dirichlet condition "<< block << std::endl;
99 std::cout <<
GridLogMessage <<
" WilsonFermion: partial Dirichlet "<< p.partialDirichlet << std::endl;
107 if (Impl::LsVectorised) {
109 int nsimd = Simd::Nsimd();
115 for(
int d=0;d<4;d++){
134 vol4=FourDimGrid.
oSites();
137 vol4=FourDimRedBlackGrid.
oSites();
146 GaugeField HUmu(_Umu.Grid());
150 if ( this->Params.partialDirichlet ) {
156 std:: cout <<
GridLogMessage <<
"Checking block size multiple of rank boundaries for Dirichlet"<<std::endl;
157 for(
int d=0;d<
Nd;d++) {
158 int GaugeBlock = Block[d+1];
159 int ldim=GaugeGrid()->LocalDimensions()[d];
160 if (GaugeBlock) assert( (GaugeBlock%ldim)==0);
163 if (!this->Params.partialDirichlet) {
164 std::cout <<
GridLogMessage <<
" Dirichlet filtering gauge field BCs block " <<Block<<std::endl;
166 for(
int d=0;d<
Nd;d++) GaugeBlock[d] = Block[d+1];
170 std::cout <<
GridLogMessage <<
" Dirichlet "<< Dirichlet <<
" NOT filtered gauge field" <<std::endl;
173 Impl::DoubleStore(GaugeGrid(),Umu,HUmu);
185 int skip = (disp==1) ? 0 : 1;
186 int dirdisp = dir+skip*4;
187 int gamma = dir+(1-skip)*4;
190 Stencil.HaloExchange(in,compressor);
192 uint64_t Nsite =
Umu.Grid()->oSites();
200 Stencil.HaloExchange(in,compressor);
201 uint64_t Nsite =
Umu.Grid()->oSites();
208 DoubledGaugeField &
U,
210 const FermionField &A,
211 const FermionField &
B,
219 Compressor compressor(dag);
221 FermionField Btilde(
B.Grid());
222 FermionField Atilde(
B.Grid());
224 st.HaloExchange(
B,compressor);
227 int LLs =
B.Grid()->_rdimensions[0];
230 for (
int mu = 0; mu <
Nd; mu++) {
235 if (!dag) gamma +=
Nd;
241 int Usites =
U.Grid()->oSites();
248 Impl::InsertForce5D(mat, Btilde, Atilde, mu);
254 const FermionField &A,
255 const FermionField &
B,
263 mat.Checkerboard() = A.Checkerboard();
271 const FermionField &A,
272 const FermionField &
B,
278 assert(
B.Checkerboard()==
Odd);
279 assert(A.Checkerboard()==
Even);
280 mat.Checkerboard() =
Even;
288 const FermionField &A,
289 const FermionField &
B,
295 assert(
B.Checkerboard()==
Even);
296 assert(A.Checkerboard()==
Odd);
297 mat.Checkerboard() =
Odd;
304 DoubledGaugeField &
U,
305 const FermionField &in, FermionField &out,
int dag)
316 DoubledGaugeField &
U,
317 const FermionField &in, FermionField &out,
int dag)
320 Compressor compressor(dag);
322 int LLs = in.Grid()->_rdimensions[0];
323 int len =
U.Grid()->oSites();
331 st.HaloExchangeOptGather(in,compressor);
335 std::vector<std::vector<CommsRequest_t> > requests;
341 st.CommunicateBegin(requests);
342 st.CommsMergeSHM(compressor);
362 st.CommunicateBegin(requests);
363 st.CommsMergeSHM(compressor);
371 st.CommunicateComplete(requests);
380 st.CommsMerge(compressor);
398 DoubledGaugeField &
U,
399 const FermionField &in,
400 FermionField &out,
int dag)
403 Compressor compressor(dag);
405 int LLs = in.Grid()->_rdimensions[0];
410 st.HaloExchangeOpt(in,compressor);
432 assert(in.Checkerboard()==
Even);
433 out.Checkerboard() =
Odd;
443 assert(in.Checkerboard()==
Odd);
444 out.Checkerboard() =
Even;
454 out.Checkerboard() = in.Checkerboard();
455 Compressor compressor(dag);
456 Stencil.HaloExchangeOpt(in,compressor);
464 out.Checkerboard() = in.Checkerboard();
466 int LLs = in.Grid()->_rdimensions[0];
477 out.Checkerboard() = in.Checkerboard();
484 out.Checkerboard()=in.Checkerboard();
491 if (in.Checkerboard() ==
Odd) {
501 if (in.Checkerboard() ==
Odd) {
511 out.Checkerboard() = in.Checkerboard();
512 typename FermionField::scalar_type scal(4.0 +
M5);
519 out.Checkerboard() = in.Checkerboard();
526 out.Checkerboard() = in.Checkerboard();
527 out = (1.0/(4.0 +
M5))*in;
533 out.Checkerboard() = in.Checkerboard();
546 FermionField PRsource(_5dgrid);
547 FermionField PLsource(_5dgrid);
548 FermionField buf1_4d(_grid);
549 FermionField buf2_4d(_grid);
550 FermionField GR(_5dgrid);
551 FermionField GL(_5dgrid);
552 FermionField bufL_4d(_grid);
553 FermionField bufR_4d(_grid);
555 unsigned int Ls = in.Grid()->_rdimensions[0];
557 typedef typename FermionField::vector_type vector_type;
558 typedef typename FermionField::scalar_type ScalComplex;
562 Gamma::Algebra Gmu [] = {
563 Gamma::Algebra::GammaX,
564 Gamma::Algebra::GammaY,
565 Gamma::Algebra::GammaZ,
566 Gamma::Algebra::GammaT
569 Gamma g5(Gamma::Algebra::Gamma5);
573 LatComplex sk(_grid); sk =
Zero();
574 LatComplex sk2(_grid); sk2=
Zero();
575 LatComplex
W(_grid);
W=
Zero();
576 LatComplex
one (_grid);
one = ScalComplex(1.0,0.0);
577 LatComplex cosha(_grid);
578 LatComplex kmu(_grid);
579 LatComplex Wea(_grid);
580 LatComplex Wema(_grid);
581 LatComplex ea(_grid);
582 LatComplex ema(_grid);
583 LatComplex eaLs(_grid);
584 LatComplex emaLs(_grid);
585 LatComplex ea2Ls(_grid);
586 LatComplex ema2Ls(_grid);
587 LatComplex sinha(_grid);
588 LatComplex sinhaLs(_grid);
589 LatComplex coshaLs(_grid);
592 LatComplex App(_grid);
593 LatComplex Amm(_grid);
594 LatComplex Bpp(_grid);
595 LatComplex Bmm(_grid);
596 LatComplex ABpm(_grid);
597 LatComplex signW(_grid);
599 ScalComplex ci(0.0,1.0);
601 for(
int mu=0;mu<
Nd;mu++) {
605 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
608 kmu = kmu + TwoPiL *
one * twist[mu];
610 sk2 = sk2 + 2.0*
sin(kmu*0.5)*
sin(kmu*0.5);
611 sk = sk +
sin(kmu) *
sin(kmu);
621 ea = (cosha +
sqrt(cosha*cosha-
one));
622 ema= (cosha -
sqrt(cosha*cosha-
one));
625 ea2Ls =
pow(ea,2.0*
Ls);
626 ema2Ls=
pow(ema,2.0*
Ls);
631 sinha = 0.5*(ea - ema);
632 sinhaLs = 0.5*(eaLs-emaLs);
633 coshaLs = 0.5*(eaLs+emaLs);
635 A =
one / (
abs(
W) * sinha * 2.0) *
one / (sinhaLs * 2.0);
636 F = eaLs * (
one - Wea + (Wema -
one) * mass*mass);
637 F =
F + emaLs * (Wema -
one + (
one - Wea) * mass*mass);
638 F =
F -
abs(
W) * sinha * 4.0 * mass;
640 Bpp = (A/
F) * (ema2Ls -
one) * (
one - Wema) * (
one - mass*mass *
one);
641 Bmm = (A/
F) * (
one - ea2Ls) * (
one - Wea) * (
one - mass*mass *
one);
642 App = (A/
F) * (ema2Ls -
one) * ema * (ema -
abs(
W)) * (
one - mass*mass *
one);
643 Amm = (A/
F) * (
one - ea2Ls) * ea * (ea -
abs(
W)) * (
one - mass*mass *
one);
644 ABpm = (A/
F) *
abs(
W) * sinha * 2.0 * (
one + mass * coshaLs * 2.0 + mass*mass *
one);
647 PRsource = (in + g5 * in) * 0.5;
648 PLsource = (in - g5 * in) * 0.5;
651 for(
unsigned int ss=1;ss<=
Ls;ss++)
655 for(
unsigned int tt=1;tt<=
Ls;tt++)
658 if((ss+tt)%2==1) signW =
abs(
W)/
W;
661 unsigned int f = (ss > tt) ? ss-tt : tt-ss;
666 bufR_4d = bufR_4d + A * eaLs *
pow(ema,f) * signW * buf1_4d + A * emaLs *
pow(ea,f) * signW * buf1_4d;
668 bufR_4d = bufR_4d + App *
pow(ea,ss) *
pow(ea,tt) * signW * buf1_4d ;
670 bufR_4d = bufR_4d + ABpm *
pow(ea,ss) *
pow(ema,tt) * signW * buf1_4d ;
672 bufR_4d = bufR_4d + ABpm *
pow(ema,ss) *
pow(ea,tt) * signW * buf1_4d ;
674 bufR_4d = bufR_4d + Amm *
pow(ema,ss) *
pow(ema,tt) * signW * buf1_4d ;
680 bufL_4d = bufL_4d + A * eaLs *
pow(ema,f) * signW * buf2_4d + A * emaLs *
pow(ea,f) * signW * buf2_4d;
682 bufL_4d = bufL_4d + Bpp *
pow(ea,ss) *
pow(ea,tt) * signW * buf2_4d ;
684 bufL_4d = bufL_4d + ABpm *
pow(ea,ss) *
pow(ema,tt) * signW * buf2_4d ;
686 bufL_4d = bufL_4d + ABpm *
pow(ema,ss) *
pow(ea,tt) * signW * buf2_4d ;
688 bufL_4d = bufL_4d + Bmm *
pow(ema,ss) *
pow(ema,tt) * signW * buf2_4d ;
695 for(
unsigned int ss=1;ss<=
Ls;ss++)
704 for(
int mu=0;mu<
Nd;mu++) {
706 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
707 kmu = TwoPiL * kmu + TwoPiL *
one * twist[mu];
708 buf2_4d = buf2_4d +
sin(kmu)*ci*(
Gamma(Gmu[mu])*buf1_4d);
710 bufL_4d = buf2_4d -
W * buf1_4d;
716 for(
int mu=0;mu<
Nd;mu++) {
718 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
719 kmu = TwoPiL * kmu + TwoPiL *
one * twist[mu];
720 buf2_4d = buf2_4d +
sin(kmu)*ci*(
Gamma(Gmu[mu])*buf1_4d);
722 bufR_4d = buf2_4d -
W * buf1_4d;
727 bufL_4d = bufL_4d - mass*buf1_4d;
731 bufL_4d = bufL_4d + buf1_4d;
737 bufR_4d = bufR_4d - mass*buf1_4d;
741 bufR_4d = bufR_4d + buf1_4d;
743 buf1_4d = bufL_4d + bufR_4d;
758 typedef typename FermionField::vector_type vector_type;
759 typedef typename FermionField::scalar_type ScalComplex;
763 Gamma::Algebra Gmu [] = {
764 Gamma::Algebra::GammaX,
765 Gamma::Algebra::GammaY,
766 Gamma::Algebra::GammaZ,
767 Gamma::Algebra::GammaT
773 FermionField num (_grid); num =
Zero();
775 LatComplex sk(_grid); sk =
Zero();
776 LatComplex sk2(_grid); sk2=
Zero();
777 LatComplex
W(_grid);
W=
Zero();
778 LatComplex a(_grid); a=
Zero();
779 LatComplex
one (_grid);
one = ScalComplex(1.0,0.0);
780 LatComplex denom(_grid); denom=
Zero();
781 LatComplex cosha(_grid);
782 LatComplex kmu(_grid);
783 LatComplex Wea(_grid);
784 LatComplex Wema(_grid);
786 ScalComplex ci(0.0,1.0);
788 for(
int mu=0;mu<
Nd;mu++) {
792 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
795 kmu = kmu + TwoPiL *
one * twist[mu];
797 sk2 = sk2 + 2.0*
sin(kmu*0.5)*
sin(kmu*0.5);
798 sk = sk +
sin(kmu) *
sin(kmu);
800 num = num -
sin(kmu)*ci*(
Gamma(Gmu[mu])*in);
814 num = num + (
one - Wema ) * mass * in;
815 denom= ( Wea -
one ) + mass*mass * (
one - Wema);
822 std::vector<double> empty_q(
Nd,0.0);
828 std::vector<double> twist,
829 std::vector<double> qmu)
831 Gamma::Algebra Gmu [] = {
832 Gamma::Algebra::GammaX,
833 Gamma::Algebra::GammaY,
834 Gamma::Algebra::GammaZ,
835 Gamma::Algebra::GammaT
841 typedef typename FermionField::vector_type vector_type;
842 typedef typename FermionField::scalar_type ScalComplex;
850 LatComplex sk(_grid); sk =
Zero();
851 LatComplex sk2(_grid); sk2=
Zero();
853 LatComplex w_k(_grid); w_k=
Zero();
854 LatComplex b_k(_grid); b_k=
Zero();
856 LatComplex
one (_grid);
one = ScalComplex(1.0,0.0);
858 FermionField num (_grid); num =
Zero();
859 LatComplex denom(_grid); denom=
Zero();
860 LatComplex kmu(_grid);
861 ScalComplex ci(0.0,1.0);
863 std::cout<<
"Feynman Rule" <<
"qmu ("<<qmu[0]<<
","<<qmu[1]<<
","<<qmu[2]<<
","<<qmu[3]<<
")"<<std::endl;
865 for(
int mu=0;mu<
Nd;mu++) {
869 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
872 kmu = kmu + TwoPiL *
one * twist[mu];
874 sk2 = sk2 + 2.0*
sin(kmu*0.5)*
sin(kmu*0.5);
876 sk = sk + (
sin(kmu)+qmu[mu])*(
sin(kmu)+qmu[mu]);
886 num = num - (
sin(kmu)+qmu[mu])*ci*(
Gamma(Gmu[mu])*in);
889 num = num + mass * in ;
893 w_k =
sqrt(sk + b_k*b_k);
895 denom= ( w_k + b_k + mass*mass) ;
AcceleratorVector< int, MaxDims > Coordinate
accelerator_inline Grid_simd< S, V > abs(const Grid_simd< S, V > &r)
accelerator_inline Grid_simd< S, V > sin(const Grid_simd< S, V > &r)
accelerator_inline Grid_simd< S, V > sqrt(const Grid_simd< S, V > &r)
void axpy(Lattice< vobj > &ret, sobj a, const Lattice< vobj > &x, const Lattice< vobj > &y)
void LatticeCoordinate(Lattice< iobj > &l, int mu)
void InsertSlice(const Lattice< vobj > &lowDim, Lattice< vobj > &higherDim, int slice, int orthog)
void ExtractSlice(Lattice< vobj > &lowDim, const Lattice< vobj > &higherDim, int slice, int orthog)
void pickCheckerboard(int cb, Lattice< vobj > &half, const Lattice< vobj > &full)
Lattice< obj > pow(const Lattice< obj > &rhs_i, RealD y)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
static constexpr int DaggerYes
iScalar< iScalar< iScalar< vtype > > > iSinglet
static constexpr int DaggerNo
iScalar< iMatrix< iScalar< vtype >, Ns > > iSpinMatrix
static INTERNAL_PRECISION U
static INTERNAL_PRECISION F
unsigned long _ndimension
static const std::vector< int > displacements
static constexpr int npoint
static const std::vector< int > directions
void ImportGauge(const GaugeField &_Umu)
void DhopInternalOverlappedComms(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
virtual void MooeeInvDag(const FermionField &in, FermionField &out)
virtual void MooeeDag(const FermionField &in, FermionField &out)
void DhopComms(const FermionField &in, FermionField &out)
DoubledGaugeField UmuEven
GridBase * _FiveDimRedBlackGrid
void MomentumSpacePropagatorHwQ(FermionField &out, const FermionField &in, RealD mass, std::vector< double > twist, std::vector< double > qmu)
WilsonKernels< Impl > Kernels
void DhopCalc(const FermionField &in, FermionField &out, uint64_t *ids)
virtual void MooeeInv(const FermionField &in, FermionField &out)
void DhopInternal(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
virtual void Meooe(const FermionField &in, FermionField &out)
void DhopInternalSerialComms(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
void MomentumSpacePropagatorHt(FermionField &out, const FermionField &in, RealD mass, std::vector< double > twist)
GridBase * FermionGrid(void)
virtual void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DW(const FermionField &in, FermionField &out, int dag)
void DhopDir(const FermionField &in, FermionField &out, int dir, int disp)
void DhopDirAll(const FermionField &in, std::vector< FermionField > &out)
void MomentumSpacePropagatorHw(FermionField &out, const FermionField &in, RealD mass, std::vector< double > twist)
virtual void MeooeDag(const FermionField &in, FermionField &out)
WilsonFermion5D(GaugeField &_Umu, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _M5, const ImplParams &p=ImplParams())
virtual void DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DhopEO(const FermionField &in, FermionField &out, int dag)
GridBase * _FourDimRedBlackGrid
GridBase * FermionRedBlackGrid(void)
virtual void DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
virtual void Mooee(const FermionField &in, FermionField &out)
void Dhop(const FermionField &in, FermionField &out, int dag)
void DerivInternal(StencilImpl &st, DoubledGaugeField &U, GaugeField &mat, const FermionField &A, const FermionField &B, int dag)
void DhopOE(const FermionField &in, FermionField &out, int dag)
void MomentumSpacePropagatorHt_5d(FermionField &out, const FermionField &in, RealD mass, std::vector< double > twist)
static void DhopDagKernel(int Opt, StencilImpl &st, DoubledGaugeField &U, SiteHalfSpinor *buf, int Ls, int Nsite, const FermionField &in, FermionField &out, int interior=1, int exterior=1)
static void DhopDirKernel(StencilImpl &st, DoubledGaugeField &U, SiteHalfSpinor *buf, int Ls, int Nsite, const FermionField &in, FermionField &out, int dirdisp, int gamma)
static void DhopDirAll(StencilImpl &st, DoubledGaugeField &U, SiteHalfSpinor *buf, int Ls, int Nsite, const FermionField &in, std::vector< FermionField > &out)
static void DhopKernel(int Opt, StencilImpl &st, DoubledGaugeField &U, SiteHalfSpinor *buf, int Ls, int Nsite, const FermionField &in, FermionField &out, int interior=1, int exterior=1)
void applyFilter(MomentaField &P) const override