Bridge++  Ver. 2.0.2
action_F_Ratio_lex.cpp
Go to the documentation of this file.
1 
14 #include "action_F_Ratio_lex.h"
15 
16 const std::string Action_F_Ratio_lex::class_name = "Action_F_Ratio_lex";
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 
41 
42 //====================================================================
44 {
45  m_U = U;
46 
49 
50  m_fopr->set_config(U);
52 }
53 
54 
55 //====================================================================
57 {
58  const int Nvol = CommonParameters::Nvol();
59  const int Ndim = CommonParameters::Ndim();
60 
61  const int NinF = m_fopr_prec->field_nin();
62  const int NvolF = m_fopr_prec->field_nvol();
63  const int NexF = m_fopr_prec->field_nex();
64  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
65 
66  assert(NvolF == Nvol);
67  m_psf.reset(NinF, NvolF, NexF);
68 
69  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
70 
71  Field xi(NinF, NvolF, NexF);
72  rand->gauss_lex_global(xi);
73 
76 
77  Field v2(NinF, NvolF, NexF);
78  m_fopr->set_mode("H");
79  m_fopr->mult_dag(v2, xi);
80 
81  Field v1(NinF, NvolF, NexF);
82  int Nconv;
83  double diff;
85  m_fprop_H_prec->invert_DdagD(v1, v2, Nconv, diff);
86  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
87 
88  m_fopr_prec->set_mode("H");
89  m_fopr_prec->mult(m_psf, v1);
90 
91  const double H_psf = xi.norm2();
92 
93  vout.general(m_vl, " H_Fratio = %18.8f\n", H_psf);
94  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
95 
96  return H_psf;
97 }
98 
99 
100 //====================================================================
102 {
103  const int Nvol = CommonParameters::Nvol();
104  const int Ndim = CommonParameters::Ndim();
105 
106  const int NinF = m_fopr_prec->field_nin();
107  const int NvolF = m_fopr_prec->field_nvol();
108  const int NexF = m_fopr_prec->field_nex();
109  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
110 
111  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
112 
115 
116  Field v1(NinF, NvolF, NexF);
117  m_fopr_prec->set_mode("H");
118  m_fopr_prec->mult_dag(v1, m_psf);
119 
120  Field v2(NinF, NvolF, NexF);
121  int Nconv;
122  double diff;
124  m_fprop_H->invert_DdagD(v2, v1, Nconv, diff);
125  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
126 
127  const double H_psf = dot(v1, v2);
128 
129  vout.general(m_vl, " H_Fratio = %18.8f\n", H_psf);
130  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
131 
132  return H_psf;
133 }
134 
135 
136 //====================================================================
138 {
139  const int Nin = m_U->nin();
140  const int Nvol = m_U->nvol();
141  const int Nex = m_U->nex();
142  const int Nc = CommonParameters::Nc();
143  const int Ndim = CommonParameters::Ndim();
144 
145  assert(force.nin() == Nin);
146  assert(force.nvol() == Nvol);
147  assert(force.nex() == Nex);
148 
149  const int NinF = m_fopr_prec->field_nin();
150  const int NvolF = m_fopr_prec->field_nvol();
151  const int NexF = m_fopr_prec->field_nex();
152 
153  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
154 
159 
160  Field v1(NinF, NvolF, NexF);
161  m_fopr_prec->set_mode("H");
162  m_fopr_prec->mult_dag(v1, m_psf);
163 
164  Field v2(NinF, NvolF, NexF);
165  int Nconv;
166  double diff;
168  m_fprop_MD->invert_DdagD(v2, v1, Nconv, diff);
169  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
170 
172 
173  Field force_tmp(Nin, Nvol, Nex);
174  m_fopr_prec_force->set_mode("Hdag");
175  m_fopr_prec_force->force_core1(force_tmp, v2, m_psf);
176  axpy(force, -1.0, force_tmp);
177 
179  m_fopr_prec_force->force_core1(force_tmp, m_psf, v2);
180  axpy(force, -1.0, force_tmp);
181 
182  double Fave, Fmax, Fdev;
183  force.stat(Fave, Fmax, Fdev);
184  vout.general(m_vl, " Fratio_ave = %12.6f Fratio_max = %12.6f Fratio_dev = %12.6f\n",
185  Fave, Fmax, Fdev);
186  vout.paranoiac(m_vl, " Fratio::force end\n");
187 }
188 
189 
190 //====================================================================
191 //============================================================END=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Action_F_Ratio_lex::langevin
double langevin(RandomNumbers *)
Langevis step.
Definition: action_F_Ratio_lex.cpp:56
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
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
Force::force_core1
virtual void force_core1(Field &, const Field &, const Field &)
Definition: force_F.cpp:34
Action_F_Ratio_lex::m_fopr_prec_force
Force * m_fopr_prec_force
Definition: action_F_Ratio_lex.h:53
Action_F_Ratio_lex::set_config
void set_config(Field *U)
setting pointer to the gauge configuration.
Definition: action_F_Ratio_lex.cpp:43
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
Force::set_config
virtual void set_config(Field *)=0
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
action_F_Ratio_lex.h
Fprop::set_config
virtual void set_config(Field *)=0
Action_F_Ratio_lex::m_fopr_force
Force * m_fopr_force
Definition: action_F_Ratio_lex.h:55
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
dot
double dot(const Field &y, const Field &x)
Definition: field.cpp:576
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
Bridge::BridgeIO::paranoiac
void paranoiac(const char *format,...)
Definition: bridgeIO.cpp:238
AFopr::set_config
virtual void set_config(Field *)=0
sets the gauge configuration.
Field::norm2
double norm2() const
Definition: field.cpp:113
AFopr::mult_dag
virtual void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr.h:102
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Action_F_Ratio_lex::set_parameters
void set_parameters()
Definition: action_F_Ratio_lex.cpp:36
Action_F_Ratio_lex::calcH
double calcH()
calculate Hamiltonian of this action term.
Definition: action_F_Ratio_lex.cpp:101
AFopr::field_nvol
virtual int field_nvol()=0
returns the volume of the fermion field.
Force::set_mode
virtual void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
Definition: force_F.h:51
Action_F_Ratio_lex::force
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.
Definition: action_F_Ratio_lex.cpp:137
Action_F_Ratio_lex::class_name
static const std::string class_name
Definition: action_F_Ratio_lex.h:45
Action_F_Ratio_lex::m_fopr
Fopr * m_fopr
Definition: action_F_Ratio_lex.h:54
Force::force_core
virtual void force_core(Field &, const Field &)
Definition: force_F.cpp:18
Field::nvol
int nvol() const
Definition: field.h:127
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
Action_F_Ratio_lex::m_fprop_MD
Fprop * m_fprop_MD
Definition: action_F_Ratio_lex.h:60
Fprop::invert_DdagD
virtual void invert_DdagD(Field &, const Field &, int &, double &)=0
Action_F_Ratio_lex::m_U
Field * m_U
Definition: action_F_Ratio_lex.h:50
Action_F_Ratio_lex::m_fopr_prec
Fopr * m_fopr_prec
Definition: action_F_Ratio_lex.h:52
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Action_F_Ratio_lex::m_vl
Bridge::VerboseLevel m_vl
Definition: action_F_Ratio_lex.h:48
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Action_F_Ratio_lex::m_label
std::string m_label
Definition: action_F_Ratio_lex.h:57
Action_F_Ratio_lex::m_psf
Field m_psf
Definition: action_F_Ratio_lex.h:56
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.
Action_F_Ratio_lex::m_fprop_H_prec
Fprop * m_fprop_H_prec
Definition: action_F_Ratio_lex.h:59
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Action_F_Ratio_lex::m_fprop_H
Fprop * m_fprop_H
Definition: action_F_Ratio_lex.h:61
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
Action_F_Ratio_lex::get_parameters
void get_parameters(Parameters &) const
Definition: action_F_Ratio_lex.cpp:29