Bridge++  Ver. 1.2.x
 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_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using std::valarray;
21 using std::string;
22 
23 //- parameter entries
24 namespace {
25  void append_entry(Parameters& param)
26  {
27  param.Register_string("gamma_matrix_type", "NULL");
28  param.Register_double("hopping_parameter", 0.0);
29  param.Register_double("clover_coefficient", 0.0);
30  param.Register_double("isospin_chemical_potential", 0.0);
31  param.Register_int_vector("boundary_condition", std::valarray<int>());
32 
33  param.Register_string("verbose_level", "NULL");
34  }
35 
36 
37 #ifdef USE_PARAMETERS_FACTORY
38  bool init_param = ParametersFactory::Register("Fopr.Clover_Isochemical", append_entry);
39 #endif
40 }
41 //- end
42 
43 //- parameters class
45 //- end
46 
47 const std::string Fopr_Clover_Isochemical::class_name = "Fopr_Clover_Isochemical";
48 
49 //====================================================================
51 {
52  const string str_vlevel = params.get_string("verbose_level");
53 
54  m_vl = vout.set_verbose_level(str_vlevel);
55 
56  //- fetch and check input parameters
57  double kappa, cSW, mu;
58  valarray<int> bc;
59 
60  int err = 0;
61  err += params.fetch_double("hopping_parameter", kappa);
62  err += params.fetch_double("clover_coefficient", cSW);
63  err += params.fetch_double("isospin_chemical_potential", mu);
64  err += params.fetch_int_vector("boundary_condition", bc);
65 
66  if (err) {
67  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
68  abort();
69  }
70 
71 
72  set_parameters(kappa, cSW, mu, bc);
73 }
74 
75 
76 //====================================================================
77 void Fopr_Clover_Isochemical::set_parameters(double kappa, double cSW, double mu,
78  valarray<int> bc)
79 {
80  //- print input parameters
81  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
82  vout.general(m_vl, " kappa = %8.4f\n", kappa);
83  vout.general(m_vl, " cSW = %8.4f\n", cSW);
84  vout.general(m_vl, " mu = %8.4f\n", mu);
85  for (int dir = 0; dir < m_Ndim; ++dir) {
86  vout.general(m_vl, " boundary[%d] = %2d\n", dir, bc[dir]);
87  }
88 
89  //- range check
90  // NB. kappa,cSW,mu == 0 is allowed.
91  assert(bc.size() == m_Ndim);
92 
93  //- store values
94  m_kappa = kappa;
95  m_cSW = cSW;
96  m_mu = mu;
97 
98  for (int dir = 0; dir < m_Ndim; ++dir) {
99  m_boundary[dir] = bc[dir];
100  }
101 
102  //- propagate parameters
105 }
106 
107 
108 //====================================================================
110 {
112  m_Ndim = CommonParameters::Ndim();
115  m_NinF = 2 * m_Nc * m_Nd;
116 
117  m_boundary.resize(m_Ndim);
118 
119  m_U = 0;
120 
121  m_repr = repr;
122 
123  m_fopr_w = new Fopr_Wilson_Isochemical(repr);
124  m_fopr_csw = new Fopr_CloverTerm(repr);
125 
126  m_w1.reset(m_NinF, m_Nvol, 1);
127  m_w2.reset(m_NinF, m_Nvol, 1);
128 }
129 
130 
131 //====================================================================
133 {
134  delete m_fopr_w;
135  delete m_fopr_csw;
136 }
137 
138 
139 //====================================================================
141 {
142  m_U = (Field_G *)U;
143 
144  m_fopr_w->set_config(U);
146 }
147 
148 
149 //====================================================================
151 {
152  assert(f.nex() == 1);
153  // Field w2(f.nin(), f.nvol(), 1);
154 
155  m_fopr_w->D(w, f);
157  axpy(w, -1.0, m_w1); // w -= m_w1;
158 }
159 
160 
161 //====================================================================
163 {
164  assert(f.nex() == 1);
165  // Field w2(f.nin(), f.nvol(), 1);
166 
167  m_fopr_w->Ddag(w, f);
169  axpy(w, -1.0, m_w1); // w -= m_w1;
170 }
171 
172 
173 //====================================================================
175 {
176  assert(f.nex() == 1);
177  // Field w2(f.nin(), f.nvol(), 1);
178 
179  D(m_w2, f);
180  Ddag(w, m_w2);
181 }
182 
183 
184 //====================================================================
186 {
187  assert(f.nex() == 1);
188  // Field w2(f.nin(), f.nvol(), 1);
189 
190  D(m_w2, f);
191  mult_gm5(w, m_w2);
192 }
193 
194 
195 //====================================================================
197 {
198  assert(f.nex() == 1);
199  // Field w2(f.nin(), f.nvol(), 1);
200 
201  mult_gm5(m_w2, f);
202  Ddag(w, m_w2);
203 }
204 
205 
206 //====================================================================
208  const int mu, const int nu)
209 {
210  m_fopr_csw->mult_isigma(v, w, mu, nu);
211 }
212 
213 
214 //====================================================================
215 //============================================================END=====
void set_config(Field *U)
setting pointer to the gauge configuration.
void set_config(Field *U)
setting pointer to the gauge configuration.
const Field_G * m_U
gauge configuration (pointer)
BridgeIO vout
Definition: bridgeIO.cpp:207
void set_config(Field *U)
setting pointer to the gauge configuration.
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
Fopr_CloverTerm * m_fopr_csw
Clover term operator.
void mult_sigmaF(Field &, const Field &)
void general(const char *format,...)
Definition: bridgeIO.cpp:38
double m_cSW
clover coefficient
Container of Field-type object.
Definition: field.h:37
void set_parameters(const Parameters &params)
double m_mu
isospin chemical potential
Class for parameters.
Definition: parameters.h:40
std::valarray< int > m_boundary
boundary conditions
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
void Ddag(Field &, const Field &)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_gm5(Field &v, const Field &w)
double m_kappa
hopping parameter
Fopr_Wilson_Isochemical * m_fopr_w
Wilson fermion kernel.
SU(N) gauge field.
Definition: field_G.h:36
void D(Field &, const Field &)
Bridge::VerboseLevel m_vl
Definition: fopr.h:99
void DdagD(Field &, const Field &)
static const std::string class_name
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:82
void Hdag(Field &, const Field &)
void set_parameters(const Parameters &params)
int nex() const
Definition: field.h:102
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:193
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
int m_NinF
internal parameters
void D(Field &, const Field &)
void H(Field &, const Field &)
static bool Register(const std::string &realm, const creator_callback &cb)
std::string m_repr
gamma matrix representation
void Register_double(const string &, const double)
Definition: parameters.cpp:324
void Register_int_vector(const string &, const std::valarray< int > &)
Definition: parameters.cpp:345
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)