Bridge++  Version 1.4.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 {
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 = 100;
38  int Nrestart = 40;
39  double Stop_cond = 1.0e-24;
40 
41 
42  string str_solver_type = "CG";
43  m_solver = Solver::New(str_solver_type, m_fopr);
44  m_solver->set_parameters(Niter, Nrestart, Stop_cond);
45 }
46 
47 
48 //====================================================================
50 {
51  int Nvol = CommonParameters::Nvol();
52  int Ndim = CommonParameters::Ndim();
53 
54  int NinF = m_fopr->field_nin();
55  int NvolF = m_fopr->field_nvol();
56  int NexF = m_fopr->field_nex();
57  int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
58 
59  assert(NvolF == Nvol);
60  m_psf.reset(NinF, NvolF, NexF);
61 
62  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
63 
64  Field xi(NinF, NvolF, NexF);
65  rand->gauss_lex_global(xi);
66 
68  m_fopr->set_mode("Ddag");
69  m_fopr->mult(m_psf, xi);
70 
71  // set_boundary_zero(xi);
72  Field_F_SF setzero;
73  setzero.set_boundary_zero(xi);
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  Field_F_SF setzero;
109  setzero.set_boundary_zero(v1);
110  setzero.set_boundary_zero(m_psf);
111 
112  double H_psf = dot(v1, m_psf);
113 
114  vout.general(m_vl, " H_Fstandard = %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  int Nin = m_U->nin();
125  int Nvol = m_U->nvol();
126  int Nex = m_U->nex();
127  int Nc = CommonParameters::Nc();
128  int Ndim = CommonParameters::Ndim();
129 
130  assert(force.nin() == Nin);
131  assert(force.nvol() == Nvol);
132  assert(force.nex() == Nex);
133 
134  int NinF = m_fopr->field_nin();
135  int NvolF = m_fopr->field_nvol();
136  int NexF = m_fopr->field_nex();
137  Field eta(NinF, NvolF, NexF);
138 
139  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
140 
141  //- fermion inversion for smeared gauge field
143  m_fopr->set_mode("DdagD");
144 
145  int Nconv;
146  double diff;
147  m_solver->solve(eta, m_psf, Nconv, diff);
148 
149  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
150 
151  //- force of smeared fermion operator
153 
154  Field force_org(Nin, Nvol, Nex);
155  m_fopr_force->force_core(force_org, eta);
156 
157  Field_G_SF Fboundary(force_org);
158  Fboundary.set_boundary_spatial_link_zero();
159  force = (Field)Fboundary;
160 
161  double Fave, Fmax, Fdev;
162  force.stat(Fave, Fmax, Fdev);
163  vout.general(m_vl, " Fstandard_ave = %12.6f Fstandard_max = %12.6f Fstandard_dev = %12.6f\n",
164  Fave, Fmax, Fdev);
165 }
166 
167 
168 //====================================================================
169 
174 /*
175 void Action_F_Standard_SF::set_boundary_zero(Field& f){
176  if(comm->ipe(3)==0){
177  for(int site = 0; site < Svol; ++site){
178  for(int s = 0; s < m_Nd; ++s){
179  for(int cc = 0; cc < m_Nc2; ++cc){
180  f.set(cc+m_Nc2*s, site, 0, 0.0);
181  }
182  }
183  }
184  }
185 }
186 */
187 
188 //====================================================================
189 //============================================================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:495
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:195
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: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:115
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:104
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:211
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_F.cpp:18
Bridge::VerboseLevel get_VerboseLevel() const
Definition: parameters.cpp:204
Bridge::VerboseLevel m_vl
Definition: action.h:75
Base class of random number generators.
Definition: randomNumbers.h:36
Bridge::VerboseLevel vl
Definition: checker.cpp:18
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: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:96
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()