Bridge++  Ver. 2.0.2
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  std::string vlevel;
28  if (!params.fetch_string("verbose_level", vlevel)) {
29  m_vl = vout.set_verbose_level(vlevel);
30  }
31 
32  //- fetch and check input parameters
33  double beta, c_plaq, c_rect;
34  double ct0, ct1, ct2, ctr0, ctr1, ctr2;
35  std::vector<double> phi, phipr;
36 
37  int err = 0;
38  err += params.fetch_double("beta", beta);
39  err += params.fetch_double("c_plaq", c_plaq);
40  err += params.fetch_double("c_rect", c_rect);
41 
42  err += params.fetch_double("ct0", ct0);
43  err += params.fetch_double("ct1", ct1);
44  err += params.fetch_double("ct2", ct2);
45 
46  err += params.fetch_double("ctr0", ctr0);
47  err += params.fetch_double("ctr1", ctr1);
48  err += params.fetch_double("ctr2", ctr2);
49 
50  err += params.fetch_double_vector("phi", phi);
51  err += params.fetch_double_vector("phipr", phipr);
52 
53  if (err) {
54  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
55  exit(EXIT_FAILURE);
56  }
57 
58 
59  const double gg = 6.0 / beta;
60 
61  const double ct = ct0 + ct1 * gg + ct2 * gg * gg;
62  const double ctr = ctr0 + ctr1 * gg + ctr2 * gg * gg;
63 
64  set_parameters(beta, c_plaq, c_rect, &phi[0], &phipr[0], ct, ctr);
65 
66  //- post-process
67  m_force_G->set_parameters(params);
68 }
69 
70 
71 //====================================================================
73 {
74  params.set_double("beta", m_beta);
75  params.set_double("c_plaq", m_c_plaq);
76  params.set_double("c_rect", m_c_rect);
77 
78  // params.set_double("ct0", m_ct0);
79  // params.set_double("ct1", m_ct1);
80  // params.set_double("ct2", m_ct2);
81 
82  // params.set_double("ctr0", m_ctr0);
83  // params.set_double("ctr1", m_ctr1);
84  // params.set_double("ctr2", m_ctr2);
85 
86  params.set_double_vector("phi", m_phi);
87  params.set_double_vector("phipr", m_phipr);
88 
89  params.set_double("ct", m_ct);
90  params.set_double("ctr", m_ctr);
91 
92  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
93 }
94 
95 
96 //====================================================================
97 
111 void Action_G_Rectangle_SF::set_parameters(const double beta, const double c_plaq, const double c_rect,
112  double *phi, double *phipr,
113  const double ct, const double ctr)
114 {
115  //- print input parameters
116  vout.general(m_vl, "%s:\n", class_name.c_str());
117  vout.general(m_vl, " beta = %12.6f\n", beta);
118  vout.general(m_vl, " c_plaq = %12.6f\n", c_plaq);
119  vout.general(m_vl, " c_rect = %12.6f\n", c_rect);
120  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
121  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
122  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
123  vout.general(m_vl, " phipr1 = %12.6f\n", phipr[0]);
124  vout.general(m_vl, " phipr2 = %12.6f\n", phipr[1]);
125  vout.general(m_vl, " phipr3 = %12.6f\n", phipr[2]);
126  vout.general(m_vl, " ct = %12.6f\n", ct);
127  vout.general(m_vl, " ctr = %12.6f\n", ctr);
128 
129  //- range check
130  // NB. beta,c_plaq,c_rect,phi,phipr,ct,ctr = 0 is allowed.
131 
132  //- store values
133  m_beta = beta;
134  m_c_plaq = c_plaq;
135  m_c_rect = c_rect;
136 
137  m_ct = ct;
138  m_ctr = ctr;
139 
140  // m_phi = std::vector<double>(phi, phi+3);
141  // m_phipr = std::vector<double>(phipr, phipr+3);
142  m_phi.resize(3);
143  m_phipr.resize(3);
144  for (int i = 0; i < 3; ++i) {
145  m_phi[i] = phi[i];
146  m_phipr[i] = phipr[i];
147  }
148 
149  //- post-process
151 
152  const int Lx = CommonParameters::Lx();
153 
154  double c0r = cos(phi[0] / Lx);
155  double c0i = sin(phi[0] / Lx);
156  double c1r = cos(phi[1] / Lx);
157  double c1i = sin(phi[1] / Lx);
158  double c2r = cos(phi[2] / Lx);
159  double c2i = sin(phi[2] / Lx);
160  m_wk.zero();
161  m_wk.set(0, 0, c0r, c0i);
162  m_wk.set(1, 1, c1r, c1i);
163  m_wk.set(2, 2, c2r, c2i);
164 
165  c0r = cos(phipr[0] / Lx);
166  c0i = sin(phipr[0] / Lx);
167  c1r = cos(phipr[1] / Lx);
168  c1i = sin(phipr[1] / Lx);
169  c2r = cos(phipr[2] / Lx);
170  c2i = sin(phipr[2] / Lx);
171  m_wkpr.zero();
172  m_wkpr.set(0, 0, c0r, c0i);
173  m_wkpr.set(1, 1, c1r, c1i);
174  m_wkpr.set(2, 2, c2r, c2i);
175 }
176 
177 
178 //====================================================================
180 {
181  const double H_U = calcH();
182 
183  return H_U;
184 }
185 
186 
187 //====================================================================
188 
231 {
232  const int Ndim = CommonParameters::Ndim();
233  const int Nvol = CommonParameters::Nvol();
234 
235  const int Nt = CommonParameters::Nt();
236  const int NPEt = CommonParameters::NPEt();
237 
238  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
239 
240  double plaqF = 0.0;
241  double rectF = 0.0;
242 
243  for (int mu = 0; mu < Ndim; ++mu) {
244  for (int nu = mu + 1; nu < Ndim; ++nu) {
245  Field_G Cup1;
246  m_staple.upper(Cup1, *m_U, mu, nu);
247 
248  Field_G Cup2;
249  m_staple.upper(Cup2, *m_U, nu, mu);
250 
251  // plaquette term
252  Field_G Unu = Cup2;
253  // If the node is at the boundary the temporal plaquette is multiplied with ct.
254  if ((nu == 3) && (Communicator::ipe(3) == 0)) {
255  //Unu.mult_ct_boundary(0, m_ct);
257  }
258  if ((nu == 3) && (Communicator::ipe(3) == NPEt - 1)) {
259  Field_SF::mult_ct_boundary(Unu, Nt - 1, m_ct);
260  }
261  for (int site = 0; site < Nvol; ++site) {
262  plaqF += ReTr(m_U->mat(site, nu) * Unu.mat_dag(site));
263  }
264 
265  // rectangular terms
266 
267  // +---+---+
268  // | | term
269  // x <---+
270  Field_G Umu;
271  Umu.setpart_ex(0, *m_U, mu);
272  Unu.setpart_ex(0, *m_U, nu);
273  if ((Communicator::ipe(3) == 0) && (nu == 3)) {
275  }
276 
277  Field_G v;
278  m_shift.backward(v, Cup2, mu);
279 
280  Field_G c;
281  m_shift.backward(c, Umu, nu);
282  if ((Communicator::ipe(3) == 0) && (nu == 3)) {
284  }
285  if ((Communicator::ipe(3) == NPEt - 1) && (nu == 3)) {
287  Field_SF::mult_ct_boundary(c, Nt - 1, m_ctr);
288  }
289 
290  Field_G w;
291  mult_Field_Gnd(w, 0, c, 0, v, 0);
292 
293  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
294  for (int site = 0; site < Nvol; ++site) {
295  rectF += ReTr(Umu.mat(site) * c.mat_dag(site));
296  }
297 
298  // +---+
299  // | |
300  // + + term
301  // | |
302  // x v
303 
304  m_shift.backward(v, Unu, mu);
305  m_shift.backward(c, Cup1, nu);
306 
307  mult_Field_Gnd(w, 0, c, 0, v, 0);
308  mult_Field_Gnn(c, 0, Unu, 0, w, 0);
309  for (int site = 0; site < Nvol; ++site) {
310  rectF += ReTr(Umu.mat(site) * c.mat_dag(site));
311  }
312  }
313  }
314 
315  plaqF = Communicator::reduce_sum(plaqF);
316  rectF = Communicator::reduce_sum(rectF);
317 
318  // double plaq = plaqF/Nc;
319  // vout.general(m_vl," Plaquette = %18.8f\n",plaq/size_U);
320 
321  // double H_U = m_c_plaq * (Ndim2*Lvol - plaqF/Nc)
322  // + m_c_rect * (Ndim2*Lvol*2 - rectF/Nc);
323  double H_U = m_c_plaq * (-plaqF / m_Nc)
324  + m_c_rect * (-rectF / m_Nc);
325 
326  H_U = m_beta * H_U;
327 
328  vout.general(m_vl, " H_Grectangle = %18.8f\n", H_U);
329  // vout.general(m_vl," H_G/dof = %18.8f\n",H_U/size_U);
330 
331  return H_U;
332 }
333 
334 
335 //====================================================================
336 
392 {
393  //- check of argument type
394  assert(force.nin() == m_U->nin());
395  assert(force.nvol() == m_U->nvol());
396  assert(force.nex() == m_U->nex());
397 
398  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
399 
400  force.set(0.0);
401 
403 }
404 
405 
406 //====================================================================
407 //============================================================END=====
Action_G_Rectangle_SF::m_ct
double m_ct
SF boundary improvement coefficient for the plaquatte action.
Definition: action_G_Rectangle_SF.h:128
Field_SF::set_boundary_wkpr
void set_boundary_wkpr(Field_G &u, const Mat_SU_N &wkpr)
Definition: field_SF.cpp:63
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
Action_G_Rectangle_SF::m_shift
ShiftField_lex m_shift
Definition: action_G_Rectangle_SF.h:121
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Staple_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:35
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Parameters
Class for parameters.
Definition: parameters.h:46
Field_G::mat_dag
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
Force_G::force_core
virtual void force_core(Field &)=0
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Field::nex
int nex() const
Definition: field.h:128
RandomNumbers
Base class of random number generators.
Definition: randomNumbers.h:43
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Action_G_Rectangle_SF::m_wkpr
Mat_SU_N m_wkpr
Definition: action_G_Rectangle_SF.h:125
Action_G_Rectangle_SF::m_c_plaq
double m_c_plaq
Definition: action_G_Rectangle_SF.h:114
Field_SF::set_boundary_wk
void set_boundary_wk(Field_G &u, const Mat_SU_N &wk)
Definition: field_SF.cpp:32
Action_G_Rectangle_SF::m_wk
Mat_SU_N m_wk
SF boundary condition.
Definition: action_G_Rectangle_SF.h:125
Parameters::set_double_vector
void set_double_vector(const string &key, const vector< double > &value)
Definition: parameters.cpp:42
Field::nin
int nin() const
Definition: field.h:126
Staple_SF::upper
void upper(Field_G &, const Field_G &, const int, const int)
Definition: staple_SF.cpp:877
Force_G::set_parameters
virtual void set_parameters(const Parameters &)=0
Action_G_Rectangle_SF::class_name
static const std::string class_name
Definition: action_G_Rectangle_SF.h:106
SU_N::Mat_SU_N::set
void set(int c, const double &re, const double &im)
Definition: mat_SU_N.h:137
Field_SF::mult_ct_boundary
void mult_ct_boundary(Field_G &u, const int t, const double ct)
Definition: field_SF.cpp:185
Communicator::reduce_sum
static int reduce_sum(int count, dcomplex *recv_buf, dcomplex *send_buf, int pattern=0)
make a global sum of an array of dcomplex over the communicator. pattern specifies the dimensions to ...
Definition: communicator.cpp:263
CommonParameters::Lx
static int Lx()
Definition: commonParameters.h:91
Action_G_Rectangle_SF::m_phi
std::vector< double > m_phi
Definition: action_G_Rectangle_SF.h:132
Action_G_Rectangle_SF::m_label
std::string m_label
Definition: action_G_Rectangle_SF.h:117
SU_N::Mat_SU_N::zero
Mat_SU_N & zero()
Definition: mat_SU_N.h:429
Action_G_Rectangle_SF::m_Nc
int m_Nc
Definition: action_G_Rectangle_SF.h:111
Action_G_Rectangle_SF::m_ctr
double m_ctr
SF boundary improvement coefficient for the rectangle action.
Definition: action_G_Rectangle_SF.h:129
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
Action_G_Rectangle_SF::langevin
double langevin(RandomNumbers *)
Langevis step.
Definition: action_G_Rectangle_SF.cpp:179
Field::nvol
int nvol() const
Definition: field.h:127
Action_G_Rectangle_SF::m_force_G
Force_G * m_force_G
Definition: action_G_Rectangle_SF.h:122
Action_G_Rectangle_SF::m_U
Field_G * m_U
Definition: action_G_Rectangle_SF.h:119
Action_G_Rectangle_SF::m_staple
Staple_SF m_staple
Definition: action_G_Rectangle_SF.h:120
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
mult_Field_Gnn
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:95
Action_G_Rectangle_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: action_G_Rectangle_SF.h:109
ShiftField_lex::backward
void backward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:59
Action_G_Rectangle_SF::m_phipr
std::vector< double > m_phipr
Definition: action_G_Rectangle_SF.h:133
Communicator::ipe
static int ipe(const int dir)
logical coordinate of current proc.
Definition: communicator.cpp:105
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
CommonParameters::NPEt
static int NPEt()
Definition: commonParameters.h:100
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Action_G_Rectangle_SF::m_beta
double m_beta
Definition: action_G_Rectangle_SF.h:113
SU_N::ReTr
double ReTr(const Mat_SU_N &m)
Definition: mat_SU_N.h:534
Field
Container of Field-type object.
Definition: field.h:46
Field_G::mat
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
action_G_Rectangle_SF.h
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Action_G_Rectangle_SF::force
void force(Field &)
Definition: action_G_Rectangle_SF.cpp:391
Action_G_Rectangle_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: action_G_Rectangle_SF.cpp:72
Parameters::fetch_double_vector
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
Action_G_Rectangle_SF::m_c_rect
double m_c_rect
Definition: action_G_Rectangle_SF.h:115
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Action_G_Rectangle_SF::calcH
double calcH()
Definition: action_G_Rectangle_SF.cpp:230
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173
Action_G_Rectangle_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: action_G_Rectangle_SF.cpp:25
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154