Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_Isochemical.cpp
Go to the documentation of this file.
1 
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Fopr_Wilson_Isochemical::register_factory();
19 }
20 #endif
21 
22 const std::string Fopr_Wilson_Isochemical::class_name = "Fopr_Wilson_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, mu;
33  std::vector<int> bc;
34 
35  int err = 0;
36  err += params.fetch_double("hopping_parameter", kappa);
37  err += params.fetch_double("isospin_chemical_potential", mu);
38  err += params.fetch_int_vector("boundary_condition", bc);
39 
40  if (err) {
41  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
42  exit(EXIT_FAILURE);
43  }
44 
45 
46  set_parameters(kappa, mu, bc);
47 }
48 
49 
50 //====================================================================
52  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, " mu = %12.8f\n", mu);
59  for (int dir = 0; dir < m_Ndim; ++dir) {
60  vout.general(m_vl, " boundary[%d] = %2d\n", dir, bc[dir]);
61  }
62 
63  //- range check
64  // NB. kappa,mu = 0 is allowed.
65  assert(bc.size() == m_Ndim);
66 
67  //- store values
68  m_kappa = kappa;
69  m_mu = mu;
70  m_exp_mu = exp(mu);
71 
72  m_boundary.resize(m_Ndim);
73  m_boundary = bc;
74 
75  //- propagate parameters
76  m_fopr_w->set_parameters(kappa, bc);
77 }
78 
79 
80 //====================================================================
81 void Fopr_Wilson_Isochemical::init(const std::string repr)
82 {
84 
85  const int Nc = CommonParameters::Nc();
86  const int Nd = CommonParameters::Nd();
87  const int NinF = 2 * Nc * Nd;
88  const int Nvol = CommonParameters::Nvol();
89 
90  m_boundary.resize(m_Ndim);
91  m_U = 0;
92 
93  m_fopr_w = new Fopr_Wilson(repr);
94 
95  m_vt.reset(NinF, Nvol, 1);
96  m_w2.reset(NinF, Nvol, 1);
97 }
98 
99 
100 //====================================================================
102 {
103  delete m_fopr_w;
104 }
105 
106 
107 //====================================================================
109 {
110  const int Nvol = field_nvol();
111  const int Nin = field_nin();
112  const int Nex = field_nex();
113 
114  Field v(Nin, Nvol, Nex);
115 
116  Dspc(w, f);
117 
118  v.set(0.0); // v = 0.0;
119  m_fopr_w->mult_up(3, v, f);
120  w.addpart_ex(0, v, 0, -m_kappa * m_exp_mu);
121 
122  v.set(0.0); // v = 0.0;
123  m_fopr_w->mult_dn(3, v, f);
124  w.addpart_ex(0, v, 0, -m_kappa / m_exp_mu);
125 
126 #pragma omp barrier
127 }
128 
129 
130 //====================================================================
132 {
133  const int Nvol = field_nvol();
134  const int Nin = field_nin();
135  const int Nex = field_nex();
136 
137  Field v(Nin, Nvol, Nex);
138 
139  Dspc(w, f);
140 
141  v.set(0.0); // v = 0.0;
142  m_fopr_w->mult_up(3, v, f);
143  w.addpart_ex(0, v, 0, -m_kappa / m_exp_mu);
144 
145  v.set(0.0); // v = 0.0;
146  m_fopr_w->mult_dn(3, v, f);
147  w.addpart_ex(0, v, 0, -m_kappa * m_exp_mu);
148 
149 #pragma omp barrier
150 }
151 
152 
153 //====================================================================
155 {
156  w.set(0.0); // w = 0.0;
157 
158  m_fopr_w->mult_up(0, w, f);
159  m_fopr_w->mult_dn(0, w, f);
160 
161  m_fopr_w->mult_up(1, w, f);
162  m_fopr_w->mult_dn(1, w, f);
163 
164  m_fopr_w->mult_up(2, w, f);
165  m_fopr_w->mult_dn(2, w, f);
166 
167  scal(w, -m_kappa); // w *= -m_kappa;
168  axpy(w, 1.0, f); // w += f;
169 
170 #pragma omp barrier
171 }
172 
173 
174 //====================================================================
176 {
177  m_fopr_w->mult_gm5(v, f);
178 }
179 
180 
181 //====================================================================
182 void Fopr_Wilson_Isochemical::mult_gm5p(const int mu, Field_F& v, const Field_F& w)
183 {
184  m_vt.set(0.0); // vt = 0.0;
185 
186  m_fopr_w->mult_up(mu, m_vt, (Field)w);
187  m_fopr_w->mult_gm5(v, m_vt);
188 }
189 
190 
191 //====================================================================
193 {
194  D(m_w2, f);
195  mult_gm5(w, m_w2);
196  Dminmu(m_w2, w);
197  mult_gm5(w, m_w2);
198 }
199 
200 
201 //====================================================================
203 {
204  mult_gm5(w, f);
205  Dminmu(m_w2, w);
206  mult_gm5(w, m_w2);
207 }
208 
209 
210 //====================================================================
212 {
213  D(m_w2, f);
214  mult_gm5(w, m_w2);
215 }
216 
217 
218 //====================================================================
220 {
221  Dminmu(m_w2, f);
222  mult_gm5(w, m_w2);
223 }
224 
225 
226 //====================================================================
228 {
229  //- Counting of floating point operations in giga unit.
230  // not implemented, yet.
231 
232  const double gflop = 0;
233 
234  return gflop;
235 }
236 
237 
238 //====================================================================
239 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
void Hdag(Field &, const Field &)
BridgeIO vout
Definition: bridgeIO.cpp:503
double m_kappa
hopping parameter
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void general(const char *format,...)
Definition: bridgeIO.cpp:197
void mult_gm5(Field &, const Field &)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
Container of Field-type object.
Definition: field.h:45
int field_nvol()
returns the volume for which the fermion operator is defined.
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double flop_count()
this returns the number of floating point operations.
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
Class for parameters.
Definition: parameters.h:46
void Ddag(Field &, const Field &)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
Wilson-type fermion field.
Definition: field_F.h:37
void mult_dn(const int mu, Field &w, const Field &f)
void set_parameters(const Parameters &params)
int field_nex()
returns the external d.o.f. for which the fermion operator is defined.
void D(Field &, const Field &)
Bridge::VerboseLevel m_vl
Definition: fopr.h:127
void set_parameters(const Parameters &params)
void Dminmu(Field &, const Field &)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void mult_up(const int mu, Field &w, const Field &f)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_gm5p(const int mu, Field_F &v, const Field_F &w)
double m_mu
isospin chemical potential
void H(Field &, const Field &)
Org::Fopr_Wilson Fopr_Wilson
Wilson fermion operator.
Definition: fopr_Wilson.h:60
void Dspc(Field &, const Field &)
void DdagD(Field &, const Field &)
void init(const std::string repr)
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 const std::string class_name
int field_nin()
returns the on-site d.o.f. for which the fermion operator is defined.
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131