CHROMA
lwldslash_3d_qdp_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson Dslash linear operator
3  */
4 
5 #include "chromabase.h"
7 
8 #if QDP_NS == 4
9 #if QDP_NC == 3
10 #if QDP_ND == 4
11 
12 namespace Chroma
13 {
14  //! General Wilson-Dirac dslash
15  /*! \ingroup linop
16  * DSLASH
17  *
18  * This routine is specific to Wilson fermions!
19  *
20  * Description:
21  *
22  * This routine applies the operator D' to Psi, putting the result in Chi.
23  *
24  * Nd-1
25  * ---
26  * \
27  * chi(x) := > U (x) (1 - isign gamma ) psi(x+mu)
28  * / mu mu
29  * ---
30  * mu=0
31  *
32  * Nd-1
33  * ---
34  * \ +
35  * + > U (x-mu) (1 + isign gamma ) psi(x-mu)
36  * / mu mu
37  * ---
38  * mu=0
39  *
40  */
41 
42  //! Empty constructor
43  QDPWilsonDslash3D::QDPWilsonDslash3D() {}
44 
45  //! Full constructor
46  QDPWilsonDslash3D::QDPWilsonDslash3D(Handle< FermState<T,P,Q> > state)
47  {
48  create(state);
49  }
50 
51 
52  //! Full constructor with anisotropy
53  QDPWilsonDslash3D::QDPWilsonDslash3D(Handle< FermState<T,P,Q> > state,
54  const AnisoParam_t& aniso_)
55  {
56  create(state, aniso_);
57  }
58 
59  //! Creation routine
60  void QDPWilsonDslash3D::create(Handle< FermState<T,P,Q> > state)
61  {
62  multi1d<Real> cf(Nd);
63  cf = 1.0;
64  create(state, cf);
65  }
66 
67  //! Creation routine with anisotropy
68  void QDPWilsonDslash3D::create(Handle< FermState<T,P,Q> > state,
69  const AnisoParam_t& anisoParam)
70  {
71  START_CODE();
72 
73  create(state, makeFermCoeffs(anisoParam));
74 
75  END_CODE();
76  }
77 
78  //! Full constructor with general coefficients
79  void QDPWilsonDslash3D::create(Handle< FermState<T,P,Q> > state,
80  const multi1d<Real>& coeffs_)
81  {
82  coeffs = coeffs_;
83  fbc = state->getFermBC();
84  u = state->getLinks();
85 
86  // Sanity check
87  if (fbc.operator->() == 0)
88  {
89  QDPIO::cerr << "WilsonDslash3D: error: fbc is null" << std::endl;
90  QDP_abort(1);
91  }
92 
93  // Rescale the u fields by the anisotropy
94  for(int mu=0; mu < u.size(); ++mu)
95  {
96  u[mu] *= coeffs[mu];
97  }
98  }
99 
100 
101  //! General Wilson-Dirac dslash
102  /*! \ingroup linop
103  * Wilson dslash
104  *
105  * Arguments:
106  *
107  * \param chi Result (Write)
108  * \param psi Pseudofermion field (Read)
109  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
110  * \param cb Checkerboard of OUTPUT std::vector (Read)
111  */
112  void
113  QDPWilsonDslash3D::apply (LatticeFermion& chi, const LatticeFermion& psi,
114  enum PlusMinus isign, int cb) const
115  {
116  START_CODE();
117 
118 
119  int otherCB = (cb == 0 ? 1 : 0);
120 
121  switch (isign)
122  {
123  case PLUS:
124  {
125 
126 
127  LatticeHalfFermion tmp;
128  LatticeHalfFermion tmp2;
129 
130  tmp[rb3[otherCB]] = spinProjectDir0Minus(psi);
131  tmp2[rb3[cb]] = shift(tmp, FORWARD, 0);
132  chi[rb3[cb]] = spinReconstructDir0Minus(u[0]*tmp2);
133 
134 
135  tmp[rb3[otherCB]] = spinProjectDir1Minus(psi);
136  tmp2[rb3[cb]] = shift(tmp, FORWARD, 1);
137  chi[rb3[cb]] += spinReconstructDir1Minus(u[1]*tmp2);
138 
139  tmp[rb3[otherCB]] = spinProjectDir2Minus(psi);
140  tmp2[rb3[cb]] = shift(tmp, FORWARD, 2);
141  chi[rb3[cb]] += spinReconstructDir2Minus(u[2]*tmp2);
142 
143 
144 
145  tmp[rb3[otherCB]] = adj(u[0])*spinProjectDir0Plus(psi);
146  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 0);
147  chi[rb3[cb]] += spinReconstructDir0Plus(tmp2);
148 
149  tmp[rb3[otherCB]] = adj(u[1])*spinProjectDir1Plus(psi);
150  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 1);
151  chi[rb3[cb]] += spinReconstructDir1Plus(tmp2);
152 
153  tmp[rb3[otherCB]] = adj(u[2])*spinProjectDir2Plus(psi);
154  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 2);
155  chi[rb3[cb]] += spinReconstructDir2Plus(tmp2);
156 
157 
158  }
159 
160 
161  break;
162 
163  case MINUS:
164  {
165 
166 
167  LatticeHalfFermion tmp;
168  LatticeHalfFermion tmp2;
169 
170  tmp[rb3[otherCB]] = spinProjectDir0Plus(psi);
171  tmp2[rb3[cb]] = shift(tmp, FORWARD, 0);
172  chi[rb3[cb]] = spinReconstructDir0Plus(u[0]*tmp2);
173 
174  tmp[rb3[otherCB]] = spinProjectDir1Plus(psi);
175  tmp2[rb3[cb]] = shift(tmp, FORWARD, 1);
176  chi[rb3[cb]] += spinReconstructDir1Plus(u[1]*tmp2);
177 
178  tmp[rb3[otherCB]] = spinProjectDir2Plus(psi);
179  tmp2[rb3[cb]] = shift(tmp, FORWARD, 2);
180  chi[rb3[cb]] += spinReconstructDir2Plus(u[2]*tmp2);
181 
182 
183  tmp[rb3[otherCB]] = adj(u[0])*spinProjectDir0Minus(psi);
184  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 0);
185  chi[rb3[cb]] += spinReconstructDir0Minus(tmp2);
186 
187  tmp[rb3[otherCB]] = adj(u[1])*spinProjectDir1Minus(psi);
188  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 1);
189  chi[rb3[cb]] += spinReconstructDir1Minus(tmp2);
190 
191  tmp[rb3[otherCB]] = adj(u[2])*spinProjectDir2Minus(psi);
192  tmp2[rb3[cb]] = shift(tmp, BACKWARD, 2);
193  chi[rb3[cb]] += spinReconstructDir2Minus(tmp2);
194 
195 
196  }
197 
198  break;
199  }
200 
201  END_CODE();
202  }
203 
204 } // End Namespace Chroma
205 
206 #endif
207 #endif
208 #endif
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
Wilson Dslash linear operator.
Nd
Definition: meslate.cc:74
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
int cb
Definition: invbicg.cc:120
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
multi1d< Real > makeFermCoeffs(const AnisoParam_t &aniso)
Make fermion coefficients.
Definition: aniso_io.cc:63
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83