Bridge++  Ver. 1.1.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 //====================================================================
17 double Staples::plaquette(const Field_G& U)
18 {
19  return (plaq_s(U) + plaq_t(U)) / 2;
20 }
21 
22 
23 //====================================================================
24 double Staples::plaq_s(const Field_G& U)
25 {
26  double plaq = 0.0;
28 
29  staple = upper(U, 0, 1);
30  for (int site = 0; site < Nvol; ++site) {
31  plaq += ReTr(U.mat(site, 0) * staple.mat_dag(site)); // P_xy
32  }
33 
34  staple = upper(U, 1, 2);
35  for (int site = 0; site < Nvol; ++site) {
36  plaq += ReTr(U.mat(site, 1) * staple.mat_dag(site)); // P_yz
37  }
38 
39  staple = upper(U, 2, 0);
40  for (int site = 0; site < Nvol; ++site) {
41  plaq += ReTr(U.mat(site, 2) * staple.mat_dag(site)); // P_zx
42  }
43 
44  plaq = Communicator::reduce_sum(plaq);
45 
46  return plaq / (Lvol * Nc * 3.0);
47 }
48 
49 
50 //====================================================================
51 double Staples::plaq_t(const Field_G& U)
52 {
53  double plaq = 0.0;
55 
56  for (int nu = 0; nu < Ndim - 1; ++nu) {
57  staple = lower(U, 3, nu);
58  for (int site = 0; site < Nvol; ++site) {
59  plaq += ReTr(U.mat(site, 3) * staple.mat_dag(site)); // P_zx
60  }
61  }
62 
63  plaq = Communicator::reduce_sum(plaq);
64 
65  return plaq / (Lvol * Nc * 3.0);
66 }
67 
68 
69 //====================================================================
70 void Staples::staple(Field_G& W, const Field_G& U, const int mu)
71 {
72  W = 0.0;
73  for (int nu = 0; nu < Ndim; ++nu) {
74  if (nu != mu) {
75  W += upper(U, mu, nu);
76  W += lower(U, mu, nu);
77  }
78  }
79 }
80 
81 
82 //====================================================================
83 Field_G Staples::upper(const Field_G& U, const int mu, const int nu)
84 {
85  // (1) mu (2)
86  // +-->--+
87  // nu | |
88  // i+ +
89 
90  Field_G c;
91 
92  Umu.setpart_ex(0, U, mu);
93  Unu.setpart_ex(0, U, nu);
94 
95  shift.backward(v, Unu, mu);
96  shift.backward(c, Umu, nu);
97 
98  w.mult_Field_Gnd(0, c, 0, v, 0);
99  c.mult_Field_Gnn(0, Unu, 0, w, 0);
100 
101  return c;
102 }
103 
104 
105 //====================================================================
106 Field_G Staples::lower(const Field_G& U, const int mu, const int nu)
107 {
108  // + +
109  // nu | |
110  // i+-->--+
111  // (1) mu (2)
112 
113  Field_G c;
114 
115  Umu.setpart_ex(0, U, mu);
116  Unu.setpart_ex(0, U, nu);
117 
118  shift.backward(w, Unu, mu);
119  v.mult_Field_Gnn(0, Umu, 0, w, 0);
120  w.mult_Field_Gdn(0, Unu, 0, v, 0);
121  shift.forward(c, w, nu);
122 
123  return c;
124 }
125 
126 
127 //====================================================================
128 //============================================================END=====