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