CHROMA
stag_phases_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Create phases used by staggered fermions
3  */
4 
5 #include "chromabase.h"
7 
8 namespace Chroma
9 {
10 
11  namespace StagPhases
12  {
13 
14  // Define these (as opposed to previous declaration)
15  // This should give these members "linkage"
16  multi1d<LatticeInteger> alphaClass::phases;
17  multi1d<LatticeInteger> betaClass::phases;
18  bool alphaClass::initP = false;
19  bool betaClass::initP = false;
20 
21  // Init function for staggered K-S phases
23  {
24  START_CODE();
25 
26  phases.resize(Nd);
27 
28  // Auxiliary: Coordinates to use in "where" clauses
29  multi1d<LatticeInteger> x(Nd);
30  int mu;
31 
32  // Fill x with lattice coordinates
33  for( mu = 0; mu < Nd; mu++) {
34  x[ mu ] = Layout::latticeCoordinate(mu);
35  }
36 
37  switch(Nd) {
38  case 4:
39 
40  // MILC Conventions: eta_t(x) = 1
41  // eta_x = -1^{t}
42 // phases[3] = LatticeInteger(1);
43 // phases[0] = where( x[3] % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
44 //
45 // phases[1] = where( (x[3]+x[0]) % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
46 // phases[2] = where( (x[3]+x[0]+x[1] ) % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
47 // break;
48 
49  // CPS conventions: eta_x = 1
50  // eta_y = (-1)^x
51 
52  phases[0] = LatticeInteger(1);
53  phases[1] = where( x[0] % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
54  phases[2] = where( (x[0]+x[1] ) % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
55  phases[3] = where( (x[0]+x[1]+x[2] ) % 2 == 0, LatticeInteger(1), LatticeInteger(-1));
56  break;
57 
58  default:
59  QDP_error_exit("Staggered phases only supported for Nd=4 just now: Nd = %d\n", Nd);
60  break;
61  }
62 
63  END_CODE();
64  }
65 
66  // Init functions for Mesonic Phases
67  void betaClass::init(void)
68  {
69  START_CODE();
70 
71  phases.resize(Nd);
72  multi1d<LatticeInteger> x(Nd);
73  int mu;
74 
75  // Fill x with lattice coordinates
76  for( mu = 0; mu < Nd; mu++) {
77  x[ mu ] = Layout::latticeCoordinate(mu);
78  }
79 
80  switch(Nd) {
81  case 4:
82  phases[0] = where( ((x[1]+x[2]+x[3])%2) == 0, LatticeInteger(1), LatticeInteger(-1));
83  phases[1] = where( ((x[2] + x[3])%2) == 0, LatticeInteger(1), LatticeInteger(-1));
84  phases[2] = where( (x[3] % 2) == 0, LatticeInteger(1), LatticeInteger(-1) );
85 
86  phases[3] = LatticeInteger(1);
87  break;
88 
89  default:
90  QDP_error_exit("Staggered phases only supported for Nd=4 just now: Nd = %d\n", Nd);
91  break;
92  }
93 
94  END_CODE();
95  }
96 
97  const LatticeInteger& alphaClass::alpha(const int i)
98  {
99  if ( ! initP ) {
100  init();
101  initP = true;
102  }
103 
104  return phases[i];
105  }
106 
107  const LatticeInteger& betaClass::beta(const int i)
108  {
109  if ( ! initP ) {
110  init();
111  initP = true;
112  }
113 
114  return phases[i];
115  }
116 
117 
118  } // end namespace stagphases
119 
120 } // end namespace Chroma
Primary include file for CHROMA library code.
static multi1d< LatticeInteger > phases
Definition: stag_phases_s.h:17
static const LatticeInteger & alpha(const int dim)
static const LatticeInteger & beta(const int dim)
static multi1d< LatticeInteger > phases
Definition: stag_phases_s.h:33
int mu
Definition: cool.cc:24
int x
Definition: meslate.cc:34
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)
int i
Definition: pbg5p_w.cc:55
START_CODE()