Bridge++  Ver. 1.3.x
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 {
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  int Niter = 20000;
38  double Stop_cond = 1.0e-24;
39 
40 
41  string str_solver_type = "CG";
42  m_solver = Solver::New(str_solver_type, m_fopr);
43  m_solver->set_parameters(Niter, Stop_cond);
44 }
45 
46 
47 //====================================================================
49 {
50  int Nvol = CommonParameters::Nvol();
51  int Ndim = CommonParameters::Ndim();
52 
53  int NinF = m_fopr->field_nin();
54  int NvolF = m_fopr->field_nvol();
55  int NexF = m_fopr->field_nex();
56  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
57 
58  assert(NvolF == Nvol);
59  m_psf.reset(NinF, NvolF, NexF);
60 
61  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
62 
63  Field xi(NinF, NvolF, NexF);
64  rand->gauss_lex_global(xi);
65 
67  m_fopr->set_mode("Ddag");
68  m_fopr->mult(m_psf, xi);
69 
70  // set_boundary_zero(xi);
71  Field_F_SF setzero;
72  setzero.set_boundary_zero(xi);
73  double xi2 = xi.norm();
74  double H_psf = xi2 * xi2;
75 
76  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
77  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
78 
79  return H_psf;
80 }
81 
82 
83 //====================================================================
85 {
86  int Nvol = CommonParameters::Nvol();
87  int Ndim = CommonParameters::Ndim();
88 
89  int NinF = m_fopr->field_nin();
90  int NvolF = m_fopr->field_nvol();
91  int NexF = m_fopr->field_nex();
92  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
93 
94  Field v1(NinF, NvolF, NexF);
95 
96  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
97 
99  m_fopr->set_mode("DdagD");
100 
101  int Nconv;
102  double diff;
103  m_solver->solve(v1, m_psf, Nconv, diff);
104 
105  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
106 
107  Field_F_SF setzero;
108  setzero.set_boundary_zero(v1);
109  setzero.set_boundary_zero(m_psf);
110 
111  double H_psf = dot(v1, m_psf);
112 
113  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
114  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
115 
116  return H_psf;
117 }
118 
119 
120 //====================================================================
122 {
123  int Nin = m_U->nin();
124  int Nvol = m_U->nvol();
125  int Nex = m_U->nex();
126  int Nc = CommonParameters::Nc();
127  int Ndim = CommonParameters::Ndim();
128 
129  assert(force.nin() == Nin);
130  assert(force.nvol() == Nvol);
131  assert(force.nex() == Nex);
132 
133  int NinF = m_fopr->field_nin();
134  int NvolF = m_fopr->field_nvol();
135  int NexF = m_fopr->field_nex();
136  Field eta(NinF, NvolF, NexF);
137 
138  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
139 
140  //- fermion inversion for smeared gauge field
142  m_fopr->set_mode("DdagD");
143 
144  int Nconv;
145  double diff;
146  m_solver->solve(eta, m_psf, Nconv, diff);
147 
148  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
149 
150  //- force of smeared fermion operator
152 
153  Field force_org(Nin, Nvol, Nex);
154  m_fopr_force->force_core(force_org, eta);
155 
156  Field_G_SF Fboundary(force_org);
157  Fboundary.set_boundary_spatial_link_zero();
158  force = (Field)Fboundary;
159 
160  double Fave, Fmax, Fdev;
161  force.stat(Fave, Fmax, Fdev);
162  vout.general(m_vl, " Fstandard_ave = %12.6f Fstandard_max = %12.6f Fstandard_dev = %12.6f\n",
163  Fave, Fmax, Fdev);
164 }
165 
166 
167 //====================================================================
168 
173 /*
174 void Action_F_Standard_SF::set_boundary_zero(Field& f){
175  if(comm->ipe(3)==0){
176  for(int site = 0; site < Svol; ++site){
177  for(int s = 0; s < m_Nd; ++s){
178  for(int cc = 0; cc < m_Nc2; ++cc){
179  f.set(cc+m_Nc2*s, site, 0, 0.0);
180  }
181  }
182  }
183  }
184 }
185 */
186 
187 //====================================================================
188 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:278
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:65
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:39
virtual void set_config(Field *)=0
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:38
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:59
virtual void set_parameters(const Parameters &params)=0
int nin() const
Definition: field.h:115
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:125
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
double norm() const
Definition: field.h:240
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:117
virtual void force_core(Field &, const Field &)
Definition: force.cpp:19
Bridge::VerboseLevel get_VerboseLevel() const
Definition: parameters.cpp:117
Bridge::VerboseLevel m_vl
Definition: action.h:81
Base class of random number generators.
Definition: randomNumbers.h:39
Bridge::VerboseLevel vl
Definition: checker.cpp:18
VerboseLevel
Definition: bridgeIO.h:39
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:56
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:85
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:516
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
static int NPE()