Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Clover_Nf2_Isochemical.cpp
Go to the documentation of this file.
1 
15 
16 const std::string Force_F_Clover_Nf2_Isochemical::class_name = "Force_F_Clover_Nf2_Isochemical";
17 
18 //====================================================================
20 {
21  const string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  double kappa, cSW, mu;
27  std::vector<int> bc;
28 
29  int err = 0;
30  err += params.fetch_double("hopping_parameter", kappa);
31  err += params.fetch_double("clover_coefficient", cSW);
32  err += params.fetch_double("isospin_chemical_potential", mu);
33  err += params.fetch_int_vector("boundary_condition", bc);
34 
35  if (err) {
36  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
37  exit(EXIT_FAILURE);
38  }
39 
40 
41  set_parameters(kappa, cSW, mu, bc);
42 }
43 
44 
45 //====================================================================
46 void Force_F_Clover_Nf2_Isochemical::set_parameters(const double kappa, const double cSW,
47  const double mu, const std::vector<int> bc)
48 {
49  const int Ndim = CommonParameters::Ndim();
50 
51  //- print input parameters
52  vout.general(m_vl, "%s:\n", class_name.c_str());
53  vout.general(m_vl, " kappa = %12.8f\n", kappa);
54  vout.general(m_vl, " cSW = %12.8f\n", cSW);
55  vout.general(m_vl, " mu = %12.8f\n", mu);
56  for (int i_dir = 0; i_dir < Ndim; ++i_dir) {
57  vout.general(m_vl, " boundary[%d] = %2d\n", i_dir, bc[i_dir]);
58  }
59 
60  //- range check
61  // NB. kappa,cSW,mu == 0 is allowed.
62  assert(bc.size() == Ndim);
63 
64  //- store values
65  m_kappa = kappa;
66  m_cSW = cSW;
67  m_mu = mu;
68 
69  m_boundary.resize(Ndim);
70  m_boundary = bc;
71 
72  //- propagate parameters
74 
77 }
78 
79 
80 //====================================================================
82 {
83  m_repr = repr;
84 
86 
90 
92 }
93 
94 
95 //====================================================================
97 {
98  delete m_force_csw;
99  delete m_force_w;
100  delete m_fopr_c;
101 }
102 
103 
104 //====================================================================
106 {
107  const int Nvol = CommonParameters::Nvol();
108  const int Ndim = CommonParameters::Ndim();
109 
110  Field_F zeta;
111  Field_F eta(eta_);
112 
113  m_fopr_c->H(zeta, eta);
114 
115  Field_G force(Nvol, Ndim);
116  set_mode("H");
117  force_udiv1_impl(force, zeta, eta);
118  copy(force_, force); // force_ = force;
119 
120  set_mode("Hdag");
121  force_udiv1_impl(force, eta, zeta);
122  axpy(force_, 1.0, force); // force_ += force;
123 }
124 
125 
126 //====================================================================
127 void Force_F_Clover_Nf2_Isochemical::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
128 {
129  const int Nvol = CommonParameters::Nvol();
130  const int Ndim = CommonParameters::Ndim();
131 
132  Field_G force(Nvol, Ndim);
133  Field_F zeta(zeta_);
134  Field_F eta(eta_);
135 
136  force_udiv1_impl(force, zeta, eta);
137 
138  copy(force_, force); // force_ = force;
139 }
140 
141 
142 //====================================================================
144 {
145  const int Nvol = CommonParameters::Nvol();
146  const int Ndim = CommonParameters::Ndim();
147 
148  force.set(0.0);
149 
151  m_force_w->force_udiv1(force, zeta, eta);
152 
153  Field_G force2(Nvol, Ndim);
154  m_force_csw->force_udiv1(force2, zeta, eta);
155 
156  axpy(force, 1.0, force2); // force += force2;
157 }
158 
159 
160 //====================================================================
161 //============================================================END=====
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
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
Bridge::VerboseLevel m_vl
Definition: force_F.h:69
std::string m_repr
gamma matrix representation
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Class for parameters.
Definition: parameters.h:46
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
Force_F_Wilson_Nf2_Isochemical * m_force_w
Wilson fermion force.
Wilson-type fermion field.
Definition: field_F.h:37
Clover fermion operator with isospin chemical potential.
Force for the Wilson fermion operator with isospin chemical potential.
SU(N) gauge field.
Definition: field_G.h:38
void set_parameters(const Parameters &params)
Force_F_CloverTerm * m_force_csw
Clover term force.
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
void set_parameters(const Parameters &params)
double m_mu
Isospin chemical potential.
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
void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
void H(Field &, const Field &)
Fopr_Clover_Isochemical * m_fopr_c
fermion operator
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
string get_string(const string &key) const
Definition: parameters.cpp:221
void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
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
std::vector< int > m_boundary
boundary conditions
Force calculation for clover term of clover fermion.