Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
staple_eo.cpp
Go to the documentation of this file.
1 
14 #include "staple_eo.h"
15 
16 
17 #ifdef USE_FACTORY
18 namespace {
19  Staple *create_object()
20  {
21  return new Staple_eo();
22  }
23 
24 
25  bool init = Staple::Factory::Register("EvenOdd", create_object);
26 }
27 #endif
28 
29 
30 const std::string Staple_eo::class_name = "Staple_eo";
31 
32 //====================================================================
34 {
35  m_filename_output = params.get_string("filename_output");
36  if (m_filename_output.empty()) {
37  m_filename_output = "stdout";
38  }
39 
40  const string str_vlevel = params.get_string("verbose_level");
41  m_vl = vout.set_verbose_level(str_vlevel);
42 }
43 
44 
45 //====================================================================
46 double Staple_eo::plaquette(const Field_G& U)
47 {
48  Field_G Ueo(U);
49  Index_eo idx;
50 
51  idx.convertField(Ueo, U);
52 
53  return (plaq_s(Ueo) + plaq_t(Ueo)) / 2;
54 }
55 
56 
57 //====================================================================
58 double Staple_eo::plaq_s(const Field_G& Ueo)
59 {
60  int Nc = CommonParameters::Nc();
61  int Lvol = CommonParameters::Lvol();
62  int Nvol = CommonParameters::Nvol();
63  int Ndim = CommonParameters::Ndim();
64  int Ndim_spc = Ndim - 1;
65 
66  double plaq = 0.0;
67  static Field_G staple;
68 
69  upper(staple, Ueo, 0, 1);
70  for (int site = 0; site < Nvol; site++) {
71  plaq += ReTr(Ueo.mat(site, 0) * staple.mat_dag(site)); // P_xy
72  }
73 
74  upper(staple, Ueo, 1, 2);
75  for (int site = 0; site < Nvol; site++) {
76  plaq += ReTr(Ueo.mat(site, 1) * staple.mat_dag(site)); // P_yz
77  }
78 
79  upper(staple, Ueo, 2, 0);
80  for (int site = 0; site < Nvol; site++) {
81  plaq += ReTr(Ueo.mat(site, 2) * staple.mat_dag(site)); // P_zx
82  }
83 
84  plaq = Communicator::reduce_sum(plaq);
85 
86  return plaq / (Lvol * Nc * Ndim_spc);
87 }
88 
89 
90 //====================================================================
91 double Staple_eo::plaq_t(const Field_G& Ueo)
92 {
93  int Nc = CommonParameters::Nc();
94  int Lvol = CommonParameters::Lvol();
95  int Nvol = CommonParameters::Nvol();
96  int Ndim = CommonParameters::Ndim();
97  int Ndim_spc = Ndim - 1;
98 
99  double plaq = 0.0;
100  static Field_G staple;
101 
102  for (int nu = 0; nu < Ndim - 1; nu++) {
103  lower(staple, Ueo, 3, nu);
104  for (int site = 0; site < Nvol; site++) {
105  plaq += ReTr(Ueo.mat(site, 3) * staple.mat_dag(site)); // P_zx
106  }
107  }
108 
109  plaq = Communicator::reduce_sum(plaq);
110 
111  return plaq / (Lvol * Nc * Ndim_spc);
112 }
113 
114 
115 //====================================================================
116 void Staple_eo::staple(Field_G& W, const Field_G& Ueo, const int mu)
117 {
118  int Ndim = CommonParameters::Ndim();
119 
120  W.set(0.0);
121  Field_G u_tmp(W.nvol(), 1);
122  for (int nu = 0; nu < Ndim; nu++) {
123  if (nu != mu) {
124  upper(u_tmp, Ueo, mu, nu);
125  axpy(W, 1.0, u_tmp);
126  lower(u_tmp, Ueo, mu, nu);
127  axpy(W, 1.0, u_tmp);
128  }
129  }
130 }
131 
132 
133 //====================================================================
134 void Staple_eo::upper(Field_G& c, const Field_G& Ueo, const int mu, const int nu)
135 {
136  // (1) mu (2)
137  // +-->--+
138  // nu | |
139  // i+ +
140 
141  Field_G Umu, Unu;
142 
143  Umu.setpart_ex(0, Ueo, mu);
144  Unu.setpart_ex(0, Ueo, nu);
145 
146  m_shift.backward(m_v, Unu, mu);
147  m_shift.backward(c, Umu, nu);
148 
149  mult_Field_Gnd(m_w, 0, c, 0, m_v, 0);
150  mult_Field_Gnn(c, 0, Unu, 0, m_w, 0);
151 }
152 
153 
154 //====================================================================
155 void Staple_eo::lower(Field_G& c, const Field_G& Ueo, const int mu, const int nu)
156 {
157  // + +
158  // nu | |
159  // i+-->--+
160  // (1) mu (2)
161 
162  Field_G Umu, Unu;
163 
164  Umu.setpart_ex(0, Ueo, mu);
165  Unu.setpart_ex(0, Ueo, nu);
166 
167  m_shift.backward(m_w, Unu, mu);
168  mult_Field_Gnn(m_v, 0, Umu, 0, m_w, 0);
169  mult_Field_Gdn(m_w, 0, Unu, 0, m_v, 0);
170  m_shift.forward(c, m_w, nu);
171 }
172 
173 
174 //====================================================================
175 //============================================================END=====
void backward(Field &, const Field &, const int mu)
BridgeIO vout
Definition: bridgeIO.cpp:495
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
static const std::string class_name
Definition: staple_eo.h:36
void lower(Field_G &, const Field_G &, const int, const int)
constructs lower staple in mu-nu plane.
Definition: staple_eo.cpp:155
double plaq_t(const Field_G &)
calculates temporal plaquette value.
Definition: staple_eo.cpp:91
std::string m_filename_output
Definition: staple_eo.h:39
int nvol() const
Definition: field.h:116
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void staple(Field_G &, const Field_G &, const int)
constructs staple in mu-direction (summing up nu-direction).
Definition: staple_eo.cpp:116
Class for parameters.
Definition: parameters.h:46
Even-odd site index.
Definition: index_eo.h:39
static int Lvol()
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
void upper(Field_G &, const Field_G &, const int, const int)
constructs upper staple in mu-nu plane.
Definition: staple_eo.cpp:134
void set_parameters(const Parameters &params)
setting parameters.
Definition: staple_eo.cpp:33
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staple_eo.cpp:46
SU(N) gauge field.
Definition: field_G.h:38
Bridge::VerboseLevel m_vl
Definition: staple.h:36
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Staple construction.
Definition: staple_eo.h:33
Field_G m_v
Definition: staple_eo.h:41
Field_G m_w
Definition: staple_eo.h:41
double plaq_s(const Field_G &)
calculates spatial plaquette value.
Definition: staple_eo.cpp:58
void forward(Field &, const Field &, const int mu)
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:126
ShiftField_eo m_shift
Definition: staple_eo.h:42
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
Base class for Staple construction.
Definition: staple.h:33
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
string get_string(const string &key) const
Definition: parameters.cpp:116
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:113
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
double ReTr(const Mat_SU_N &m)
Definition: mat_SU_N.h:488
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)