Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_G_Rectangle.cpp
Go to the documentation of this file.
1 
14 #include "force_G_Rectangle.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Force_G_Rectangle::register_factory();
19 }
20 #endif
21 
22 const std::string Force_G_Rectangle::class_name = "Force_G_Rectangle";
23 
24 //====================================================================
26 {
27  const string str_vlevel = params.get_string("verbose_level");
28 
29  m_vl = vout.set_verbose_level(str_vlevel);
30 
31  //- fetch and check input parameters
32  double beta, c_plaq, c_rect;
33 
34  int err = 0;
35  err += params.fetch_double("beta", beta);
36  err += params.fetch_double("c_plaq", c_plaq);
37  err += params.fetch_double("c_rect", c_rect);
38 
39  if (err) {
40  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
41  exit(EXIT_FAILURE);
42  }
43 
44 
45  set_parameters(beta, c_plaq, c_rect);
46 }
47 
48 
49 //====================================================================
50 void Force_G_Rectangle::set_parameters(const double beta,
51  const double c_plaq, const double c_rect)
52 {
53  //- print input parameters
54  vout.general(m_vl, "%s:\n", class_name.c_str());
55  vout.general(m_vl, " beta = %12.6f\n", beta);
56  vout.general(m_vl, " c_plaq = %12.6f\n", c_plaq);
57  vout.general(m_vl, " c_rect = %12.6f\n", c_rect);
58 
59  //- range check
60  // NB. beta,c_plaq,c_rect == 0 is allowed.
61 
62  //- store values
63  m_beta = beta;
64  m_c_plaq = c_plaq;
65  m_c_rect = c_rect;
66 
67  //- post-process
68 }
69 
70 
71 //====================================================================
73 {
74  const int Nc = CommonParameters::Nc();
75  const int Nvol = CommonParameters::Nvol();
76  const int Ndim = CommonParameters::Ndim();
77  const double eps = CommonParameters::epsilon_criterion();
78 
79  assert(m_U->nin() == Nc * Nc * 2);
80  assert(m_U->nvol() == Nvol);
81  assert(m_U->nex() == Ndim);
82 
83  assert(force.nin() == Nc * Nc * 2);
84  assert(force.nvol() == Nvol);
85  assert(force.nex() == Ndim);
86 
87  for (int mu = 0; mu < Ndim; ++mu) {
88  Field_G force1;
89  force1.set(0.0);
90 
91  for (int nu = 0; nu < Ndim; ++nu) {
92  if (nu == mu) continue;
93 
94  Field_G Cup1;
95  m_staple.upper(Cup1, *m_U, mu, nu);
96 
97  Field_G Cup2;
98  m_staple.upper(Cup2, *m_U, nu, mu);
99 
100  Field_G Cdn1;
101  m_staple.lower(Cdn1, *m_U, mu, nu);
102 
103  Field_G Cdn2;
104  m_staple.lower(Cdn2, *m_U, nu, mu);
105 
106  //- plaquette term
107  force1.addpart_ex(0, Cup1, 0, m_c_plaq);
108  force1.addpart_ex(0, Cdn1, 0, m_c_plaq);
109 
110 
111  //- rectangular term
112  // NB. skip this part, if m_c_rect = 0.0
113  if (fabs(m_c_rect) > eps) {
114  Field_G Umu;
115  Umu.setpart_ex(0, *m_U, mu);
116 
117  Field_G Unu;
118  Unu.setpart_ex(0, *m_U, nu);
119 
120  // +---+---+
121  // | | term
122  // x <---+
123  Field_G v;
124  m_shift.backward(v, Cup2, mu);
125 
126  Field_G c;
127  m_shift.backward(c, Umu, nu);
128 
129  Field_G w;
130  mult_Field_Gnd(w, 0, c, 0, v, 0);
131 
132  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
133 
134  force1.addpart_ex(0, c, 0, m_c_rect);
135 
136  // +---+
137  // | |
138  // + + term
139  // | |
140  // x v
141 
142  m_shift.backward(v, Unu, mu);
143  m_shift.backward(c, Cup1, nu);
144 
145  mult_Field_Gnd(w, 0, c, 0, v, 0);
146  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
147 
148  force1.addpart_ex(0, c, 0, m_c_rect);
149 
150  // +---+---+
151  // | | term
152  // +---x v
153 
154  m_shift.backward(v, Unu, mu);
155  m_shift.backward(c, Umu, nu);
156 
157  mult_Field_Gnd(w, 0, c, 0, v, 0);
158  mult_Field_Gnn(c, 0, Cdn2, 0, w, 0);
159 
160  force1.addpart_ex(0, c, 0, m_c_rect);
161 
162  // x <---+
163  // | | term
164  // +---+---+
165 
166  m_shift.backward(v, Cup2, mu);
167 
168  mult_Field_Gnn(w, 0, Umu, 0, v, 0);
169  mult_Field_Gdn(v, 0, Unu, 0, w, 0);
170 
171  m_shift.forward(c, v, nu);
172 
173  force1.addpart_ex(0, c, 0, m_c_rect);
174 
175  // x ^
176  // | |
177  // + + term
178  // | |
179  // +---+
180 
181  m_shift.backward(v, Unu, mu);
182 
183  mult_Field_Gnn(w, 0, Cdn1, 0, v, 0);
184  mult_Field_Gdn(v, 0, Unu, 0, w, 0);
185 
186  m_shift.forward(c, v, nu);
187 
188  force1.addpart_ex(0, c, 0, m_c_rect);
189 
190  // +---x ^
191  // | | term
192  // +---+---+
193 
194  m_shift.backward(v, Unu, mu);
195 
196  mult_Field_Gnn(w, 0, Umu, 0, v, 0);
197  mult_Field_Gdn(v, 0, Cdn2, 0, w, 0);
198 
199  m_shift.forward(c, v, nu);
200 
201  force1.addpart_ex(0, c, 0, m_c_rect);
202  }
203  }
204 
205  Field_G force2;
206  mult_Field_Gnd(force2, 0, *m_U, mu, force1, 0);
207  at_Field_G(force2, 0);
208 
209  axpy(force, mu, -(m_beta / Nc), force2, 0);
210  }
211 
212  double Fave, Fmax, Fdev;
213  force.stat(Fave, Fmax, Fdev);
214  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
215  Fave, Fmax, Fdev);
216 }
217 
218 
219 //====================================================================
220 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
static double epsilon_criterion()
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Field_G * m_U
Definition: force_G.h:34
ShiftField_lex m_shift
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
int nvol() const
Definition: field.h:127
void force_core(Field &)
void at_Field_G(Field_G &W, const int ex)
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Class for parameters.
Definition: parameters.h:46
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:177
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
static const std::string class_name
int nin() const
Definition: field.h:126
SU(N) gauge field.
Definition: field_G.h:38
Bridge::VerboseLevel m_vl
Definition: force_G.h:35
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:128
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:151
void set_parameters(const Parameters &params)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
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 crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void stat(double &Fave, double &Fmax, double &Fdev) const
determines the statistics of the field. average, maximum value, and deviation is determined over glob...
Definition: field.cpp:667
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
string get_string(const string &key) const
Definition: parameters.cpp:221
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void forward(Field &, const Field &, const int mu)
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)