Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Clover_Isochemical.cpp
Go to the documentation of this file.
1 
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Fopr_Clover_Isochemical::register_factory();
19 }
20 #endif
21 
22 const std::string Fopr_Clover_Isochemical::class_name = "Fopr_Clover_Isochemical";
23 
24 //====================================================================
26 {
27  const std::string str_vlevel = params.get_string("verbose_level");
28 
29  m_vl = vout.set_verbose_level(str_vlevel);
30 
31  //- fetch and check input parameters
32  double kappa, cSW, mu;
33  std::vector<int> bc;
34 
35  int err = 0;
36  err += params.fetch_double("hopping_parameter", kappa);
37  err += params.fetch_double("clover_coefficient", cSW);
38  err += params.fetch_double("isospin_chemical_potential", mu);
39  err += params.fetch_int_vector("boundary_condition", bc);
40 
41  if (err) {
42  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
43  exit(EXIT_FAILURE);
44  }
45 
46 
47  set_parameters(kappa, cSW, mu, bc);
48 }
49 
50 
51 //====================================================================
52 void Fopr_Clover_Isochemical::set_parameters(const double kappa, const double cSW, const double mu,
53  const std::vector<int> bc)
54 {
55  //- print input parameters
56  vout.general(m_vl, "%s:\n", class_name.c_str());
57  vout.general(m_vl, " kappa = %12.8f\n", kappa);
58  vout.general(m_vl, " cSW = %12.8f\n", cSW);
59  vout.general(m_vl, " mu = %12.8f\n", mu);
60  for (int dir = 0; dir < m_Ndim; ++dir) {
61  vout.general(m_vl, " boundary[%d] = %2d\n", dir, bc[dir]);
62  }
63 
64  //- range check
65  // NB. kappa,cSW,mu == 0 is allowed.
66  assert(bc.size() == m_Ndim);
67 
68  //- store values
69  m_kappa = kappa;
70  m_cSW = cSW;
71  m_mu = mu;
72 
73  // m_boundary.resize(m_Ndim); // NB. already resized in init.
74  m_boundary = bc;
75 
76  //- propagate parameters
79 }
80 
81 
82 //====================================================================
83 void Fopr_Clover_Isochemical::init(const std::string repr)
84 {
89  m_NinF = 2 * m_Nc * m_Nd;
90 
91  m_boundary.resize(m_Ndim);
92 
93  m_U = 0;
94 
95  m_repr = repr;
96 
98  m_fopr_csw = new Fopr_CloverTerm(repr);
99 
100  m_w1.reset(m_NinF, m_Nvol, 1);
101  m_w2.reset(m_NinF, m_Nvol, 1);
102 }
103 
104 
105 //====================================================================
107 {
108  delete m_fopr_w;
109  delete m_fopr_csw;
110 }
111 
112 
113 //====================================================================
115 {
116  m_U = (Field_G *)U;
117 
118  m_fopr_w->set_config(U);
120 }
121 
122 
123 //====================================================================
125 {
126  assert(f.nex() == 1);
127 
128  m_fopr_w->D(w, f);
130  axpy(w, -1.0, m_w1); // w -= m_w1;
131 
132 #pragma omp barrier
133 }
134 
135 
136 //====================================================================
138 {
139  assert(f.nex() == 1);
140 
141  m_fopr_w->Ddag(w, f);
143  axpy(w, -1.0, m_w1); // w -= m_w1;
144 
145 #pragma omp barrier
146 }
147 
148 
149 //====================================================================
151 {
152  assert(f.nex() == 1);
153 
154  D(m_w2, f);
155  Ddag(w, m_w2);
156 }
157 
158 
159 //====================================================================
161 {
162  assert(f.nex() == 1);
163 
164  D(m_w2, f);
165  mult_gm5(w, m_w2);
166 }
167 
168 
169 //====================================================================
171 {
172  assert(f.nex() == 1);
173 
174  mult_gm5(m_w2, f);
175  Ddag(w, m_w2);
176 }
177 
178 
179 //====================================================================
181  const int mu, const int nu)
182 {
183  m_fopr_csw->mult_isigma(v, w, mu, nu);
184 }
185 
186 
187 //====================================================================
189 {
190  //- Counting of floating point operations in giga unit.
191  // not implemented, yet.
192 
193  const double gflop = 0.0;
194 
195  return gflop;
196 }
197 
198 
199 //====================================================================
200 //============================================================END=====
void set_config(Field *U)
setting pointer to the gauge configuration.
const Field_G * m_U
gauge configuration (pointer)
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_config(Field *U)
setting pointer to the gauge configuration.
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
Fopr_CloverTerm * m_fopr_csw
Clover term operator.
void set_parameters(const Parameters &params)
void general(const char *format,...)
Definition: bridgeIO.cpp:197
double m_cSW
clover coefficient
void set_config(Field *U)
setting pointer to the gauge configuration.
Org::Fopr_CloverTerm Fopr_CloverTerm
Clover term operator.
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double m_mu
isospin chemical potential
double flop_count()
this returns the number of floating point operations.
void mult_sigmaF(Field &, const Field &)
Class for parameters.
Definition: parameters.h:46
void Ddag(Field &, const Field &)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_gm5(Field &v, const Field &w)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
double m_kappa
hopping parameter
Fopr_Wilson_Isochemical * m_fopr_w
Wilson fermion kernel.
SU(N) gauge field.
Definition: field_G.h:38
void D(Field &, const Field &)
Wilson fermion operator with isospin chemical potential.
Bridge::VerboseLevel m_vl
Definition: fopr.h:127
void DdagD(Field &, const Field &)
static const std::string class_name
void Hdag(Field &, const Field &)
void set_parameters(const Parameters &params)
std::vector< int > m_boundary
boundary conditions
int nex() const
Definition: field.h:128
void set_parameters(const Parameters &params)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void init(const std::string repr)
void Ddag(Field &, const Field &)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
int m_NinF
internal parameters
void D(Field &, const Field &)
void H(Field &, const Field &)
std::string m_repr
gamma matrix representation
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)