Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_F_Standard_SF.cpp
Go to the documentation of this file.
1 
14 #include "action_F_Standard_SF.h"
15 
16 const std::string Action_F_Standard_SF::class_name = "Action_F_Standard_SF";
17 
18 //====================================================================
20 {
21  const Bridge::VerboseLevel vl = params.get_VerboseLevel();
22 
24 }
25 
26 
27 //====================================================================
29 {
30  vout.general(m_vl, "%s:\n", class_name.c_str());
31 
32  const int Niter = 100;
33  const int Nrestart = 40;
34  const double Stop_cond = 1.0e-24;
35  const std::string str_solver_type = "CG";
36 
37  m_solver = Solver::New(str_solver_type, m_fopr);
38  m_solver->set_parameters(Niter, Nrestart, Stop_cond);
39 }
40 
41 
42 //====================================================================
44 {
45  const int Nvol = CommonParameters::Nvol();
46  const int Ndim = CommonParameters::Ndim();
47 
48  const int NinF = m_fopr->field_nin();
49  const int NvolF = m_fopr->field_nvol();
50  const int NexF = m_fopr->field_nex();
51  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
52 
53  assert(NvolF == Nvol);
54  m_psf.reset(NinF, NvolF, NexF);
55 
56  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
57 
58  Field xi(NinF, NvolF, NexF);
59  rand->gauss_lex_global(xi);
60 
62  m_fopr->set_mode("Ddag");
63  m_fopr->mult(m_psf, xi);
64 
65  // set_boundary_zero(xi);
66  Field_F_SF setzero;
67  setzero.set_boundary_zero(xi);
68 
69  const double xi2 = xi.norm();
70  const double H_psf = xi2 * xi2;
71 
72  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
73  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
74 
75  return H_psf;
76 }
77 
78 
79 //====================================================================
81 {
82  const int Nvol = CommonParameters::Nvol();
83  const int Ndim = CommonParameters::Ndim();
84 
85  const int NinF = m_fopr->field_nin();
86  const int NvolF = m_fopr->field_nvol();
87  const int NexF = m_fopr->field_nex();
88  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
89 
90  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
91 
93  m_fopr->set_mode("DdagD");
94 
95  Field v1(NinF, NvolF, NexF);
96  int Nconv;
97  double diff;
98  m_solver->solve(v1, m_psf, Nconv, diff);
99 
100  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
101 
102  Field_F_SF setzero;
103  setzero.set_boundary_zero(v1);
104  setzero.set_boundary_zero(m_psf);
105 
106  const double H_psf = dot(v1, m_psf);
107 
108  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
109  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
110 
111  return H_psf;
112 }
113 
114 
115 //====================================================================
117 {
118  const int Nin = m_U->nin();
119  const int Nvol = m_U->nvol();
120  const int Nex = m_U->nex();
121  const int Nc = CommonParameters::Nc();
122  const int Ndim = CommonParameters::Ndim();
123 
124  assert(force.nin() == Nin);
125  assert(force.nvol() == Nvol);
126  assert(force.nex() == Nex);
127 
128  const int NinF = m_fopr->field_nin();
129  const int NvolF = m_fopr->field_nvol();
130  const int NexF = m_fopr->field_nex();
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  Field eta(NinF, NvolF, NexF);
139  int Nconv;
140  double diff;
141  m_solver->solve(eta, m_psf, Nconv, diff);
142 
143  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
144 
145  //- force of smeared fermion operator
147 
148  Field force_org(Nin, Nvol, Nex);
149  m_fopr_force->force_core(force_org, eta);
150 
151  Field_G_SF Fboundary(force_org);
152  Fboundary.set_boundary_spatial_link_zero();
153  force = (Field)Fboundary;
154 
155  double Fave, Fmax, Fdev;
156  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 
161 
162 //====================================================================
163 
168 /*
169 void Action_F_Standard_SF::set_boundary_zero(Field& f){
170  if(comm->ipe(3)==0){
171  for(int site = 0; site < Svol; ++site){
172  for(int s = 0; s < m_Nd; ++s){
173  for(int cc = 0; cc < m_Nc2; ++cc){
174  f.set(cc+m_Nc2*s, site, 0, 0.0);
175  }
176  }
177  }
178  }
179 }
180 */
181 
182 //====================================================================
183 //============================================================END=====
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_G_SF.h:33
BridgeIO vout
Definition: bridgeIO.cpp:503
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.
double dot(const Field &y, const Field &x)
Definition: field.cpp:46
void general(const char *format,...)
Definition: bridgeIO.cpp:197
virtual void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr.h:94
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
static const std::string class_name
Container of Field-type object.
Definition: field.h:45
virtual void set_config(Field *)=0
int nvol() const
Definition: field.h:127
Class for parameters.
Definition: parameters.h:46
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:53
virtual void set_parameters(const Parameters &params)=0
int nin() const
Definition: field.h:126
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:102
double norm() const
Definition: field.h:222
double calcH()
calculate Hamiltonian of this action term.
virtual int field_nex()=0
returns the external d.o.f. for which the fermion operator is defined.
int nex() const
Definition: field.h:128
virtual void force_core(Field &, const Field &)
Definition: force_F.cpp:18
Bridge::VerboseLevel get_VerboseLevel() const
Definition: parameters.cpp:320
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
Bridge::VerboseLevel m_vl
Definition: action.h:75
Base class of random number generators.
Definition: randomNumbers.h:43
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
void set_boundary_zero(Field &f)
Definition: field_F_SF.h:53
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
double langevin(RandomNumbers *)
Langevis step.
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
A class generated to add a function for the SF.
Definition: field_F_SF.h:33