Grid 0.7.0
ImprovedStaggeredFermion5D.h
Go to the documentation of this file.
1/*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/qcd/action/fermion/ImprovedStaggeredFermion5D.h
6
7 Copyright (C) 2015
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10Author: AzusaYamaguchi <ayamaguc@staffmail.ed.ac.uk>
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
26 See the full license in the file "LICENSE" in the top level distribution directory
27*************************************************************************************/
28/* END LEGAL */
29#pragma once
30
32
34// This is the 4d red black case appropriate to support
36
38public:
39 // S-direction is INNERMOST and takes no part in the parity.
40 static const std::vector<int> directions;
41 static const std::vector<int> displacements;
42 const int npoint = 16;
43};
44
45template<class Impl>
47{
48public:
51
52 FermionField _tmp;
53 FermionField &tmp(void) { return _tmp; }
54
56 // Implement the abstract base
58 GridBase *GaugeGrid(void) { return _FourDimGrid ;}
62
63 // full checkerboard operations; leave unimplemented as abstract for now
64 void M (const FermionField &in, FermionField &out);
65 void Mdag (const FermionField &in, FermionField &out);
66
67 // half checkerboard operations
68 void Meooe (const FermionField &in, FermionField &out);
69 void Mooee (const FermionField &in, FermionField &out);
70 void MooeeInv (const FermionField &in, FermionField &out);
71
72 void MeooeDag (const FermionField &in, FermionField &out);
73 void MooeeDag (const FermionField &in, FermionField &out);
74 void MooeeInvDag (const FermionField &in, FermionField &out);
75
76 void Mdir (const FermionField &in, FermionField &out,int dir,int disp);
77 void MdirAll(const FermionField &in, std::vector<FermionField> &out);
78 void DhopDir(const FermionField &in, FermionField &out,int dir,int disp);
79
80 // These can be overridden by fancy 5d chiral action
81 void DhopDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag);
82 void DhopDerivEO(GaugeField &mat,const FermionField &U,const FermionField &V,int dag);
83 void DhopDerivOE(GaugeField &mat,const FermionField &U,const FermionField &V,int dag);
84
85 // Implement hopping term 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
90
92 // New methods added
94 void DerivInternal(StencilImpl & st,
95 DoubledGaugeField & U,
96 DoubledGaugeField & UUU,
97 GaugeField &mat,
98 const FermionField &A,
99 const FermionField &B,
100 int dag);
101
102 void DhopInternal(StencilImpl & st,
103 DoubledGaugeField &U,
104 DoubledGaugeField &UUU,
105 const FermionField &in,
106 FermionField &out,
107 int dag);
108
109 void DhopInternalOverlappedComms(StencilImpl & st,
110 DoubledGaugeField &U,
111 DoubledGaugeField &UUU,
112 const FermionField &in,
113 FermionField &out,
114 int dag);
115
116 void DhopInternalSerialComms(StencilImpl & st,
117 DoubledGaugeField &U,
118 DoubledGaugeField &UUU,
119 const FermionField &in,
120 FermionField &out,
121 int dag);
122
123
124 // Constructors
126 // Grid internal interface -- Thin link and fat link, with coefficients
128 ImprovedStaggeredFermion5D(GaugeField &_Uthin,
129 GaugeField &_Ufat,
130 GridCartesian &FiveDimGrid,
131 GridRedBlackCartesian &FiveDimRedBlackGrid,
132 GridCartesian &FourDimGrid,
133 GridRedBlackCartesian &FourDimRedBlackGrid,
134 double _mass,
135 RealD _c1, RealD _c2,RealD _u0,
136 const ImplParams &p= ImplParams());
138 // MILC constructor ; triple links, no rescale factors; must be externally pre multiplied
141 GridRedBlackCartesian &FiveDimRedBlackGrid,
142 GridCartesian &FourDimGrid,
143 GridRedBlackCartesian &FourDimRedBlackGrid,
144 double _mass,
145 RealD _c1=1.0, RealD _c2=1.0,RealD _u0=1.0,
146 const ImplParams &p= ImplParams());
147
148 // DoubleStore gauge field in operator
149 void ImportGauge (const GaugeField &_Uthin ) { assert(0); }
150 void ImportGauge(const GaugeField &_Uthin,const GaugeField &_Ufat);
151 void ImportGaugeSimple(const GaugeField &_UUU,const GaugeField &_U);
152 void ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U);
153 // Give a reference; can be used to do an assignment or copy back out after import
154 // if Carleton wants to cache them and not use the ImportSimple
155 DoubledGaugeField &GetU(void) { return Umu ; } ;
156 DoubledGaugeField &GetUUU(void) { return UUUmu; };
158
160 // Data members require to support the functionality
162public:
163
164 virtual int isTrivialEE(void) { return 1; };
165 virtual RealD Mass(void) { return mass; }
166
171
176 int Ls;
177
178 //Defines the stencils for even and odd
179 StencilImpl Stencil;
180 StencilImpl StencilEven;
181 StencilImpl StencilOdd;
182 void SloppyComms(int sloppy)
183 {
184 Stencil.SetSloppyComms(sloppy);
185 StencilEven.SetSloppyComms(sloppy);
186 StencilOdd.SetSloppyComms(sloppy);
187 }
188
189 // Copy of the gauge field , with even and odd subsets
190 DoubledGaugeField Umu;
191 DoubledGaugeField UmuEven;
192 DoubledGaugeField UmuOdd;
193
194 DoubledGaugeField UUUmu;
195 DoubledGaugeField UUUmuEven;
196 DoubledGaugeField UUUmuOdd;
197
198
199 // Comms buffer
200 // std::vector<SiteHalfSpinor,alignedAllocator<SiteHalfSpinor> > comm_buf;
201
203 // Conserved current utilities
205 void ContractConservedCurrent(PropagatorField &q_in_1,
206 PropagatorField &q_in_2,
207 PropagatorField &q_out,
208 PropagatorField &src,
209 Current curr_type,
210 unsigned int mu);
211 void SeqConservedCurrent(PropagatorField &q_in,
212 PropagatorField &q_out,
213 PropagatorField &src,
214 Current curr_type,
215 unsigned int mu,
216 unsigned int tmin,
217 unsigned int tmax,
218 ComplexField &lattice_cmplx);
219};
220
222
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 Mdag(const FermionField &in, FermionField &out)
void MdirAll(const FermionField &in, std::vector< FermionField > &out)
void Mooee(const FermionField &in, FermionField &out)
void DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void ImportGauge(const GaugeField &_Uthin)
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 DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
ImprovedStaggeredFermion5D(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _mass, RealD _c1, RealD _c2, RealD _u0, const ImplParams &p=ImplParams())
void MooeeDag(const FermionField &in, FermionField &out)
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 M(const FermionField &in, FermionField &out)
void Mdir(const FermionField &in, FermionField &out, int dir, int disp)
void ImportGaugeSimple(const DoubledGaugeField &_UUU, const DoubledGaugeField &_U)
void ContractConservedCurrent(PropagatorField &q_in_1, PropagatorField &q_in_2, PropagatorField &q_out, PropagatorField &src, Current curr_type, unsigned int mu)
void DhopInternalOverlappedComms(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag)
void MooeeInvDag(const FermionField &in, FermionField &out)
ImprovedStaggeredFermion5D(GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _mass, RealD _c1=1.0, RealD _c2=1.0, RealD _u0=1.0, const ImplParams &p=ImplParams())
void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void MooeeInv(const FermionField &in, FermionField &out)
void Meooe(const FermionField &in, FermionField &out)
void Dhop(const FermionField &in, FermionField &out, int dag)
void DhopDir(const FermionField &in, FermionField &out, int dir, int disp)
void MeooeDag(const FermionField &in, FermionField &out)
void SeqConservedCurrent(PropagatorField &q_in, PropagatorField &q_out, PropagatorField &src, Current curr_type, unsigned int mu, unsigned int tmin, unsigned int tmax, ComplexField &lattice_cmplx)
void DhopInternal(StencilImpl &st, DoubledGaugeField &U, DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag)
void ImportGauge(const GaugeField &_Uthin, const GaugeField &_Ufat)
void ImportGaugeSimple(const GaugeField &_UUU, const GaugeField &_U)
StaggeredKernels(const ImplParams &p=ImplParams())