71 Stencil.BuildSurfaceList(1,vol4);
80 GaugeField HUmu(_Umu.Grid());
86 for (
int mu = 0; mu <
Nd; mu++)
99 Impl::DoubleStore(GaugeGrid(), Umu, HUmu);
111 out.Checkerboard() = in.Checkerboard();
119 out.Checkerboard() = in.Checkerboard();
127 if (in.Checkerboard() ==
Odd) {
137 if (in.Checkerboard() ==
Odd) {
147 out.Checkerboard() = in.Checkerboard();
155 out.Checkerboard() = in.Checkerboard();
162 out.Checkerboard() = in.Checkerboard();
169 out.Checkerboard() = in.Checkerboard();
175 typedef typename FermionField::vector_type vector_type;
176 typedef typename FermionField::scalar_type ScalComplex;
182 Gamma::Algebra Gmu [] = {
183 Gamma::Algebra::GammaX,
184 Gamma::Algebra::GammaY,
185 Gamma::Algebra::GammaZ,
186 Gamma::Algebra::GammaT
192 LatComplex wilson(
_grid); wilson=
Zero();
193 LatComplex
one (
_grid);
one = ScalComplex(1.0,0.0);
196 LatComplex kmu(
_grid);
197 ScalComplex ci(0.0,1.0);
199 for(
int mu=0;mu<
Nd;mu++) {
203 RealD TwoPiL =
M_PI * 2.0/ latt_size[mu];
206 kmu = kmu + TwoPiL *
one * twist[mu];
208 wilson = wilson + 2.0*
sin(kmu*0.5)*
sin(kmu*0.5);
210 num = num -
sin(kmu)*ci*(
Gamma(Gmu[mu])*in);
212 denom=denom +
sin(kmu)*
sin(kmu);
215 wilson = wilson + _m;
217 num = num + wilson*in;
219 denom= denom+wilson*wilson;
234 GaugeField &mat,
const FermionField &A,
235 const FermionField &
B,
int dag) {
238 Compressor compressor(dag);
240 FermionField Btilde(
B.Grid());
241 FermionField Atilde(
B.Grid());
244 st.HaloExchange(
B, compressor);
246 for (
int mu = 0; mu <
Nd; mu++) {
251 if (!dag) gamma +=
Nd;
259 Impl::InsertForce4D(mat, Btilde, Atilde, mu);
270 mat.Checkerboard() =
U.Checkerboard();
283 assert(V.Checkerboard() ==
Even);
284 assert(
U.Checkerboard() ==
Odd);
285 mat.Checkerboard() =
Odd;
297 assert(V.Checkerboard() ==
Odd);
298 assert(
U.Checkerboard() ==
Even);
299 mat.Checkerboard() =
Even;
310 out.Checkerboard() = in.Checkerboard();
321 assert(in.Checkerboard() ==
Even);
322 out.Checkerboard() =
Odd;
333 assert(in.Checkerboard() ==
Odd);
334 out.Checkerboard() =
Even;
354 Stencil.HaloExchange(in, compressor);
356 int skip = (disp == 1) ? 0 : 1;
357 int dirdisp = dir + skip * 4;
358 int gamma = dir + (1 - skip) * 4;
366 Stencil.HaloExchange(in, compressor);
368 assert((out.size()==8)||(out.size()==9));
369 for(
int dir=0;dir<
Nd;dir++){
370 for(
int disp=-1;disp<=1;disp+=2){
372 int skip = (disp == 1) ? 0 : 1;
373 int dirdisp = dir + skip * 4;
374 int gamma = dir + (1 - skip) * 4;
384 uint64_t Nsite=in.oSites();
390 DoubledGaugeField &
U,
391 const FermionField &in,
392 FermionField &out,
int dag)
404 DoubledGaugeField &
U,
405 const FermionField &in,
406 FermionField &out,
int dag)
411 Compressor compressor(dag);
412 int len =
U.Grid()->oSites();
417 std::vector<std::vector<CommsRequest_t> > requests;
421 st.HaloGather(in,compressor);
424 tracePush(
"Communication");
425 st.CommunicateBegin(requests);
432 st.CommsMergeSHM(compressor);
450 st.CommunicateComplete(requests);
451 tracePop(
"Communication");
455 st.CommsMerge(compressor);
473 DoubledGaugeField &
U,
474 const FermionField &in,
475 FermionField &out,
int dag)
479 Compressor compressor(dag);
482 st.HaloExchange(in, compressor);
503 PropagatorField &q_in_2,
504 PropagatorField &q_out,
505 PropagatorField &src,
509 if(curr_type != Current::Vector)
511 std::cout <<
GridLogError <<
"Only the conserved vector current is implemented so far." << std::endl;
515 Gamma g5(Gamma::Algebra::Gamma5);
521 PropagatorField tmp_shifted(UGrid);
522 PropagatorField g5Lg5(UGrid);
523 PropagatorField R(UGrid);
524 PropagatorField gmuR(UGrid);
526 Gamma::Algebra Gmu [] = {
527 Gamma::Algebra::GammaX,
528 Gamma::Algebra::GammaY,
529 Gamma::Algebra::GammaZ,
530 Gamma::Algebra::GammaT,
535 tmp_shifted=
Cshift(q_in_2,mu,1);
536 Impl::multLinkField(R,this->
Umu,tmp_shifted,mu);
540 q_out-=
adj(g5Lg5)*gmuR;
542 tmp_shifted=
Cshift(q_in_1,mu,1);
543 Impl::multLinkField(g5Lg5,this->
Umu,tmp_shifted,mu);
549 q_out-=
adj(g5Lg5)*gmuR;
555 PropagatorField &q_out,
556 PropagatorField &src,
561 ComplexField &lattice_cmplx)
563 if(curr_type != Current::Vector)
565 std::cout <<
GridLogError <<
"Only the conserved vector current is implemented so far." << std::endl;
569 int tshift = (mu ==
Nd-1) ? 1 : 0;
575 PropagatorField
tmp(UGrid);
576 PropagatorField Utmp(UGrid);
577 PropagatorField L(UGrid);
578 PropagatorField zz (UGrid);
582 Gamma::Algebra Gmu [] = {
583 Gamma::Algebra::GammaX,
584 Gamma::Algebra::GammaY,
585 Gamma::Algebra::GammaZ,
586 Gamma::Algebra::GammaT,
591 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu);
592 tmp = ( Utmp*lattice_cmplx - gmu*Utmp*lattice_cmplx );
593 tmp = where((lcoor>=tmin),
tmp,zz);
594 q_out = where((lcoor<=tmax),
tmp,zz);
596 tmp = q_in *lattice_cmplx;
598 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu+
Nd);
599 tmp = -( Utmp + gmu*Utmp );
601 if (tmax == LLt - 1 && tshift == 1){
603 tmp = where(((lcoor==t0) || (lcoor>=tmin+tshift)),
tmp,zz);
605 tmp = where((lcoor>=tmin+tshift),
tmp,zz);
607 q_out+= where((lcoor<=tmax+tshift),
tmp,zz);
AcceleratorVector< int, MaxDims > Coordinate
auto Cshift(const Expression &expr, int dim, int shift) -> decltype(closure(expr))
accelerator_inline Grid_simd< S, V > sin(const Grid_simd< S, V > &r)
const Coordinate & GridDefaultLatt(void)
void axpy(Lattice< vobj > &ret, sobj a, const Lattice< vobj > &x, const Lattice< vobj > &y)
void LatticeCoordinate(Lattice< iobj > &l, int mu)
void PokeIndex(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< Index >(vobj(), 0))> &rhs, int i)
auto PeekIndex(const Lattice< vobj > &lhs, int i) -> Lattice< decltype(peekIndex< Index >(vobj(), i))>
Lattice< vobj > adj(const Lattice< vobj > &lhs)
void pickCheckerboard(int cb, Lattice< vobj > &half, const Lattice< vobj > &full)
GridLogger GridLogError(1, "Error", GridLogColours, "RED")
#define NAMESPACE_BEGIN(A)
static constexpr int DaggerYes
Lattice< vTInteger > LatticeInteger
static constexpr int DaggerNo
static INTERNAL_PRECISION U
void DhopEO(const FermionField &in, FermionField &out, int dag) override
static const std::vector< int > displacements
static const std::vector< int > directions
void DhopInternalSerial(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
void DhopDirCalc(const FermionField &in, FermionField &out, int dirdisp, int gamma, int dag)
void MeooeDag(const FermionField &in, FermionField &out)
void DhopOE(const FermionField &in, FermionField &out, int dag)
void Meooe(const FermionField &in, FermionField &out)
void DhopInternal(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
virtual void Mooee(const FermionField &in, FermionField &out)
void DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
WilsonFermion(GaugeField &_Umu, GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, const ImplParams &p=ImplParams(), const WilsonAnisotropyCoefficients &anis=WilsonAnisotropyCoefficients())
void Dhop(const FermionField &in, FermionField &out, int dag)
WilsonKernels< Impl > Kernels
void SeqConservedCurrent(PropagatorField &q_in, PropagatorField &q_out, PropagatorField &phys_src, Current curr_type, unsigned int mu, unsigned int tmin, unsigned int tmax, ComplexField &lattice_cmplx)
void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
virtual void MomentumSpacePropagator(FermionField &out, const FermionField &in, RealD _mass, std::vector< double > twist)
void ImportGauge(const GaugeField &_Umu)
void DerivInternal(StencilImpl &st, DoubledGaugeField &U, GaugeField &mat, const FermionField &A, const FermionField &B, int dag)
void DhopDir(const FermionField &in, FermionField &out, int dir, int disp)
WilsonAnisotropyCoefficients anisotropyCoeff
void DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void Mdir(const FermionField &in, FermionField &out, int dir, int disp)
virtual void MooeeDag(const FermionField &in, FermionField &out)
virtual void MooeeInv(const FermionField &in, FermionField &out)
void MdirAll(const FermionField &in, std::vector< FermionField > &out)
void ContractConservedCurrent(PropagatorField &q_in_1, PropagatorField &q_in_2, PropagatorField &q_out, PropagatorField &phys_src, Current curr_type, unsigned int mu)
GridBase * GaugeGrid(void)
void DhopDirAll(const FermionField &in, std::vector< FermionField > &out)
void DhopEO(const FermionField &in, FermionField &out, int dag)
void DhopInternalOverlappedComms(StencilImpl &st, DoubledGaugeField &U, const FermionField &in, FermionField &out, int dag)
virtual void M(const FermionField &in, FermionField &out)
virtual void Mdag(const FermionField &in, FermionField &out)
DoubledGaugeField UmuEven
virtual void MooeeInvDag(const FermionField &in, FermionField &out)
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 DhopKernel(int Opt, StencilImpl &st, DoubledGaugeField &U, SiteHalfSpinor *buf, int Ls, int Nsite, const FermionField &in, FermionField &out, int interior=1, int exterior=1)