CHROMA
unprec_dwf_linop_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned domain-wall linear operator
3  */
4 
5 #include "chromabase.h"
7 
8 using namespace QDP::Hints;
9 
10 namespace Chroma
11 {
12  //! Creation routine
13  /*! \ingroup fermact
14  *
15  * \param u_ gauge field (Read)
16  * \param WilsonMass_ DWF height (Read)
17  * \param m_q_ quark mass (Read)
18  */
19  UnprecDWLinOpArray::UnprecDWLinOpArray(
21  const Real& WilsonMass_, const Real& m_q_, int N5_,
22  const AnisoParam_t& aniso)
23  {
24  WilsonMass = WilsonMass_;
25  m_q = m_q_;
26  a5 = 1.0;
27  N5 = N5_;
28 
29  fbc = fs->getFermBC();
30  D.create(fs, aniso); // construct using possibly aniso glue
31 
32  Real ff = where(aniso.anisoP, aniso.nu / aniso.xi_0, Real(1));
33  fact1 = 1 + a5*(1 + (Nd-1)*ff - WilsonMass);
34  fact2 = -0.5*a5;
35  }
36 
37 
38 
39  //! Apply unpreconditioned domain-wall fermion linear operator
40  /*!
41  * \ingroup linop
42  *
43  * The operator acts on the entire lattice
44  *
45  * \param psi Pseudofermion field (Read)
46  * \param isign Flag ( PLUS | MINUS ) (Read)
47  */
48  void UnprecDWLinOpArray::operator() (multi1d<LatticeFermion>& chi,
49  const multi1d<LatticeFermion>& psi,
50  enum PlusMinus isign) const
51  {
52  START_CODE();
53 
54  if( chi.size() != N5 ) chi.resize(N5);
55 
56  //
57  // Chi = D' Psi
58  //
59  LatticeFermion tmp; moveToFastMemoryHint(tmp);
60 
61  switch (isign)
62  {
63  case PLUS:
64  for(int n=0; n < N5; ++n)
65  {
66  D(tmp, psi[n], isign);
67 
68  if (n == 0)
69  chi[n] = fact2*tmp + fact1*psi[n]
70  + m_q*chiralProjectPlus(psi[N5-1]) - chiralProjectMinus(psi[1]);
71  else if (n == N5-1)
72  chi[n] = fact2*tmp + fact1*psi[n]
73  - chiralProjectPlus(psi[N5-2]) + m_q*chiralProjectMinus(psi[0]);
74  else
75  chi[n] = fact2*tmp + fact1*psi[n]
76  - chiralProjectPlus(psi[n-1]) - chiralProjectMinus(psi[n+1]);
77  }
78  break;
79 
80  case MINUS:
81  for(int n=0; n < N5; ++n)
82  {
83  D(tmp, psi[n], isign);
84 
85  if (n == 0)
86  chi[n] = fact2*tmp + fact1*psi[n]
87  + m_q*chiralProjectMinus(psi[N5-1]) - chiralProjectPlus(psi[1]);
88  else if (n == N5-1)
89  chi[n] = fact2*tmp + fact1*psi[n]
90  - chiralProjectMinus(psi[N5-2]) + m_q*chiralProjectPlus(psi[0]);
91  else
92  chi[n] = fact2*tmp + fact1*psi[n]
93  - chiralProjectMinus(psi[n-1]) - chiralProjectPlus(psi[n+1]);
94  }
95  break;
96  }
97 
98  getFermBC().modifyF(chi);
99 
100  END_CODE();
101  }
102 
103  //! Derivative
104  void
105  UnprecDWLinOpArray::deriv(multi1d<LatticeColorMatrix>& ds_u,
106  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
107  enum PlusMinus isign) const
108  {
109  START_CODE();
110 
111  ds_u.resize(Nd);
112  ds_u = zero;
113 
114  Real fact2 = -Real(0.5)*a5;
115 
116  multi1d<LatticeColorMatrix> ds_tmp(Nd);
117  for(int s(0);s<N5;s++)
118  {
119  D.deriv(ds_tmp,chi[s],psi[s],isign);
120  for(int mu(0);mu<Nd;mu++)
121  ds_u[mu] += fact2*ds_tmp[mu];
122  }
123 
124  END_CODE();
125  }
126 
127 } // End Namespace Chroma
128 
Primary include file for CHROMA library code.
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
int mu
Definition: cool.cc:24
unsigned s
Definition: ldumul_w.cc:37
unsigned n
Definition: ldumul_w.cc:36
Double tmp
Definition: meslate.cc:60
Nd
Definition: meslate.cc:74
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
Double zero
Definition: invbicg.cc:106
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Parameters for anisotropy.
Definition: aniso_io.h:24
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.
Unpreconditioned domain-wall fermion linear operator.