CHROMA
unprec_ovdwf_linop_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Overlap-DWF (Borici) 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  void
20  UnprecOvDWLinOpArray::create(Handle< FermState<T,P,Q> > state,
21  const Real& WilsonMass_, const Real& m_q_, int N5_)
22  {
23  WilsonMass = WilsonMass_;
24  m_q = m_q_;
25  a5 = 1.0;
26  N5 = N5_;
27 
28  D.create(state);
29 // CoeffWilsr_s = (AnisoP) ? Wilsr_s / xiF_0 : 1;
30  }
31 
32 
33  //! Apply the operator onto a source std::vector
34  /*!
35  * The operator acts on the entire lattice
36  *
37  * \param psi Pseudofermion field (Read)
38  * \param isign Flag ( PLUS | MINUS ) (Read)
39  */
40  void
41  UnprecOvDWLinOpArray::operator() (multi1d<LatticeFermion>& chi,
42  const multi1d<LatticeFermion>& psi,
43  enum PlusMinus isign) const
44  {
45  START_CODE();
46 
47  if( chi.size() != N5 ) chi.resize(N5);
48 
49  //
50  // Chi = D' Psi
51  //
52  Real fact1 = a5*(Nd - WilsonMass);
53  Real fact2 = -0.5*a5;
54 
55  if (isign == PLUS)
56  {
57  LatticeFermion tmp1, tmp2;
58  moveToFastMemoryHint(tmp1);
59  moveToFastMemoryHint(tmp2);
60 
61  for(int n=0; n < N5; ++n)
62  {
63  if (n == 0)
64  {
65  tmp1 = psi[n] - m_q*chiralProjectPlus(psi[N5-1]) + chiralProjectMinus(psi[1]);
66  D(tmp2, tmp1, isign);
67  chi[n] = fact1*tmp1 + fact2*tmp2 + psi[n]
68  + m_q*chiralProjectPlus(psi[N5-1]) - chiralProjectMinus(psi[1]);
69  }
70  else if (n == N5-1)
71  {
72  tmp1 = psi[n] + chiralProjectPlus(psi[N5-2]) - m_q*chiralProjectMinus(psi[0]);
73  D(tmp2, tmp1, isign);
74  chi[n] = fact1*tmp1 + fact2*tmp2 + psi[n]
75  - chiralProjectPlus(psi[N5-2]) + m_q*chiralProjectMinus(psi[0]);
76  }
77  else
78  {
79  tmp1 = psi[n] + chiralProjectPlus(psi[n-1]) + chiralProjectMinus(psi[n+1]);
80  D(tmp2, tmp1, isign);
81  chi[n] = fact1*tmp1 + fact2*tmp2 + psi[n]
82  - chiralProjectPlus(psi[n-1]) - chiralProjectMinus(psi[n+1]);
83  }
84  }
85  }
86  else // isign = MINUS case
87  {
88  multi1d<LatticeFermion> tmp(N5); // should be more clever and reduce temporaries
89  LatticeFermion tmp1;
90  moveToFastMemoryHint(tmp);
91  moveToFastMemoryHint(tmp1);
92 
93  for(int n=0; n < N5; ++n)
94  {
95  D(tmp1, psi[n], isign);
96  tmp[n] = fact1*psi[n] + fact2*tmp1;
97  }
98 
99  for(int n=0; n < N5; ++n)
100  {
101  if (n == 0)
102  {
103  chi[0] = tmp[0] + psi[0] + chiralProjectPlus(tmp[1]) - chiralProjectPlus(psi[1])
104  - m_q*(chiralProjectMinus(tmp[N5-1]) - chiralProjectMinus(psi[N5-1]));
105  }
106  else if (n == N5-1)
107  {
108  chi[n] = tmp[n] + psi[n] + chiralProjectMinus(tmp[N5-2]) - chiralProjectMinus(psi[N5-2])
109  - m_q*(chiralProjectPlus(tmp[0]) - chiralProjectPlus(psi[0]));
110  }
111  else
112  {
113  chi[n] = tmp[n] + psi[n] + chiralProjectMinus(tmp[n-1]) - chiralProjectMinus(psi[n-1])
114  + chiralProjectPlus(tmp[n+1]) - chiralProjectPlus(psi[n+1]);
115  }
116  }
117  }
118 
119  getFermBC().modifyF(chi);
120 
121  END_CODE();
122  }
123 
124  //! Apply the Dminus operator on a lattice fermion. See my notes ;-)
125  void
126  UnprecOvDWLinOpArray::Dminus(LatticeFermion& chi,
127  const LatticeFermion& psi,
128  enum PlusMinus isign,
129  int s5) const
130  {
131  LatticeFermion tt ; moveToFastMemoryHint(tt);
132  D.apply(tt,psi,isign,0);
133  D.apply(tt,psi,isign,1);
134  chi = (1.0 - (Nd-WilsonMass))*psi +0.5*tt ; //really -(-.5)D
135  }
136 
137 
138 } // End Namespace Chroma
139 
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
unsigned n
Definition: ldumul_w.cc:36
Double tmp
Definition: meslate.cc:60
Nd
Definition: meslate.cc:74
Double tmp2
Definition: mesq.cc:30
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ PLUS
Definition: chromabase.h:45
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Unpreconditioned Overlap-DWF (Borici) linear operator.