Bridge++  Ver. 1.2.x
 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 {
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 = 20000;
40  double Stop_cond = 1.0e-24;
41 
42 
43  string str_solver_type = "CG";
44  m_solver = Solver::New(str_solver_type, m_fopr);
45  m_solver->set_parameters(Niter, Stop_cond);
46 
47  // link variable update flag
48  m_status_linkv = 0;
49 }
50 
51 
52 //====================================================================
54 {
55  int Nvol = CommonParameters::Nvol();
56  int Ndim = CommonParameters::Ndim();
57 
58  int NinF = m_fopr->field_nin();
59  int NvolF = m_fopr->field_nvol();
60  int NexF = m_fopr->field_nex();
61  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
62 
63  assert(NvolF == Nvol);
64  m_psf.reset(NinF, NvolF, NexF);
65 
66  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
67 
68  Field xi(NinF, NvolF, NexF);
69  rand->gauss_lex_global(xi);
70 
72  m_fopr->set_mode("Ddag");
73  m_psf = m_fopr->mult(xi);
74 
75  // set_boundary_zero(xi);
76  Field_F_SF setzero;
77  setzero.set_boundary_zero(xi);
78  double xi2 = xi.norm();
79  double H_psf = xi2 * xi2;
80 
81  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
82  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
83 
84  return H_psf;
85 }
86 
87 
88 //====================================================================
90 {
91  int Nvol = CommonParameters::Nvol();
92  int Ndim = CommonParameters::Ndim();
93 
94  int NinF = m_fopr->field_nin();
95  int NvolF = m_fopr->field_nvol();
96  int NexF = m_fopr->field_nex();
97  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
98 
99  Field v1(NinF, NvolF, NexF);
100 
101  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
102 
104  m_fopr->set_mode("DdagD");
105 
106  int Nconv;
107  double diff;
108  m_solver->solve(v1, m_psf, Nconv, diff);
109 
110  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
111 
112  Field_F_SF setzero;
113  setzero.set_boundary_zero(v1);
114  setzero.set_boundary_zero(m_psf);
115 
116  double H_psf = v1 * m_psf;
117 
118  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
119  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
120 
121  return H_psf;
122 }
123 
124 
125 //====================================================================
127 {
128  if (m_status_linkv == 0) {
129  int Nin = m_U->nin();
130  int Nvol = m_U->nvol();
131  int Nex = m_U->nex();
132  int Nc = CommonParameters::Nc();
133  int Ndim = CommonParameters::Ndim();
134 
135  int NinF = m_fopr->field_nin();
136  int NvolF = m_fopr->field_nvol();
137  int NexF = m_fopr->field_nex();
138  Field eta(NinF, NvolF, NexF);
139 
140  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
141 
142  //- fermion inversion for smeared gauge field
144  m_fopr->set_mode("DdagD");
145 
146  int Nconv;
147  double diff;
148  m_solver->solve(eta, m_psf, Nconv, diff);
149 
150  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
151 
152  //- force of smeared fermion operator
154 
155  Field force(Nin, Nvol, Nex);
156  force = m_fopr_force->force_core(eta);
157 
158  Field_G_SF Fboundary(force);
159  Fboundary.set_boundary_spatial_link_zero();
160  m_force = (Field)Fboundary;
161 
162  ++m_status_linkv;
163 
164  double Fave, Fmax, Fdev;
165  m_force.stat(Fave, Fmax, Fdev);
166  vout.general(m_vl, " Fstandard_ave = %12.6f Fstandard_max = %12.6f Fstandard_dev = %12.6f\n",
167  Fave, Fmax, Fdev);
168 
169  return m_force;
170  } else {
171  vout.general(m_vl, " %s returns previous force.\n", class_name.c_str());
172  return m_force;
173  }
174 }
175 
176 
177 //====================================================================
178 
183 /*
184 void Action_F_Standard_SF::set_boundary_zero(Field& f){
185  if(comm->ipe(3)==0){
186  for(int site = 0; site < Svol; ++site){
187  for(int s = 0; s < m_Nd; ++s){
188  for(int cc = 0; cc < m_Nc2; ++cc){
189  f.set(cc+m_Nc2*s, site, 0, 0.0);
190  }
191  }
192  }
193  }
194 }
195 */
196 
197 //====================================================================
198 //============================================================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.
static const std::string class_name
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_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 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:82
double norm() const
Definition: field.h:210
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:102
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
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: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
const Field force()
returns force for molcular dynamical update of conjugate momenta.
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()