CHROMA
walfil_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wall source construction
3  */
4 
5 #include "chromabase.h"
7 
8 namespace Chroma {
9 
10 //! Fill a specific color and spin index with 1.0 on a wall
11 /*!
12  * \ingroup sources
13  *
14  * This routine is specific to Staggered fermions!
15  *
16  * Fill a specific color index with 1.0, on sites at the corners
17  * of the cubes in a slice
18  *
19  *
20  * \param a Source fermion (write)
21  * \param slice time slice
22  * \param mu direction of slice
23  * \param color_index Color index
24  * \param src_index Index which defines which corner of a cube on
25  * the source time slice you want your source to
26  * be on. The std::mapping from src_index to site is
27  * lexicographic, i.e: 0 is (0,0,0), 1 is (1,0,0),
28  * 2 is (0,1,0), 3 is (1,1,0), 4 is (0,0,1),
29  * 5 is (1,0,1), 6 is (0,1,1) and 7 is (1,1,1).
30  *
31  * This is probably not the cleverest way to do this and realistically
32  * you are not interested in all the sources at once so you have to be
33  * careful to call this routine with the right index.
34  */
35 
36 void walfil(LatticeStaggeredFermion& a, int slice, int mu, int color_index, int src_index)
37 {
38  START_CODE();
39 
40  if ( color_index >= Nc )
41  QDP_error_exit("Color index out of bounds", color_index, Nc);
42 
43  if ( (slice % 2) != 0 )
44  QDP_error_exit("Require an even valued slice", slice);
45 
46  /*
47  * Write ONE to the required coordinates of the appropriate slice.
48  * Note: staggered fermions are represented as "Ns=1" spinors!
49  */
50  // Write ONE to all field
51  int spin_index = 0;
52  Real one = 1;
53  Complex sitecomp = cmplx(one,0);
54  ColorVector sitecolor = zero;
55  StaggeredFermion sitefield = zero;
56 
57  pokeSpin(sitefield,
58  pokeColor(sitecolor,sitecomp,color_index),
59  spin_index);
60 
61 
62  // Narrow the context to the desired slice and to even coordinates
63  LatticeBoolean ltest = (Layout::latticeCoordinate(mu) == slice);
64 
65  switch(src_index){
66  case 0:
67  for(int m = 0; m < Nd; ++m)
68  if ( m != mu )
69  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
70  break;
71 
72  case 1:
73  for(int m = 0; m < Nd-1; ++m){
74  if ( m == 0 )
75  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
76  else
77  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
78  }
79  break;
80 
81  case 2:
82  for(int m = 0; m < Nd-1; ++m){
83  if ( m == 1 )
84  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
85  else
86  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
87  }
88  break;
89 
90  case 3:
91  for(int m = 0; m < Nd-1; ++m){
92  if ( m == 2 )
93  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
94  else
95  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
96  }
97  break;
98 
99  case 4:
100  for(int m = 0; m < Nd-1; ++m){
101  if ( m == 2 )
102  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
103  else
104  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
105  }
106  break;
107 
108  case 5:
109  for(int m = 0; m < Nd-1; ++m){
110  if ( m == 1 )
111  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
112  else
113  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
114  }
115  break;
116 
117  case 6:
118  for(int m = 0; m < Nd-1; ++m){
119  if ( m == 0 )
120  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 0);
121  else
122  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
123  }
124  break;
125 
126  case 7:
127  for(int m = 0; m < Nd-1; ++m)
128  ltest &= ( (Layout::latticeCoordinate(m) % 2) == 1);
129  break;
130 
131  default:
132  QDPIO::cerr << "walfil_s: There are only 8 corners of a cube! " << std::endl;
133  QDP_abort(1);
134  };
135 
136  // Write onto the appropriate slice
137  LatticeStaggeredFermion tmp;
138  tmp = sitefield; // QDP (not installed version) now supports construct OLattice = OScalar
139 
140  a = where(ltest, tmp, LatticeStaggeredFermion(zero));
141 
142  END_CODE();
143 }
144 
145 } // end namespace Chroma
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
void walfil(LatticeStaggeredFermion &a, int slice, int mu, int color_index, int src_index)
Fill a specific color and spin index with 1.0 on a wall.
Definition: walfil_s.cc:36
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
Double one
Definition: invbicg.cc:105
Complex a
Definition: invbicg.cc:95
START_CODE()
Double zero
Definition: invbicg.cc:106
Wall source construction.