CHROMA
z2_src.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Variety of Z2 noise sources
3  */
4 
5 #include "chromabase.h"
6 #include "meas/sources/z2_src.h"
7 
8 namespace Chroma {
9 
10 //! Volume source of complex Z2 noise
11 /*!
12  * \ingroup sources
13  *
14  * This routine is specific to Wilson fermions!
15  *
16  * \param a Source fermion
17  *
18  *
19  * This type of source is required to compute disconnected
20  * diagrams. The source is complex Z2 noise, hence there
21  * is an additional normalization factor of 1/sqrt(2).
22  *
23  *
24  */
25 
26  template<typename T>
27  void z2_src_t(T & a)
28  {
29 
30  a = zero ;
31  LatticeReal rnd ;
32  LatticeReal ar ,ai ;
33  LatticeColorVector colorvec = zero;
34 
35  for(int spin_index= 0 ; spin_index < Ns ; ++spin_index)
36  for(int color_index= 0 ; color_index < Nc ; ++color_index)
37  {
38  random(rnd) ;
39  ar = where( rnd > 0.5 , LatticeReal(1) , LatticeReal(-1) );
40  random(rnd) ;
41  ai = where( rnd > 0.5 , LatticeReal(1) , LatticeReal(-1) );
42  LatticeComplex c = cmplx(ar,ai) ;
43 
44  colorvec = peekSpin(a,spin_index);
45 
46  pokeSpin(a,pokeColor(colorvec,c,color_index),spin_index);
47  }
48 
49  }
50 
51 
52  // template<>
53  void z2_src(LatticeFermion& a)
54  {
55  z2_src_t<LatticeFermion>(a) ;
56  }
57 
58 
59  // template<>
60  void z2_src(LatticeStaggeredFermion& a)
61  {
62  z2_src_t<LatticeStaggeredFermion>(a) ;
63  }
64 
65 
66  //! Timeslice source of complex Z2 noise
67  /*!
68  * \ingroup sources
69  *
70  * This routine is specific to Wilson fermions!
71  *
72  * \param a Source fermion
73  * \param slice time slice
74  * \param mu direction of slice
75  *
76  *
77  * This type of source is useful for computing hadronic
78  * decay like diagrams.
79  *
80  * QUARK MASS DEPENDENCE OF HADRON MASSES FROM LATTICE QCD.
81  * By UKQCD Collaboration (M. Foster et al.)
82  * Published in Phys.Rev.D59:074503,1999
83  * e-Print Archive: hep-lat/9810021
84  *
85  */
86  void z2_src(LatticeFermion& a, int slice, int mu)
87  {
88 
89  // compute a volume source of z2 noise
90  LatticeFermion tmp;
91  z2_src(tmp) ;
92 
93  a = where(Layout::latticeCoordinate(mu) == slice, tmp, LatticeFermion(zero));
94  }
95 
96 } // end namespace Chroma
97 
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
void z2_src(LatticeFermion &a)
Z2-source.
Definition: z2_src.cc:53
void z2_src_t(T &a)
Volume source of complex Z2 noise.
Definition: z2_src.cc:27
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
Double c
Definition: invbicg.cc:108
LinOpSysSolverMGProtoClover::T T
Complex a
Definition: invbicg.cc:95
Double zero
Definition: invbicg.cc:106
Volume source of Z2 noise.