CHROMA
dilute_gauss_src_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Variety of Z2 noise sources
3  */
4 
5 #include "chromabase.h"
7 
8 namespace Chroma {
9 
10 //! Volume source of complex Z2 noise
11 /*!
12  * \ingroup hadron
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 
27 
28 //! Timeslice source of complex gaussian noise
29 /*!
30  * \ingroup hadron
31  *
32  *
33  * \param a Source fermion
34  * \param slice time slice
35  * \param mu direction of slice
36  *
37  *
38  * This type of source is useful for computing hadronic
39  * decay like diagrams.
40  *
41  * QUARK MASS DEPENDENCE OF HADRON MASSES FROM LATTICE QCD.
42  * By UKQCD Collaboration (M. Foster et al.)
43  * Published in Phys.Rev.D59:074503,1999
44  * e-Print Archive: hep-lat/9810021
45  *
46  */
47 
48 /*************************************************************************/
49 void gaussian_on_timeslice(LatticeStaggeredFermion& a, int slice, int mu){
50 
51  // compute a source of z2 noise on slice x_mu = slice
52  LatticeStaggeredFermion tmp;
53  gaussian(tmp) ;
54  QDPIO::cout << __func__ << ": slice= " << slice << std::endl;
55  a = where(Layout::latticeCoordinate(mu) == slice, tmp, LatticeStaggeredFermion(zero));
56 }
57 
58 
59 /*************************************************************************/
60 void gaussian_on_parity(LatticeStaggeredFermion& a, int parity){
61 
62  //"parity" should be passed in as either 1 ---> odd sites
63  // or 0 ---> even sites
64 
65 
66  // compute a volume source of z2 noise
67  LatticeStaggeredFermion tmp;
68 
69  gaussian(tmp) ; // fill tmp with gaussian complexs
70 
71  a = where((((Layout::latticeCoordinate(0) + Layout::latticeCoordinate(1)+
72  Layout::latticeCoordinate(2) + Layout::latticeCoordinate(3))%2)
73  == parity),
74  tmp, LatticeStaggeredFermion(zero));
75 
76 }
77 
78 /*************************************************************************/
79 
80 void gaussian_color_src(LatticeStaggeredFermion& a, int color_index){
81 
82  LatticeComplex lat_rand;
83  LatticeColorVector latcolor = zero;
84  // LatticeStaggeredFermion latfield = zero;
85  const int spin_index = 0 ;
86 
87 
88  a=zero;
89 
90  gaussian(lat_rand) ; // fill c with gaussian rand numbers (both components)
91 
92  pokeSpin(a, pokeColor(latcolor, lat_rand, color_index), spin_index);
93 
94 }
95 
96 
97 
98 /*************************************************************************/
99 void gaussian_color_src_on_slice(LatticeStaggeredFermion& a, int color_index,
100  int slice, int mu){
101 
102 
103  LatticeStaggeredFermion tmp;
104  LatticeComplex lat_rand;
105  LatticeColorVector latcolor = zero;
106  const int spin_index = 0 ;
107 
108 
109  a=zero; // zero out the fermion source, use zero, not 0
110 
111  gaussian(lat_rand) ; // put a gaussian rand on all sites of lat_rand
112 
113  pokeSpin(tmp, pokeColor(latcolor, lat_rand, color_index), spin_index);
114 
115  // pokeColor(tmp, lat_rand, color); // put lat_rand on color component of tmp
116 
117  //copy tmp into a on all sites in timeslice x_mu=slice
118  a = where(Layout::latticeCoordinate(mu) == slice, tmp, LatticeStaggeredFermion(zero));
119 
120 }
121 /*************************************************************************/
122 void gaussian_color_src_on_parity(LatticeStaggeredFermion& a, int color_index,
123  int parity){
124 
125  //"parity" should be passed in as either 1 ---> odd sites
126  // or 0 ---> even sites
127 
128 
129  LatticeStaggeredFermion tmp;
130  LatticeComplex lat_rand;
131  LatticeColorVector latcolor = zero;
132  const int spin_index = 0 ;
133 
134  a=zero; // zero out the fermion source, use zero, not 0
135 
136  gaussian(lat_rand) ; // put a gaussian rand on all sites of lat_rand
137 
138  pokeSpin(tmp, pokeColor(latcolor, lat_rand, color_index), spin_index);
139 
140  // pokeColor(tmp, lat_rand, color); // put lat_rand on color component of tmp
141 
142  //copy tmp into a on all sites with given parity
143  a = where((((Layout::latticeCoordinate(0) + Layout::latticeCoordinate(1) +
144  Layout::latticeCoordinate(2)+Layout::latticeCoordinate(3))%2)
145  == parity),
146  tmp, LatticeStaggeredFermion(zero));
147 
148 }
149 /*************************************************************************/
150 void gaussian_parity_src_on_slice(LatticeStaggeredFermion& a,
151  int parity, int slice, int mu){
152 
153  //"parity" should be passed in as either 1 ---> odd sites
154  // or 0 ---> even sites
155 
156 
157  LatticeStaggeredFermion tmp;
158  LatticeComplex lat_rand;
159  LatticeColorVector latcolor = zero;
160  const int spin_index = 0 ;
161 
162  a=zero; // zero out the fermion source, use zero, not 0
163 
164  gaussian(tmp) ; // put a gaussian rand on all sites of tmp
165 
166 
167  // pokeColor(tmp, lat_rand, color); // put lat_rand on color component of tmp
168 
169  //copy tmp into a on all sites with given parity
170  a = where(((((Layout::latticeCoordinate(0) + Layout::latticeCoordinate(1) +
171  Layout::latticeCoordinate(2)+Layout::latticeCoordinate(3))%2)
172  == parity) && (Layout::latticeCoordinate(mu) == slice)),
173  tmp, LatticeStaggeredFermion(zero));
174 
175 }
176 /*************************************************************************/
177 void gaussian_on_mod_timeslice(LatticeStaggeredFermion& a, int slice, int mu,
178  int seperation){
179 
180  // compute a source of z2 noise on slice x_mu % seperation = slice
181  LatticeStaggeredFermion tmp;
182  gaussian(tmp) ;
183  QDPIO::cout << __func__ << ": slice= " << slice << std::endl;
184  // a = where((Layout::latticeCoordinate(mu))%seperation == slice, tmp,
185  // LatticeStaggeredFermion(zero));
186 
187  a = where(((Layout::latticeCoordinate(mu))-slice)%seperation == 0, tmp,
188  LatticeStaggeredFermion(zero));
189 }
190 
191 /*************************************************************************/
192 void gaussian_on_corner(LatticeStaggeredFermion& a, int corner_index){
193 
194  // define a gaussian source on one corner of all hypercubes
195 
196  multi1d<int> coord(Nd);
197 
198  PropIndexTodelta(corner_index, coord) ;
199 
200 
201 
202  // compute a volume source of z2 noise
203  LatticeStaggeredFermion tmp;
204 
205  gaussian(tmp) ; // fill tmp with gaussian complexs
206 
207  // a = where((
208  // (
209  // ((Layout::latticeCoordinate(0))%2==coord[0]) &&
210  // ((Layout::latticeCoordinate(1))%2==coord[1])) &&
211  // (
212  // ((Layout::latticeCoordinate(2))%2==coord[2]) &&
213  // ((Layout::latticeCoordinate(3))%2==coord[3]))),
214  // tmp, LatticeStaggeredFermion(zero));
215 
216  a = where((
217  (
218  (((Layout::latticeCoordinate(0))-coord[0])%2==0) &&
219  (((Layout::latticeCoordinate(1))-coord[1])%2==0)) &&
220  (
221  (((Layout::latticeCoordinate(2))-coord[2])%2==0) &&
222  (((Layout::latticeCoordinate(3))-coord[3])%2==0))),
223  tmp, LatticeStaggeredFermion(zero));
224 
225 }
226 
227 /*************************************************************************/
228 void gaussian_corner_on_dbl_slice(LatticeStaggeredFermion& a,
229  int corner_index,
230  int slice, int mu){
231 
232  // define a gaussian source on one corner of all hypercubes on
233  // double-timeslice==slice.
234  // double-timeslice = timeslice/2
235 
236  multi1d<int> coord(Nd);
237 
238  PropIndexTodelta(corner_index, coord) ;
239 
240 
241 
242  // compute a volume source of z2 noise
243  LatticeStaggeredFermion tmp;
244 
245  gaussian(tmp) ; // fill tmp with gaussian complexs
246 
247  // a = where(((
248  // (
249  // ((Layout::latticeCoordinate(0))%2==coord[0]) &&
250  // ((Layout::latticeCoordinate(1))%2==coord[1])) &&
251  // (
252  // ((Layout::latticeCoordinate(2))%2==coord[2]) &&
253  // ((Layout::latticeCoordinate(3))%2==coord[3]))) &&
254  // (Layout::latticeCoordinate(mu))/2== slice),
255  // tmp, LatticeStaggeredFermion(zero));
256 
257  a = where(((
258  (
259  (((Layout::latticeCoordinate(0))-coord[0])%2==0) &&
260  (((Layout::latticeCoordinate(1))-coord[1])%2==0)) &&
261  (
262  (((Layout::latticeCoordinate(2))-coord[2])%2==0) &&
263  (((Layout::latticeCoordinate(3))-coord[3])%2==0))) &&
264  (Layout::latticeCoordinate(mu))/2== slice),
265  tmp, LatticeStaggeredFermion(zero));
266 
267 }
268 /*************************************************************************/
269 void gaussian_corner_on_mod_dbl_slice(LatticeStaggeredFermion& a,
270  int corner_index,
271  int slice, int mu, int seperation){
272 
273  // define a gaussian source on one corner of all hypercubes on
274  // double-timeslice==slice.
275  // double-timeslice is 2 timeslicesw
276 
277  multi1d<int> coord(Nd);
278 
279  PropIndexTodelta(corner_index, coord) ;
280 
281  // compute a volume source of z2 noise
282  LatticeStaggeredFermion tmp;
283 
284  gaussian(tmp) ; // fill tmp with gaussian complexs
285 
286  // a = where(((
287  // (
288  // ((Layout::latticeCoordinate(0))%2==coord[0]) &&
289  // ((Layout::latticeCoordinate(1))%2==coord[1])) &&
290  // (
291  // ((Layout::latticeCoordinate(2))%2==coord[2]) &&
292  // ((Layout::latticeCoordinate(3))%2==coord[3]))) &&
293  // ((Layout::latticeCoordinate(mu))/2)%seperation == slice),
294  // tmp, LatticeStaggeredFermion(zero));
295 
296  a = where(((
297  (
298  (((Layout::latticeCoordinate(0))-coord[0])%2==0) &&
299  (((Layout::latticeCoordinate(1))-coord[1])%2==0)) &&
300  (
301  (((Layout::latticeCoordinate(2))-coord[2])%2==0) &&
302  (((Layout::latticeCoordinate(3))-coord[3])%2==0))) &&
303  (((Layout::latticeCoordinate(mu))/2-slice)%(seperation) == 0)),
304  tmp, LatticeStaggeredFermion(zero));
305 
306 }
307 
308 /*************************************************************************/
309 void gaussian_color_src_on_mod_slice(LatticeStaggeredFermion& a,
310  int color_index, int slice, int mu,
311  int seperation){
312 
313 
314  LatticeStaggeredFermion tmp;
315  LatticeComplex lat_rand;
316  LatticeColorVector latcolor = zero;
317  const int spin_index = 0 ;
318 
319 
320  a=zero; // zero out the fermion source, use zero, not 0
321 
322  gaussian(lat_rand) ; // put a gaussian rand on all sites of lat_rand
323 
324  pokeSpin(tmp, pokeColor(latcolor, lat_rand, color_index), spin_index);
325 
326  //copy tmp into a on all sites in timeslice x_mu%seperation=slice
327 
328  // a = where((Layout::latticeCoordinate(mu)%seperation) == slice,
329  // tmp, LatticeStaggeredFermion(zero));
330 
331  a = where(((Layout::latticeCoordinate(mu)-slice)%seperation) == 0,
332  tmp, LatticeStaggeredFermion(zero));
333 
334 }
335 /*************************************************************************/
336 
337 } // end namespace Chroma
338 
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
void gaussian_on_timeslice(LatticeStaggeredFermion &a, int slice, int mu)
Volume source of complex Z2 noise.
void gaussian_on_corner(LatticeStaggeredFermion &a, int corner_index)
Diluted Gauusian-source.
void gaussian_corner_on_mod_dbl_slice(LatticeStaggeredFermion &a, int corner_index, int slice, int mu, int seperation)
Diluted Gauusian-source.
void gaussian_on_parity(LatticeStaggeredFermion &a, int parity)
Diluted Gauusian-source.
void gaussian_color_src_on_slice(LatticeStaggeredFermion &a, int color_index, int slice, int mu)
Diluted Gauusian-source.
void gaussian_color_src_on_parity(LatticeStaggeredFermion &a, int color_index, int parity)
Diluted Gauusian-source.
void gaussian_color_src(LatticeStaggeredFermion &a, int color_index)
Diluted Gauusian-source.
void gaussian_parity_src_on_slice(LatticeStaggeredFermion &a, int parity, int slice, int mu)
Diluted Gauusian-source.
void gaussian_on_mod_timeslice(LatticeStaggeredFermion &a, int slice, int mu, int seperation)
Diluted Gauusian-source.
void gaussian_corner_on_dbl_slice(LatticeStaggeredFermion &a, int corner_index, int slice, int mu)
Diluted Gauusian-source.
void gaussian_color_src_on_mod_slice(LatticeStaggeredFermion &a, int color_index, int slice, int mu, int seperation)
Diluted Gauusian-source.
multi1d< int > coord(Nd)
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
Complex a
Definition: invbicg.cc:95
void PropIndexTodelta(int src_index, multi1d< int > &delta)
Double zero
Definition: invbicg.cc:106