Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_F_Standard.cpp
Go to the documentation of this file.
1 
14 #include "action_F_Standard.h"
15 
16 const std::string Action_F_Standard::class_name = "Action_F_Standard";
17 
18 //====================================================================
20 {
22 
24 }
25 
26 
27 //====================================================================
29 {
30  int Nc = CommonParameters::Nc();
31  int Nvol = CommonParameters::Nvol();
32  int Ndim = CommonParameters::Ndim();
33  int NinG = 2 * Nc * Nc;
34 
35  vout.general(m_vl, "%s:\n", class_name.c_str());
36 
37  m_force.reset(NinG, Nvol, Ndim);
38 
39  int Niter = 2000;
40  double Stop_cond = 1.0e-24;
41 
42  string str_solver_type = "CG";
43  m_solver = Solver::New(str_solver_type, m_fopr);
44  m_solver->set_parameters(Niter, Stop_cond);
45 
46  // link variable update flag
47  m_status_linkv = 0;
48 }
49 
50 
51 //====================================================================
53 {
54  int Nvol = CommonParameters::Nvol();
55  int Ndim = CommonParameters::Ndim();
56 
57  int NinF = m_fopr->field_nin();
58  int NvolF = m_fopr->field_nvol();
59  int NexF = m_fopr->field_nex();
60  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
61 
62  assert(NvolF == Nvol);
63  m_psf.reset(NinF, NvolF, NexF);
64 
65  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
66 
67  Field xi(NinF, NvolF, NexF);
68  rand->gauss_lex_global(xi);
69 
71  m_fopr->set_mode("Ddag");
72  m_psf = m_fopr->mult(xi);
73 
74  double xi2 = xi.norm();
75  double H_psf = xi2 * xi2;
76 
77  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
78  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
79 
80  return H_psf;
81 }
82 
83 
84 //====================================================================
86 {
87  int Nvol = CommonParameters::Nvol();
88  int Ndim = CommonParameters::Ndim();
89 
90  int NinF = m_fopr->field_nin();
91  int NvolF = m_fopr->field_nvol();
92  int NexF = m_fopr->field_nex();
93  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
94 
95  Field v1(NinF, NvolF, NexF);
96 
97  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
98 
100  m_fopr->set_mode("DdagD");
101 
102  int Nconv;
103  double diff;
104  m_solver->solve(v1, m_psf, Nconv, diff);
105 
106  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
107 
108  double H_psf = v1 * m_psf;
109 
110  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
111  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
112 
113  return H_psf;
114 }
115 
116 
117 //====================================================================
119 {
120  if (m_status_linkv == 0) {
121  int Nin = m_U->nin();
122  int Nvol = m_U->nvol();
123  int Nex = m_U->nex();
124  int Nc = CommonParameters::Nc();
125  int Ndim = CommonParameters::Ndim();
126 
127  int NinF = m_fopr->field_nin();
128  int NvolF = m_fopr->field_nvol();
129  int NexF = m_fopr->field_nex();
130  Field eta(NinF, NvolF, NexF);
131 
132  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
133 
134  //- fermion inversion for smeared gauge field
136  m_fopr->set_mode("DdagD");
137 
138  int Nconv;
139  double diff;
140  m_solver->solve(eta, m_psf, Nconv, diff);
141 
142  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
143 
144  //- force of smeared fermion operator
146 
147  Field force(Nin, Nvol, Nex);
148  Field force1(Nin, Nvol, Nex);
149 
150  force = m_fopr_force->force_core(eta);
151 
152  m_force = force;
153  ++m_status_linkv;
154 
155  double Fave, Fmax, Fdev;
156  m_force.stat(Fave, Fmax, Fdev);
157  vout.general(m_vl, " Fstandard_ave = %12.6f Fstandard_max = %12.6f Fstandard_dev = %12.6f\n",
158  Fave, Fmax, Fdev);
159 
160  return m_force;
161  } else {
162  vout.general(m_vl, " %s returns previous force.\n", class_name.c_str());
163  return m_force;
164  }
165 }
166 
167 
168 //====================================================================
169 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:207
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
static const std::string class_name
int nvol() const
Definition: field.h:101
double langevin(RandomNumbers *)
Langevis step.
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_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: action.h:46
virtual void set_parameters(const Parameters &params)=0
int nin() const
Definition: field.h:100
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
const Field force()
returns force for molcular dynamical update of conjugate momenta.
virtual void force_core(Field &, const Field &)
Definition: force.cpp:58
Bridge::VerboseLevel get_VerboseLevel() const
Definition: parameters.cpp:116
Bridge::VerboseLevel m_vl
Definition: action.h:64
Base class of random number generators.
Definition: randomNumbers.h:40
Bridge::VerboseLevel vl
Definition: checker.cpp:18
VerboseLevel
Definition: bridgeIO.h:25
virtual void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr.h:75
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
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
double calcH()
calculate Hamiltonian of this action term.
static int NPE()