Grid 0.7.0
ImprovedStaggeredFermion.h
Go to the documentation of this file.
1/*************************************************************************************
2
3Grid physics library, www.github.com/paboyle/Grid
4
5Source file: ./lib/qcd/action/fermion/ImprovedStaggered.h
6
7Copyright (C) 2015
8
9Author: Azusa Yamaguchi, Peter Boyle
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along
22with this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25See the full license in the file "LICENSE" in the top level distribution
26directory
27*************************************************************************************/
28 /* END LEGAL */
29#ifndef GRID_QCD_IMPR_STAG_FERMION_H
30#define GRID_QCD_IMPR_STAG_FERMION_H
31
33
35public:
36 static const std::vector<int> directions;
37 static const std::vector<int> displacements;
38 static const int npoint = 16;
39};
40
41template <class Impl>
43public:
46
47 FermionField _tmp;
48 FermionField &tmp(void) { return _tmp; }
49
51 // Implement the abstract base
53 GridBase *GaugeGrid(void) { return _grid; }
55 GridBase *FermionGrid(void) { return _grid; }
57
59 // override multiply; cut number routines if pass dagger argument
60 // and also make interface more uniformly consistent
62 void M(const FermionField &in, FermionField &out);
63 void Mdag(const FermionField &in, FermionField &out);
64
66 // half checkerboard operations
68 void Meooe(const FermionField &in, FermionField &out);
69 void MeooeDag(const FermionField &in, FermionField &out);
70 void Mooee(const FermionField &in, FermionField &out);
71 void MooeeDag(const FermionField &in, FermionField &out);
72 void MooeeInv(const FermionField &in, FermionField &out);
73 void MooeeInvDag(const FermionField &in, FermionField &out);
74
76 // Derivative interface
78 // Interface calls an internal routine
79 void DhopDeriv (GaugeField &mat, const FermionField &U, const FermionField &V, int dag);
80 void DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag);
81 void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag);
82
84 // non-hermitian hopping term; half cb or both
86 void Dhop (const FermionField &in, FermionField &out, int dag);
87 void DhopOE(const FermionField &in, FermionField &out, int dag);
88 void DhopEO(const FermionField &in, FermionField &out, int dag);
89
91 // Multigrid assistance; force term uses too
93 void Mdir(const FermionField &in, FermionField &out, int dir, int disp);
94 void MdirAll(const FermionField &in, std::vector<FermionField> &out);
95 void DhopDir(const FermionField &in, FermionField &out, int dir, int disp);
96
98 // Extra methods added by derived
100 void DerivInternal(StencilImpl &st,
101 DoubledGaugeField &U,DoubledGaugeField &UUU,
102 GaugeField &mat,
103 const FermionField &A, const FermionField &B, int dag);
104
105 void DhopInternal(StencilImpl &st, DoubledGaugeField &U,DoubledGaugeField &UUU,
106 const FermionField &in, FermionField &out, int dag);
107 void DhopInternalSerialComms(StencilImpl &st, DoubledGaugeField &U,DoubledGaugeField &UUU,
108 const FermionField &in, FermionField &out, int dag);
109 void DhopInternalOverlappedComms(StencilImpl &st, DoubledGaugeField &U,DoubledGaugeField &UUU,
110 const FermionField &in, FermionField &out, int dag);
111
113 // Grid own interface Constructor
115 ImprovedStaggeredFermion(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &Fgrid,
116 GridRedBlackCartesian &Hgrid, RealD _mass,
117 RealD _c1, RealD _c2,RealD _u0,
118 const ImplParams &p = ImplParams());
119
121 // MILC constructor no gauge fields
124 RealD _c1=1.0, RealD _c2=1.0,RealD _u0=1.0,
125 const ImplParams &p = ImplParams());
126
127 // DoubleStore impl dependent
128 void ImportGauge (const GaugeField &_Uthin ) { assert(0); }
129 void ImportGauge(const GaugeField &_Uthin, const GaugeField &_Ufat);
130 void ImportGaugeSimple(const GaugeField &_UUU ,const GaugeField &_U);
131 void ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U);
132 DoubledGaugeField &GetU(void) { return Umu ; } ;
133 DoubledGaugeField &GetUUU(void) { return UUUmu; };
135
137 // Data members require to support the functionality
139
140 // protected:
141public:
142 // any other parameters of action ???
143 virtual int isTrivialEE(void) { return 1; };
144 virtual RealD Mass(void) { return mass; }
149
152
153 // Defines the stencils for even and odd
154 StencilImpl Stencil;
155 StencilImpl StencilEven;
156 StencilImpl StencilOdd;
157 void SloppyComms(int sloppy)
158 {
159 Stencil.SetSloppyComms(sloppy);
160 StencilEven.SetSloppyComms(sloppy);
161 StencilOdd.SetSloppyComms(sloppy);
162 }
163
164 // Copy of the gauge field , with even and odd subsets
165 DoubledGaugeField Umu;
166 DoubledGaugeField UmuEven;
167 DoubledGaugeField UmuOdd;
168
169 DoubledGaugeField UUUmu;
170 DoubledGaugeField UUUmuEven;
171 DoubledGaugeField UUUmuOdd;
172
173
175 // Conserved current utilities
177 void ContractConservedCurrent(PropagatorField &q_in_1,
178 PropagatorField &q_in_2,
179 PropagatorField &q_out,
180 PropagatorField &src,
181 Current curr_type,
182 unsigned int mu);
183 void SeqConservedCurrent(PropagatorField &q_in,
184 PropagatorField &q_out,
185 PropagatorField &srct,
186 Current curr_type,
187 unsigned int mu,
188 unsigned int tmin,
189 unsigned int tmax,
190 ComplexField &lattice_cmplx);
191};
192
195
197
198#endif
ImprovedStaggeredFermion< StaggeredImplD > ImprovedStaggeredFermionD
Definition Fermion.h:441
ImprovedStaggeredFermion< StaggeredImplF > ImprovedStaggeredFermionF
Definition Fermion.h:440
B
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
double RealD
Definition Simd.h:61
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
static const std::vector< int > displacements
static const std::vector< int > directions
void ImportGauge(const GaugeField &_Uthin)
void M(const FermionField &in, FermionField &out)
DoubledGaugeField & GetU(void)
void Meooe(const FermionField &in, FermionField &out)
void ImportGauge(const GaugeField &_Uthin, const GaugeField &_Ufat)
void MooeeInvDag(const FermionField &in, FermionField &out)
void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void MooeeInv(const FermionField &in, FermionField &out)
void DhopDir(const FermionField &in, FermionField &out, int dir, int disp)
ImprovedStaggeredFermion(GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, RealD _c1=1.0, RealD _c2=1.0, RealD _u0=1.0, const ImplParams &p=ImplParams())
void Mdag(const FermionField &in, FermionField &out)
void MdirAll(const FermionField &in, std::vector< FermionField > &out)
void Mdir(const FermionField &in, FermionField &out, int dir, int disp)
DoubledGaugeField & GetUUU(void)
void ImportGaugeSimple(const DoubledGaugeField &_UUU, const DoubledGaugeField &_U)
void Mooee(const FermionField &in, FermionField &out)
void ImportGaugeSimple(const GaugeField &_UUU, const GaugeField &_U)
void SeqConservedCurrent(PropagatorField &q_in, PropagatorField &q_out, PropagatorField &srct, Current curr_type, unsigned int mu, unsigned int tmin, unsigned int tmax, ComplexField &lattice_cmplx)
void MooeeDag(const FermionField &in, FermionField &out)
void DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void Dhop(const FermionField &in, FermionField &out, int dag)
void DhopOE(const FermionField &in, FermionField &out, int dag)
void DerivInternal(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, GaugeField &mat, const FermionField &A, const FermionField &B, int dag)
void DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DhopEO(const FermionField &in, FermionField &out, int dag)
void DhopInternalSerialComms(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag)
void MeooeDag(const FermionField &in, FermionField &out)
void DhopInternal(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag)
void DhopInternalOverlappedComms(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag)
ImprovedStaggeredFermion(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, RealD _c1, RealD _c2, RealD _u0, const ImplParams &p=ImplParams())
void ContractConservedCurrent(PropagatorField &q_in_1, PropagatorField &q_in_2, PropagatorField &q_out, PropagatorField &src, Current curr_type, unsigned int mu)
StaggeredKernels(const ImplParams &p=ImplParams())