Bridge++  Ver. 2.0.2
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  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;
34 
35  int err = 0;
36  err += params.fetch_double("beta", beta);
37 
38  if (err) {
39  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43 
44  set_parameters(beta);
45 }
46 
47 
48 //====================================================================
50 {
51  params.set_double("beta", m_beta);
52 
53  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
54 }
55 
56 
57 //====================================================================
58 void Force_G_Plaq::set_parameters(const double beta)
59 {
60  //- print input parameters
61  vout.general(m_vl, "%s:\n", class_name.c_str());
62  vout.general(m_vl, " beta = %8.4f\n", beta);
63 
64  //- range check
65  // NB. kappa == 0 is allowed.
66 
67  //- store values
68  m_beta = beta;
69 }
70 
71 
72 //====================================================================
74 {
75  const int Nc = CommonParameters::Nc();
76  const int Nvol = CommonParameters::Nvol();
77  const int Ndim = CommonParameters::Ndim();
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 st;
89  m_staple.staple(st, *m_U, mu);
90  // Calculate staple for m_U(all site,\mu) (SA)
91 
92  /* -->--
93  | |
94  | |
95  U_mu
96  */
97  Field_G force1;
98 
99  for (int site = 0; site < Nvol; ++site) {
100  Mat_SU_N ut(Nc); // Nc x Nc complex matrix (SA)
101  ut = m_U->mat(site, mu) * st.mat_dag(site); // U_\mu * (staple)^\dagger (SA)
102  ut.at(); // anti-hermitian and traceless (SA)
103  //ut *= -beta/Nc;
104  // force = -beta*{U_\mu *staple^\dagger}_{traceless & anti-hermitian) (SA)
105  force1.set_mat(site, 0, ut);
106  }
107 
108  axpy(force, mu, -(m_beta / Nc), force1, 0);
109  }
110 
111  double Fave, Fmax, Fdev;
112  force.stat(Fave, Fmax, Fdev);
113 
114  //- calculate average, max, deviation of force over (site, mu)
115  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
116  Fave, Fmax, Fdev);
117 }
118 
119 
120 //====================================================================
121 //============================================================END=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Force_G_Plaq::force_core
void force_core(Field &force)
Definition: force_G_Plaq.cpp:73
Parameters
Class for parameters.
Definition: parameters.h:46
Staple_lex::staple
void staple(Field_G &, const Field_G &, const int mu)
constructs staple in mu-direction (summing up nu-direction).
Definition: staple_lex.cpp:239
Field_G::mat_dag
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Force_G_Plaq::m_vl
Bridge::VerboseLevel m_vl
Definition: force_G_Plaq.h:39
Field::nex
int nex() const
Definition: field.h:128
Field_G::set_mat
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
Force_G_Plaq::get_parameters
void get_parameters(Parameters &params) const
Definition: force_G_Plaq.cpp:49
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Field::stat
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:169
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Field::nin
int nin() const
Definition: field.h:126
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
SU_N::Mat_SU_N
Definition: mat_SU_N.h:36
SU_N::Mat_SU_N::at
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:375
Field::nvol
int nvol() const
Definition: field.h:127
Force_G_Plaq::m_beta
double m_beta
Definition: force_G_Plaq.h:44
force_G_Plaq.h
Force_G_Plaq::m_staple
Staple_lex m_staple
Definition: force_G_Plaq.h:45
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_G::m_U
Field_G * m_U
Definition: force_G.h:34
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
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Force_G_Plaq::class_name
static const std::string class_name
Definition: force_G_Plaq.h:36
Field_G::mat
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Force_G_Plaq::set_parameters
void set_parameters(const Parameters &params)
Definition: force_G_Plaq.cpp:25
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
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