Bridge++  Ver. 2.0.2
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  std::string vlevel;
22  if (!params.fetch_string("verbose_level", vlevel)) {
23  m_vl = vout.set_verbose_level(vlevel);
24  }
25 }
26 
27 
28 //====================================================================
30 {
31  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
32 }
33 
34 
35 //====================================================================
37 {
38  vout.general(m_vl, "%s:\n", class_name.c_str());
39 
40  const int Niter = 100;
41  const int Nrestart = 40;
42  const double Stop_cond = 1.0e-24;
43  const std::string str_solver_type = "CG";
44 
45  m_solver = Solver::New(str_solver_type, m_fopr);
46  m_solver->set_parameters(Niter, Nrestart, Stop_cond);
47 }
48 
49 
50 //====================================================================
52 {
53  const int Nvol = CommonParameters::Nvol();
54  const int Ndim = CommonParameters::Ndim();
55 
56  const int NinF = m_fopr->field_nin();
57  const int NvolF = m_fopr->field_nvol();
58  const int NexF = m_fopr->field_nex();
59  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
60 
61  assert(NvolF == Nvol);
62  m_psf.reset(NinF, NvolF, NexF);
63 
64  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
65 
66  Field xi(NinF, NvolF, NexF);
67  rand->gauss_lex_global(xi);
68 
70  m_fopr->set_mode("Ddag");
71  m_fopr->mult(m_psf, xi);
72 
73  // set_boundary_zero(xi);
75 
76  const double xi2 = xi.norm();
77  const double H_psf = xi2 * xi2;
78 
79  vout.general(m_vl, " H_Fstandard = %18.8f\n", H_psf);
80  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
81 
82  return H_psf;
83 }
84 
85 
86 //====================================================================
88 {
89  const int Nvol = CommonParameters::Nvol();
90  const int Ndim = CommonParameters::Ndim();
91 
92  const int NinF = m_fopr->field_nin();
93  const int NvolF = m_fopr->field_nvol();
94  const int NexF = m_fopr->field_nex();
95  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
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  Field v1(NinF, NvolF, NexF);
103  int Nconv;
104  double diff;
105  m_solver->solve(v1, m_psf, Nconv, diff);
106 
107  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
108 
111 
112  const 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  const int Nin = m_U->nin();
125  const int Nvol = m_U->nvol();
126  const int Nex = m_U->nex();
127  const int Nc = CommonParameters::Nc();
128  const int Ndim = CommonParameters::Ndim();
129 
130  assert(force.nin() == Nin);
131  assert(force.nvol() == Nvol);
132  assert(force.nex() == Nex);
133 
134  const int NinF = m_fopr->field_nin();
135  const int NvolF = m_fopr->field_nvol();
136  const int NexF = m_fopr->field_nex();
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  Field eta(NinF, NvolF, NexF);
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 Fboundary(force_org);
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=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Action_F_Standard_SF::m_solver
Solver * m_solver
Definition: action_F_Standard_SF.h:66
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Action_F_Standard_SF::class_name
static const std::string class_name
Definition: action_F_Standard_SF.h:56
AFopr::mult
virtual void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr.h:95
Parameters
Class for parameters.
Definition: parameters.h:46
Action_F_Standard_SF::m_psf
Field m_psf
Definition: action_F_Standard_SF.h:63
AFopr::field_nex
virtual int field_nex()=0
returns the external degree of freedom of the fermion field.
Field::nex
int nex() const
Definition: field.h:128
RandomNumbers
Base class of random number generators.
Definition: randomNumbers.h:43
Solver::set_parameters
virtual void set_parameters(const Parameters &params)=0
Force::set_config
virtual void set_config(Field *)=0
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Action_F_Standard_SF::get_parameters
void get_parameters(Parameters &) const
Definition: action_F_Standard_SF.cpp:29
dot
double dot(const Field &y, const Field &x)
Definition: field.cpp:576
action_F_Standard_SF.h
AFopr::set_mode
virtual void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr.h:81
Field::nin
int nin() const
Definition: field.h:126
AFopr::set_config
virtual void set_config(Field *)=0
sets the gauge configuration.
Solver::solve
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
Field_SF::set_boundary_zero
void set_boundary_zero(Field_G &u)
Definition: field_SF.cpp:96
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
AFopr::field_nvol
virtual int field_nvol()=0
returns the volume of the fermion field.
Field::norm
double norm() const
Definition: field.h:226
Action_F_Standard_SF::set_parameters
void set_parameters()
Definition: action_F_Standard_SF.cpp:36
Action_F_Standard_SF::m_U
Field * m_U
Definition: action_F_Standard_SF.h:68
Force::force_core
virtual void force_core(Field &, const Field &)
Definition: force_F.cpp:18
Action_F_Standard_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: action_F_Standard_SF.h:59
Field::nvol
int nvol() const
Definition: field.h:127
Action_F_Standard_SF::m_fopr
Fopr * m_fopr
Definition: action_F_Standard_SF.h:61
CommonParameters::NPE
static int NPE()
Definition: commonParameters.h:101
Field::reset
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
Field_SF::set_boundary_spatial_link_zero
void set_boundary_spatial_link_zero(Field_G &u)
Definition: field_SF.cpp:151
Action_F_Standard_SF::langevin
double langevin(RandomNumbers *)
Langevis step.
Definition: action_F_Standard_SF.cpp:51
Action_F_Standard_SF::calcH
double calcH()
calculate Hamiltonian of this action term.
Definition: action_F_Standard_SF.cpp:87
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Action_F_Standard_SF::m_fopr_force
Force * m_fopr_force
Definition: action_F_Standard_SF.h:62
Field
Container of Field-type object.
Definition: field.h:46
RandomNumbers::gauss_lex_global
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
Definition: randomNumbers.cpp:95
AFopr::field_nin
virtual int field_nin()=0
returns the on-site degree of freedom of the fermion field.
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Action_F_Standard_SF::force
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.
Definition: action_F_Standard_SF.cpp:122
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Action_F_Standard_SF::m_label
std::string m_label
Definition: action_F_Standard_SF.h:64
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154