Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_F_Rational_Frame_SF.cpp
Go to the documentation of this file.
1 
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using Bridge::vout;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_string("verbose_level", "NULL");
27  }
28 
29 
30 #ifdef USE_PARAMETERS_FACTORY
31  bool init_param = ParametersFactory::Register("Action.F_Rational_Frame_SF", append_entry);
32 #endif
33 }
34 //- end
35 
36 //- parameters class
38 //- end
39 
40 const std::string Action_F_Rational_frame_SF::class_name = "Action_F_Rational_frame_SF";
41 
42 //====================================================================
44 {
45  const string str_vlevel = params.get_string("verbose_level");
46 
47  m_vl = vout.set_verbose_level(str_vlevel);
48 }
49 
50 
51 //====================================================================
53 {
54  int Nc = CommonParameters::Nc();
55  int Nvol = CommonParameters::Nvol();
56  int Ndim = CommonParameters::Ndim();
57  int NinG = 2 * Nc * Nc;
58 
59  m_force.reset(NinG, Nvol, Ndim);
60 
61  // link variable update flag
62  m_status_linkv = 0;
63 }
64 
65 
66 //====================================================================
68 {
69  int NinF = m_fopr_langev->field_nin();
70  int NvolF = m_fopr_langev->field_nvol();
71  int NexF = m_fopr_langev->field_nex();
72  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
73 
74  m_psf.reset(NinF, NvolF, NexF);
75 
76  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
77 
78  Field xi(NinF, NvolF, NexF);
79  rand->gauss_lex_global(xi);
80 
82  m_psf = m_fopr_langev->mult(xi);
83 
84  Field_F_SF setzero;
85  setzero.set_boundary_zero(xi);
86 
87  double xi2 = xi.norm();
88  double H_psf = xi2 * xi2;
89 
90  vout.general(m_vl, " H_Frational = %18.8f\n", H_psf);
91  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
92 
93  return H_psf;
94 }
95 
96 
97 //====================================================================
99 {
100  int NinF = m_fopr_H->field_nin();
101  int NvolF = m_fopr_H->field_nvol();
102  int NexF = m_fopr_H->field_nex();
103  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
104 
105  Field v1(NinF, NvolF, NexF);
106 
107  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
108 
110  v1 = m_fopr_H->mult(m_psf);
111 
112  double H_psf = v1 * m_psf;
113 
114  vout.general(m_vl, " H_Frational = %18.8f\n", H_psf);
115  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
116 
117  return H_psf;
118 }
119 
120 
121 //====================================================================
123 {
124  if (m_status_linkv == 0) {
125  int Nvol = m_U->nvol();
126  int Nex = m_U->nex();
127 
128  Field_G force(Nvol, Nex), force1(Nvol, Nex);
129 
130  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
131 
134 
135  Field_G_SF Fboundary(force);
136  Fboundary.set_boundary_spatial_link_zero();
137  m_force = (Field)Fboundary;
138 
139  // m_force = (Field)force;
140  ++m_status_linkv;
141 
142  double Fave, Fmax, Fdev;
143  m_force.stat(Fave, Fmax, Fdev);
144  vout.general(m_vl, " Frational_frame_ave = %12.6f Frational_frame_max = %12.6f Frational_frame_dev = %12.6f\n",
145  Fave, Fmax, Fdev);
146 
147  return m_force;
148  } else {
149  vout.general(m_vl, " %s returns previous force.\n", class_name.c_str());
150  return m_force;
151  }
152 }
153 
154 
155 //====================================================================
156 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:207
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
double calcH()
calculation of Hamiltonian.
virtual const Field mult(const Field &)=0
multiplies fermion operator to a given field and returns the resultant field.
void general(const char *format,...)
Definition: bridgeIO.cpp:38
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
Container of Field-type object.
Definition: field.h:37
virtual void set_config(Field *)=0
int nvol() const
Definition: field.h:101
Class for parameters.
Definition: parameters.h:40
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
virtual int field_nin()=0
returns the on-site d.o.f. for which the fermion operator is defined.
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:125
SU(N) gauge field.
Definition: field_G.h:36
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:82
double norm() const
Definition: field.h:210
virtual int field_nex()=0
returns the external d.o.f. for which the fermion operator is defined.
int nex() const
Definition: field.h:102
virtual void force_core(Field &, const Field &)
Definition: force.cpp:58
static const std::string class_name
const Field force()
returns the force for updating conjugate momentum.
static bool Register(const std::string &realm, const creator_callback &cb)
Bridge::VerboseLevel m_vl
Definition: action.h:64
Base class of random number generators.
Definition: randomNumbers.h:40
void set_parameters(const Parameters &params)
setting parameters and creating class instances.
void set_boundary_zero(Field &f)
Definition: field_F_SF.h:56
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:544
double langevin(RandomNumbers *)
Langevin step called at the beginning of HMC.
void setup()
creating instances. called from set_parameters().
string get_string(const string &key) const
Definition: parameters.cpp:85
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.
A class generated to add a function for the SF.
Definition: field_F_SF.h:33
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
static int NPE()