Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_G_Plaq.cpp
Go to the documentation of this file.
1 
14 #include "force_G_Plaq.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Force_G_Plaq::register_factory();
19 }
20 #endif
21 
22 const std::string Force_G_Plaq::class_name = "Force_G_Plaq";
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;
33 
34  int err = 0;
35  err += params.fetch_double("beta", beta);
36 
37  if (err) {
38  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
39  exit(EXIT_FAILURE);
40  }
41 
42 
43  set_parameters(beta);
44 }
45 
46 
47 //====================================================================
48 void Force_G_Plaq::set_parameters(const double beta)
49 {
50  //- print input parameters
51  vout.general(m_vl, "%s:\n", class_name.c_str());
52  vout.general(m_vl, " beta = %8.4f\n", beta);
53 
54  //- range check
55  // NB. kappa == 0 is allowed.
56 
57  //- store values
58  m_beta = beta;
59 }
60 
61 
62 //====================================================================
64 {
65  const int Nc = CommonParameters::Nc();
66  const int Nvol = CommonParameters::Nvol();
67  const int Ndim = CommonParameters::Ndim();
68 
69  assert(m_U->nin() == Nc * Nc * 2);
70  assert(m_U->nvol() == Nvol);
71  assert(m_U->nex() == Ndim);
72 
73  assert(force.nin() == Nc * Nc * 2);
74  assert(force.nvol() == Nvol);
75  assert(force.nex() == Ndim);
76 
77  for (int mu = 0; mu < Ndim; ++mu) {
78  Field_G st;
79  m_staple.staple(st, *m_U, mu);
80  // Calculate staple for m_U(all site,\mu) (SA)
81 
82  /* -->--
83  | |
84  | |
85  U_mu
86  */
87  Field_G force1;
88 
89  for (int site = 0; site < Nvol; ++site) {
90  Mat_SU_N ut(Nc); // Nc x Nc complex matrix (SA)
91  ut = m_U->mat(site, mu) * st.mat_dag(site); // U_\mu * (staple)^\dagger (SA)
92  ut.at(); // anti-hermitian and traceless (SA)
93  //ut *= -beta/Nc;
94  // force = -beta*{U_\mu *staple^\dagger}_{traceless & anti-hermitian) (SA)
95  force1.set_mat(site, 0, ut);
96  }
97 
98  axpy(force, mu, -(m_beta / Nc), force1, 0);
99  }
100 
101  double Fave, Fmax, Fdev;
102  force.stat(Fave, Fmax, Fdev);
103 
104  //- calculate average, max, deviation of force over (site, mu)
105  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
106  Fave, Fmax, Fdev);
107 }
108 
109 
110 //====================================================================
111 //============================================================END=====
void set_parameters(const Parameters &params)
BridgeIO vout
Definition: bridgeIO.cpp:503
Field_G * m_U
Definition: force_G.h:34
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
double m_beta
Definition: force_G_Plaq.h:42
int nvol() const
Definition: field.h:127
Staple_lex m_staple
Definition: force_G_Plaq.h:43
Class for parameters.
Definition: parameters.h:46
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:329
void staple(Field_G &, const Field_G &, const int mu)
constructs staple in mu-direction (summing up nu-direction).
Definition: staple_lex.cpp:128
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
int nex() const
Definition: field.h:128
static const std::string class_name
Definition: force_G_Plaq.h:36
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
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 force_core(Field &force)
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
string get_string(const string &key) const
Definition: parameters.cpp:221
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
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