Bridge++  Version 1.4.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 
17 
18 #ifdef USE_FACTORY
19 namespace {
20  Fopr *create_object()
21  {
22  return new Fopr_Clover_Isochemical();
23  }
24 
25 
26  Fopr *create_object_with_repr(const std::string& repr)
27  {
28  return new Fopr_Clover_Isochemical(repr);
29  }
30 
31 
32  bool init1 = Fopr::Factory_noarg::Register("Clover_Isochemical", create_object);
33  bool init2 = Fopr::Factory_string::Register("Clover_Isochemical", create_object_with_repr);
34 }
35 #endif
36 
37 
38 
39 const std::string Fopr_Clover_Isochemical::class_name = "Fopr_Clover_Isochemical";
40 
41 //====================================================================
43 {
44  const std::string str_vlevel = params.get_string("verbose_level");
45 
46  m_vl = vout.set_verbose_level(str_vlevel);
47 
48  //- fetch and check input parameters
49  double kappa, cSW, mu;
50  std::vector<int> bc;
51 
52  int err = 0;
53  err += params.fetch_double("hopping_parameter", kappa);
54  err += params.fetch_double("clover_coefficient", cSW);
55  err += params.fetch_double("isospin_chemical_potential", mu);
56  err += params.fetch_int_vector("boundary_condition", bc);
57 
58  if (err) {
59  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
60  exit(EXIT_FAILURE);
61  }
62 
63 
64  set_parameters(kappa, cSW, mu, bc);
65 }
66 
67 
68 //====================================================================
69 void Fopr_Clover_Isochemical::set_parameters(double kappa, double cSW, double mu,
70  std::vector<int> bc)
71 {
72  //- print input parameters
73  vout.general(m_vl, "%s:\n", class_name.c_str());
74  vout.general(m_vl, " kappa = %12.8f\n", kappa);
75  vout.general(m_vl, " cSW = %12.8f\n", cSW);
76  vout.general(m_vl, " mu = %12.8f\n", mu);
77  for (int dir = 0; dir < m_Ndim; ++dir) {
78  vout.general(m_vl, " boundary[%d] = %2d\n", dir, bc[dir]);
79  }
80 
81  //- range check
82  // NB. kappa,cSW,mu == 0 is allowed.
83  assert(bc.size() == m_Ndim);
84 
85  //- store values
86  m_kappa = kappa;
87  m_cSW = cSW;
88  m_mu = mu;
89 
90  for (int dir = 0; dir < m_Ndim; ++dir) {
91  m_boundary[dir] = bc[dir];
92  }
93 
94  //- propagate parameters
97 }
98 
99 
100 //====================================================================
101 void Fopr_Clover_Isochemical::init(std::string repr)
102 {
107  m_NinF = 2 * m_Nc * m_Nd;
108 
109  m_boundary.resize(m_Ndim);
110 
111  m_U = 0;
112 
113  m_repr = repr;
114 
115  m_fopr_w = new Fopr_Wilson_Isochemical(repr);
116  m_fopr_csw = new Fopr_CloverTerm(repr);
117 
118  m_w1.reset(m_NinF, m_Nvol, 1);
119  m_w2.reset(m_NinF, m_Nvol, 1);
120 }
121 
122 
123 //====================================================================
125 {
126  delete m_fopr_w;
127  delete m_fopr_csw;
128 }
129 
130 
131 //====================================================================
133 {
134  m_U = (Field_G *)U;
135 
136  m_fopr_w->set_config(U);
138 }
139 
140 
141 //====================================================================
143 {
144  assert(f.nex() == 1);
145 
146  m_fopr_w->D(w, f);
148  axpy(w, -1.0, m_w1); // w -= m_w1;
149 
150 #pragma omp barrier
151 }
152 
153 
154 //====================================================================
156 {
157  assert(f.nex() == 1);
158 
159  m_fopr_w->Ddag(w, f);
161  axpy(w, -1.0, m_w1); // w -= m_w1;
162 
163 #pragma omp barrier
164 }
165 
166 
167 //====================================================================
169 {
170  assert(f.nex() == 1);
171 
172  D(m_w2, f);
173  Ddag(w, m_w2);
174 }
175 
176 
177 //====================================================================
179 {
180  assert(f.nex() == 1);
181 
182  D(m_w2, f);
183  mult_gm5(w, m_w2);
184 }
185 
186 
187 //====================================================================
189 {
190  assert(f.nex() == 1);
191 
192  mult_gm5(m_w2, f);
193  Ddag(w, m_w2);
194 }
195 
196 
197 //====================================================================
199  const int mu, const int nu)
200 {
201  m_fopr_csw->mult_isigma(v, w, mu, nu);
202 }
203 
204 
205 //====================================================================
207 {
208  //- Counting of floating point operations.
209  // not implemented, yet.
210 
211  double flop = 0.0;
212 
213  return flop;
214 }
215 
216 
217 //====================================================================
218 //============================================================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:495
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:195
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:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
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.
Clover fermion operator with isospin chemical potential.
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:128
void DdagD(Field &, const Field &)
static const std::string class_name
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
void Hdag(Field &, const Field &)
void set_parameters(const Parameters &params)
std::vector< int > m_boundary
boundary conditions
int nex() const
Definition: field.h:117
void set_parameters(const Parameters &params)
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:168
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
Base class of fermion operator family.
Definition: fopr.h:47
string get_string(const string &key) const
Definition: parameters.cpp:116
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
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)