Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_G_Rectangle_SF.cpp
Go to the documentation of this file.
1 
14 #include "action_G_Rectangle_SF.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Action_G_Rectangle_SF::register_factory();
19 }
20 #endif
21 
22 const std::string Action_G_Rectangle_SF::class_name = "Action_G_Rectangle_SF";
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  double ct0, ct1, ct2, ctr0, ctr1, ctr2;
34  std::vector<double> phi, phipr;
35 
36  int err = 0;
37  err += params.fetch_double("beta", beta);
38  err += params.fetch_double("c_plaq", c_plaq);
39  err += params.fetch_double("c_rect", c_rect);
40 
41  err += params.fetch_double("ct0", ct0);
42  err += params.fetch_double("ct1", ct1);
43  err += params.fetch_double("ct2", ct2);
44 
45  err += params.fetch_double("ctr0", ctr0);
46  err += params.fetch_double("ctr1", ctr1);
47  err += params.fetch_double("ctr2", ctr2);
48 
49  err += params.fetch_double_vector("phi", phi);
50  err += params.fetch_double_vector("phipr", phipr);
51 
52  if (err) {
53  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
54  exit(EXIT_FAILURE);
55  }
56 
57 
58  const double gg = 6.0 / beta;
59 
60  const double ct = ct0 + ct1 * gg + ct2 * gg * gg;
61  const double ctr = ctr0 + ctr1 * gg + ctr2 * gg * gg;
62 
63  set_parameters(beta, c_plaq, c_rect, &phi[0], &phipr[0], ct, ctr);
64 
65  //- post-process
66  m_force_G->set_parameters(params);
67 }
68 
69 
70 //====================================================================
71 
85 void Action_G_Rectangle_SF::set_parameters(const double beta, const double c_plaq, const double c_rect,
86  double *phi, double *phipr,
87  const double ct, const double ctr)
88 {
89  //- print input parameters
90  vout.general(m_vl, "%s:\n", class_name.c_str());
91  vout.general(m_vl, " beta = %12.6f\n", beta);
92  vout.general(m_vl, " c_plaq = %12.6f\n", c_plaq);
93  vout.general(m_vl, " c_rect = %12.6f\n", c_rect);
94  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
95  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
96  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
97  vout.general(m_vl, " phipr1 = %12.6f\n", phipr[0]);
98  vout.general(m_vl, " phipr2 = %12.6f\n", phipr[1]);
99  vout.general(m_vl, " phipr3 = %12.6f\n", phipr[2]);
100  vout.general(m_vl, " ct = %12.6f\n", ct);
101  vout.general(m_vl, " ctr = %12.6f\n", ctr);
102 
103  //- range check
104  // NB. beta,c_plaq,c_rect,phi,phipr,ct,ctr = 0 is allowed.
105 
106  //- store values
107  m_beta = beta;
108  m_c_plaq = c_plaq;
109  m_c_rect = c_rect;
110 
111  m_ct = ct;
112  m_ctr = ctr;
113 
114  //- post-process
115  m_staple.set_parameters(phi, phipr);
116 
117  const int Lx = CommonParameters::Lx();
118 
119  double c0r = cos(phi[0] / Lx);
120  double c0i = sin(phi[0] / Lx);
121  double c1r = cos(phi[1] / Lx);
122  double c1i = sin(phi[1] / Lx);
123  double c2r = cos(phi[2] / Lx);
124  double c2i = sin(phi[2] / Lx);
125  m_wk.zero();
126  m_wk.set(0, 0, c0r, c0i);
127  m_wk.set(1, 1, c1r, c1i);
128  m_wk.set(2, 2, c2r, c2i);
129 
130  c0r = cos(phipr[0] / Lx);
131  c0i = sin(phipr[0] / Lx);
132  c1r = cos(phipr[1] / Lx);
133  c1i = sin(phipr[1] / Lx);
134  c2r = cos(phipr[2] / Lx);
135  c2i = sin(phipr[2] / Lx);
136  m_wkpr.zero();
137  m_wkpr.set(0, 0, c0r, c0i);
138  m_wkpr.set(1, 1, c1r, c1i);
139  m_wkpr.set(2, 2, c2r, c2i);
140 }
141 
142 
143 //====================================================================
145 {
146  const double H_U = calcH();
147 
148  return H_U;
149 }
150 
151 
152 //====================================================================
153 
196 {
197  const int Ndim = CommonParameters::Ndim();
198  const int Nvol = CommonParameters::Nvol();
199 
200  const int Nt = CommonParameters::Nt();
201  const int NPEt = CommonParameters::NPEt();
202 
203  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
204 
205  double plaqF = 0.0;
206  double rectF = 0.0;
207 
208  for (int mu = 0; mu < Ndim; ++mu) {
209  for (int nu = mu + 1; nu < Ndim; ++nu) {
210  Field_G_SF Cup1;
211  m_staple.upper(Cup1, *m_U, mu, nu);
212 
213  Field_G_SF Cup2;
214  m_staple.upper(Cup2, *m_U, nu, mu);
215 
216  // plaquette term
217  Field_G_SF Unu = Cup2;
218  // If the node is at the boundary the temporal plaquette is multiplied with ct.
219  if ((nu == 3) && (Communicator::ipe(3) == 0)) {
220  Unu.mult_ct_boundary(0, m_ct);
221  }
222  if ((nu == 3) && (Communicator::ipe(3) == NPEt - 1)) {
223  Unu.mult_ct_boundary(Nt - 1, m_ct);
224  }
225  for (int site = 0; site < Nvol; ++site) {
226  plaqF += ReTr(m_U->mat(site, nu) * Unu.mat_dag(site));
227  }
228 
229  // rectangular terms
230 
231  // +---+---+
232  // | | term
233  // x <---+
234  Field_G_SF Umu;
235  Umu.setpart_ex(0, *m_U, mu);
236  Unu.setpart_ex(0, *m_U, nu);
237  if ((Communicator::ipe(3) == 0) && (nu == 3)) {
238  Umu.set_boundary_wk(m_wk);
239  }
240 
241  Field_G_SF v;
242  m_shift.backward(v, Cup2, mu);
243 
244  Field_G_SF c;
245  m_shift.backward(c, Umu, nu);
246  if ((Communicator::ipe(3) == 0) && (nu == 3)) {
247  c.mult_ct_boundary(0, m_ctr);
248  }
249  if ((Communicator::ipe(3) == NPEt - 1) && (nu == 3)) {
251  c.mult_ct_boundary(Nt - 1, m_ctr);
252  }
253 
254  Field_G_SF w;
255  mult_Field_Gnd(w, 0, c, 0, v, 0);
256 
257  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
258  for (int site = 0; site < Nvol; ++site) {
259  rectF += ReTr(Umu.mat(site) * c.mat_dag(site));
260  }
261 
262  // +---+
263  // | |
264  // + + term
265  // | |
266  // x v
267 
268  m_shift.backward(v, Unu, mu);
269  m_shift.backward(c, Cup1, nu);
270 
271  mult_Field_Gnd(w, 0, c, 0, v, 0);
272  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
273  for (int site = 0; site < Nvol; ++site) {
274  rectF += ReTr(Umu.mat(site) * c.mat_dag(site));
275  }
276  }
277  }
278 
279  plaqF = Communicator::reduce_sum(plaqF);
280  rectF = Communicator::reduce_sum(rectF);
281 
282  // double plaq = plaqF/Nc;
283  // vout.general(m_vl," Plaquette = %18.8f\n",plaq/size_U);
284 
285  // double H_U = m_c_plaq * (Ndim2*Lvol - plaqF/Nc)
286  // + m_c_rect * (Ndim2*Lvol*2 - rectF/Nc);
287  double H_U = m_c_plaq * (-plaqF / m_Nc)
288  + m_c_rect * (-rectF / m_Nc);
289 
290  H_U = m_beta * H_U;
291 
292  vout.general(m_vl, " H_Grectangle = %18.8f\n", H_U);
293  // vout.general(m_vl," H_G/dof = %18.8f\n",H_U/size_U);
294 
295  return H_U;
296 }
297 
298 
299 //====================================================================
300 
356 {
357  //- check of argument type
358  assert(force.nin() == m_U->nin());
359  assert(force.nvol() == m_U->nvol());
360  assert(force.nex() == m_U->nex());
361 
362  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
363 
364  force.set(0.0);
365 
366  m_force_G->force_core(force, m_U);
367 }
368 
369 
370 //====================================================================
371 //============================================================END=====
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_G_SF.h:33
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_boundary_wkpr(const Mat_SU_N &U)
Set the boundary spatial link at t=Nt-1 for SF bc.
Definition: field_G_SF.cpp:53
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Mat_SU_N & zero()
Definition: mat_SU_N.h:383
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
Class for parameters.
Definition: parameters.h:46
static int ipe(const int dir)
logical coordinate of current proc.
virtual void force_core(Field &)=0
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:35
int nin() const
Definition: field.h:126
void set_parameters(const Parameters &params)
void upper(Field_G_SF &, const Field_G &, const int, const int)
Definition: staple_SF.cpp:886
void mult_ct_boundary(const int t, const double ct)
Multiply the boundary improvement factor ct or ctr to an SU(N) matrix object which belongs to a site ...
Definition: field_G_SF.cpp:128
void set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:27
double m_ct
SF boundary improvement coefficient for the plaquatte action.
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:128
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
Bridge::VerboseLevel m_vl
Definition: action.h:75
Base class of random number generators.
Definition: randomNumbers.h:43
double m_ctr
SF boundary improvement coefficient for the rectangle action.
static const std::string class_name
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
double langevin(RandomNumbers *)
Langevis step.
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...
Mat_SU_N m_wk
SF boundary condition.
virtual void set_parameters(const Parameters &)=0
void set(int c, double re, const double &im)
Definition: mat_SU_N.h:133
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
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
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)