Bridge++  Ver. 1.3.x
staples.cpp
Go to the documentation of this file.
1 
14 #include "staples.h"
15 
16 #include "shiftField_lex.h"
17 
18 const std::string Staples::class_name = "Staples";
19 
20 //====================================================================
22 {
24  m_shift = new ShiftField_lex;
25 }
26 
27 
28 //====================================================================
30 {
31  delete m_shift;
32 }
33 
34 
35 //====================================================================
36 double Staples::plaquette(const Field_G& U)
37 {
38  return (plaq_s(U) + plaq_t(U)) / 2;
39 }
40 
41 
42 //====================================================================
43 double Staples::plaq_s(const Field_G& U)
44 {
45  int Nc = CommonParameters::Nc();
46  int Lvol = CommonParameters::Lvol();
47  int Ndim = CommonParameters::Ndim();
48  int Ndim_spc = Ndim - 1;
49 
50  double plaq = 0.0;
51 
52  Field_G Umu;
53 
54  for (int mu = 0; mu < Ndim_spc; ++mu) {
55  int nu = (mu + 1) % Ndim_spc;
56 
57  Umu.setpart_ex(0, U, mu);
58 
59  upper(m_staple, U, mu, nu);
60 
61  // #pragma omp parallel
62  {
63  double plaq1 = real(dotc(m_staple, Umu));
64 
65 #pragma omp master
66  plaq += plaq1;
67  }
68  }
69 
70  return plaq / (Lvol * Nc * Ndim_spc);
71 }
72 
73 
74 //====================================================================
75 double Staples::plaq_t(const Field_G& U)
76 {
77  int Nc = CommonParameters::Nc();
78  int Lvol = CommonParameters::Lvol();
79  int Ndim = CommonParameters::Ndim();
80  int Ndim_spc = Ndim - 1;
81 
82  double plaq = 0.0;
83 
84  Field_G Umu;
85 
86  int mu = Ndim_spc;
87 
88  Umu.setpart_ex(0, U, mu);
89 
90  for (int nu = 0; nu < Ndim_spc; ++nu) {
91  upper(m_staple, U, mu, nu);
92 
93  // #pragma omp parallel
94  {
95  double plaq1 = real(dotc(m_staple, Umu));
96 
97 #pragma omp master
98  plaq += plaq1;
99  }
100  }
101 
102  return plaq / (Lvol * Nc * Ndim_spc);
103 }
104 
105 
106 //====================================================================
107 void Staples::staple(Field_G& W, const Field_G& U, const int mu)
108 {
109  int Ndim = CommonParameters::Ndim();
110 
111  W.set(0.0);
112  Field_G Vud(W.nvol(), 1);
113 
114  for (int nu = 0; nu < Ndim; ++nu) {
115  if (nu != mu) {
116  //W += upper(U, mu, nu);
117  //W += lower(U, mu, nu);
118  upper(Vud, U, mu, nu);
119  axpy(W, 1.0, Vud);
120  lower(Vud, U, mu, nu);
121  axpy(W, 1.0, Vud);
122  }
123  }
124 }
125 
126 
127 //====================================================================
128 void Staples::upper(Field_G& c, const Field_G& U,
129  const int mu, const int nu)
130 {
131  // (1) mu (2)
132  // +-->--+
133  // nu | |
134  // i+ +
135 
136  Field_G Umu, Unu;
137 
138  //#pragma omp parallel
139  {
140  Umu.setpart_ex(0, U, mu);
141  Unu.setpart_ex(0, U, nu);
142  m_shift->backward(m_v, Unu, mu);
143  m_shift->backward(c, Umu, nu);
144 
145  mult_Field_Gnd(m_w, 0, c, 0, m_v, 0);
146  mult_Field_Gnn(c, 0, U, nu, m_w, 0);
147  }
148 }
149 
150 
151 //====================================================================
152 void Staples::lower(Field_G& c, const Field_G& U,
153  const int mu, const int nu)
154 {
155  // + +
156  // nu | |
157  // i+-->--+
158  // (1) mu (2)
159 
160  Field_G Umu, Unu;
161 
162  //#pragma omp parallel
163  {
164  Unu.setpart_ex(0, U, nu);
165  m_shift->backward(m_w, Unu, mu);
166 
167  mult_Field_Gnn(m_v, 0, U, mu, m_w, 0);
168  mult_Field_Gdn(m_w, 0, U, nu, m_v, 0);
169 
170  m_shift->forward(c, m_w, nu);
171  }
172 }
173 
174 
175 //====================================================================
176 //============================================================END=====
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:155
void mult_Field_Gdn(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
Staples()
Definition: staples.cpp:21
static Bridge::VerboseLevel Vlevel()
int nvol() const
Definition: field.h:116
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staples.cpp:36
~Staples()
Definition: staples.cpp:29
ShiftField_lex * m_shift
Definition: staples.h:46
static int Lvol()
Field_G m_v
Definition: staples.h:47
double plaq_t(const Field_G &)
calculates temporal plaquette value.
Definition: staples.cpp:75
SU(N) gauge field.
Definition: field_G.h:38
static const std::string class_name
Definition: staples.h:64
void mult_Field_Gnd(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
dcomplex dotc(const Field &y, const Field &x)
Definition: field.cpp:92
Field_G m_staple
Definition: staples.h:47
void mult_Field_Gnn(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
void backward(Field &, const Field &, const int mu)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staples.cpp:152
Methods to shift a field in the lexical site index.
Bridge::VerboseLevel m_vl
Definition: staples.h:43
void staple(Field_G &, const Field_G &, const int mu)
constructs staples in mu-direction (summing up nu-direction).
Definition: staples.cpp:107
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:177
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staples.cpp:128
double plaq_s(const Field_G &)
calculates spatial plaquette value.
Definition: staples.cpp:43
Field_G m_w
temporary fields.
Definition: staples.h:47
void forward(Field &, const Field &, const int mu)