Bridge++  Ver. 2.0.2
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  std::string vlevel;
22  if (!params.fetch_string("verbose_level", vlevel)) {
23  m_vl = vout.set_verbose_level(vlevel);
24  }
25 
26  //- fetch and check input parameters
27  double kappa, cSW, mu;
28  std::vector<int> bc;
29 
30  int err = 0;
31  err += params.fetch_double("hopping_parameter", kappa);
32  err += params.fetch_double("clover_coefficient", cSW);
33  err += params.fetch_double("chemical_potential", mu);
34  err += params.fetch_int_vector("boundary_condition", bc);
35 
36  if (err) {
37  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
38  exit(EXIT_FAILURE);
39  }
40 
41  set_parameters(kappa, cSW, mu, bc);
42 
43  m_fopr_c->set_parameters(params);
44  m_force_w->set_parameters(params);
45  m_force_csw->set_parameters(params);
46 }
47 
48 
49 //====================================================================
51 {
52  params.set_double("hopping_parameter", m_kappa);
53  params.set_double("clover_coefficient", m_cSW);
54  params.set_double("chemical_potential", m_mu);
55  params.set_int_vector("boundary_condition", m_boundary);
56 
57  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
58 }
59 
60 
61 //====================================================================
63  const double kappa,
64  const double cSW,
65  const double mu,
66  const std::vector<int> bc)
67 {
68  set_parameters_impl(kappa, cSW, mu, bc);
69 
70  Parameters params;
71  get_parameters(params);
72  m_fopr_c->set_parameters(params);
73  m_force_w->set_parameters(params);
74  m_force_csw->set_parameters(params);
75 }
76 
77 
78 //====================================================================
80  const double kappa,
81  const double cSW,
82  const double mu,
83  const std::vector<int> bc)
84 {
85 #pragma omp barrier
86 
87  const int Ndim = CommonParameters::Ndim();
88  assert(bc.size() == Ndim);
89 
90  int ith = ThreadManager::get_thread_id();
91 
92  if (ith == 0) {
93  m_kappa = kappa;
94  m_cSW = cSW;
95  m_mu = mu;
96 
97  m_boundary.resize(Ndim);
98  m_boundary = bc;
99  }
100 #pragma omp barrier
101 
102  //- print input parameters
103  vout.general(m_vl, "%s:\n", class_name.c_str());
104  vout.general(m_vl, " kappa = %12.8f\n", m_kappa);
105  vout.general(m_vl, " cSW = %12.8f\n", m_cSW);
106  vout.general(m_vl, " mu = %12.8f\n", m_mu);
107  for (int dir = 0; dir < Ndim; ++dir) {
108  vout.general(m_vl, " boundary[%d] = %2d\n", dir, m_boundary[dir]);
109  }
110 }
111 
112 
113 //====================================================================
115 {
116  m_repr = repr;
117 
119 
123 
125 }
126 
127 
128 //====================================================================
130 {
131  delete m_force_csw;
132  delete m_force_w;
133  delete m_fopr_c;
134 }
135 
136 
137 //====================================================================
139 {
140  const int Nvol = CommonParameters::Nvol();
141  const int Ndim = CommonParameters::Ndim();
142 
143  Field_F zeta;
144  Field_F eta(eta_);
145 
146  m_fopr_c->H(zeta, eta);
147 
148  Field_G force(Nvol, Ndim);
149  set_mode("H");
150  force_udiv1_impl(force, zeta, eta);
151  copy(force_, force); // force_ = force;
152 
153  set_mode("Hdag");
154  force_udiv1_impl(force, eta, zeta);
155  axpy(force_, 1.0, force); // force_ += force;
156 }
157 
158 
159 //====================================================================
160 void Force_F_Clover_Nf2_Isochemical::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
161 {
162  const int Nvol = CommonParameters::Nvol();
163  const int Ndim = CommonParameters::Ndim();
164 
165  Field_G force(Nvol, Ndim);
166  Field_F zeta(zeta_);
167  Field_F eta(eta_);
168 
169  force_udiv1_impl(force, zeta, eta);
170 
171  copy(force_, force); // force_ = force;
172 }
173 
174 
175 //====================================================================
177 {
178  const int Nvol = CommonParameters::Nvol();
179  const int Ndim = CommonParameters::Ndim();
180 
181  force.set(0.0);
182 
184  m_force_w->force_udiv1(force, zeta, eta);
185 
186  Field_G force2(Nvol, Ndim);
187  m_force_csw->force_udiv1(force2, zeta, eta);
188 
189  axpy(force, 1.0, force2); // force += force2;
190 }
191 
192 
193 //====================================================================
194 //============================================================END=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Force_F_Clover_Nf2_Isochemical::tidyup
void tidyup()
Definition: force_F_Clover_Nf2_Isochemical.cpp:129
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Fopr_Clover_Chemical
AFopr_Clover_Chemical< Field > Fopr_Clover_Chemical
Definition: fopr_Clover_Chemical.h:19
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Force_F_Clover_Nf2_Isochemical::m_cSW
double m_cSW
clover coefficient
Definition: force_F_Clover_Nf2_Isochemical.h:45
Force_F_Clover_Nf2_Isochemical::set_mode
void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
Definition: force_F_Clover_Nf2_Isochemical.h:103
Force_F_CloverTerm
Force calculation for clover term of clover fermion.
Definition: force_F_CloverTerm.h:38
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Clover_Nf2_Isochemical::m_mode
std::string m_mode
mult mode
Definition: force_F_Clover_Nf2_Isochemical.h:50
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Force_F_Clover_Nf2_Isochemical::set_parameters_impl
void set_parameters_impl(const double kappa, const double cSW, const double mu, const std::vector< int > bc)
Setting parameters with clover fermion parameters.
Definition: force_F_Clover_Nf2_Isochemical.cpp:79
Force_F_CloverTerm::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_CloverTerm.cpp:123
Force_F_Clover_Nf2_Isochemical::m_boundary
std::vector< int > m_boundary
boundary conditions
Definition: force_F_Clover_Nf2_Isochemical.h:47
Force_F_Clover_Nf2_Isochemical::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_Clover_Nf2_Isochemical.cpp:160
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
Force_F_Wilson_Nf2_Isochemical::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:20
Force_F_Clover_Nf2_Isochemical::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Core implemetation of clover force calculation.
Definition: force_F_Clover_Nf2_Isochemical.cpp:176
Force_F_Wilson_Nf2_Isochemical
Force for the Wilson fermion operator with isospin chemical potential.
Definition: force_F_Wilson_Nf2_Isochemical.h:36
Force_F_Clover_Nf2_Isochemical::m_kappa
double m_kappa
hopping parameter
Definition: force_F_Clover_Nf2_Isochemical.h:44
Force_F_Clover_Nf2_Isochemical::m_fopr_c
Fopr_Clover_Chemical * m_fopr_c
fermion operator
Definition: force_F_Clover_Nf2_Isochemical.h:55
Force_F_CloverTerm::set_parameters
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
Definition: force_F_CloverTerm.cpp:19
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Force_F_Clover_Nf2_Isochemical::init
void init(const std::string repr)
Definition: force_F_Clover_Nf2_Isochemical.cpp:114
AFopr_Clover_Chemical::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Clover_Chemical-tmpl.h:388
Force_F_Clover_Nf2_Isochemical::m_Ndim
int m_Ndim
spacetime dimension
Definition: force_F_Clover_Nf2_Isochemical.h:59
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Force_F_Clover_Nf2_Isochemical::class_name
static const std::string class_name
Definition: force_F_Clover_Nf2_Isochemical.h:39
Force_F_Clover_Nf2_Isochemical::set_parameters
void set_parameters(const Parameters &params)
Setting parameters of clover fermion force.
Definition: force_F_Clover_Nf2_Isochemical.cpp:19
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
AFopr_Clover_Chemical::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Clover_Chemical-tmpl.h:145
Force_F_Clover_Nf2_Isochemical::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Clover_Nf2_Isochemical.h:42
Force_F_Wilson_Nf2_Isochemical::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:131
Force_F_Clover_Nf2_Isochemical::m_repr
std::string m_repr
gamma matrix representation
Definition: force_F_Clover_Nf2_Isochemical.h:49
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Force_F_Clover_Nf2_Isochemical::m_force_csw
Force_F_CloverTerm * m_force_csw
Clover term force.
Definition: force_F_Clover_Nf2_Isochemical.h:57
Force_F_Clover_Nf2_Isochemical::get_parameters
void get_parameters(Parameters &params) const
Getting parameters of clover fermion force.
Definition: force_F_Clover_Nf2_Isochemical.cpp:50
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Force_F_Clover_Nf2_Isochemical::force_udiv
void force_udiv(Field &force, const Field &eta)
For recursive calculation of smeared force.
Definition: force_F_Clover_Nf2_Isochemical.cpp:138
Field
Container of Field-type object.
Definition: field.h:46
force_F_Clover_Nf2_Isochemical.h
ThreadManager::get_thread_id
static int get_thread_id()
returns thread id.
Definition: threadManager.cpp:253
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Force_F_Wilson_Nf2_Isochemical::set_mode
void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
Definition: force_F_Wilson_Nf2_Isochemical.h:107
Force_F_Clover_Nf2_Isochemical::m_force_w
Force_F_Wilson_Nf2_Isochemical * m_force_w
Wilson fermion force.
Definition: force_F_Clover_Nf2_Isochemical.h:56
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Force_F_Clover_Nf2_Isochemical::m_mu
double m_mu
Isospin chemical potential.
Definition: force_F_Clover_Nf2_Isochemical.h:46
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154