Bridge++  Ver. 2.0.2
force_F_Domainwall.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Domainwall.h"
15 
16 const std::string Force_F_Domainwall::class_name = "Force_F_Domainwall";
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 mq, M0, b, c;
28  int Ns;
29  std::vector<int> bc;
30 
31  int err = 0;
32  err += params.fetch_double("quark_mass", mq);
33  err += params.fetch_double("domain_wall_height", M0);
34  err += params.fetch_int("extent_of_5th_dimension", Ns);
35  err += params.fetch_int_vector("boundary_condition", bc);
36 
37  if (err) {
38  vout.crucial(m_vl, "Error at %s: input parameter not found.\n",
39  class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43  int err2 = 0;
44  err2 += params.fetch_double("coefficient_b", b);
45  err2 += params.fetch_double("coefficient_c", c);
46 
47  if (err2) {
48  vout.general(m_vl, " coefficients b, c are not provided:"
49  " set to Shamir's form.\n");
50  b = 1.0;
51  c = 0.0;
52  }
53 
54  set_parameters(mq, M0, Ns, bc, b, c);
55 }
56 
57 
58 //====================================================================
60 {
61  params.set_double("quark_mass", m_mq);
62  params.set_double("domain_wall_height", m_M0);
63  params.set_int("extent_of_5th_dimension", m_Ns);
64  params.set_int_vector("boundary_condition", m_boundary);
65  params.set_double_vector("coefficient_b", m_b);
66  params.set_double_vector("coefficient_c", m_c);
67 
68  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
69 }
70 
71 
72 //====================================================================
74  const double M0,
75  const int Ns,
76  const std::vector<int> bc,
77  const double b,
78  const double c)
79 {
80  const int Ndim = CommonParameters::Ndim();
81 
82  //- range check
83  int err = 0;
84  err += ParameterCheck::non_zero(mq);
85  err += ParameterCheck::non_zero(M0);
86  err += ParameterCheck::non_zero(Ns);
87 
88  if (err) {
89  vout.crucial(m_vl, "Error at %s: parameter range check failed.\n",
90  class_name.c_str());
91  exit(EXIT_FAILURE);
92  }
93 
94  assert(bc.size() == Ndim);
95 
96  int ith = ThreadManager::get_thread_id();
97  if (ith == 0) {
98  m_mq = mq;
99  m_M0 = M0;
100  m_Ns = Ns;
101 
102  m_boundary.resize(Ndim);
103  m_boundary = bc;
104 
105  if (m_b.size() != m_Ns) {
106  m_b.resize(m_Ns);
107  m_c.resize(m_Ns);
108  }
109  for (int is = 0; is < m_Ns; ++is) {
110  m_b[is] = b;
111  m_c[is] = c;
112  }
113  }
114 
115  //- print input parameters
116  vout.general(m_vl, "%s:\n", class_name.c_str());
117  vout.general(m_vl, " mq = %12.8f\n", mq);
118  vout.general(m_vl, " M0 = %12.8f\n", M0);
119  vout.general(m_vl, " Ns = %4d\n", Ns);
120  for (int mu = 0; mu < Ndim; ++mu) {
121  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
122  }
123  vout.general(m_vl, " coefficients:\n");
124  for (int is = 0; is < m_Ns; ++is) {
125  vout.general(m_vl, " b[%2d] = %16.10f c[%2d] = %16.10f\n",
126  is, m_b[is], is, m_c[is]);
127  }
128 
129  //-- post-process
130  //- Domain-wall operator
132 
133  //- Wilson opr/force
134  const double kappa = 1.0 / (8.0 - 2.0 * m_M0);
137 }
138 
139 
140 //====================================================================
141 void Force_F_Domainwall::force_core1(Field& force, const Field& zeta,
142  const Field& eta)
143 {
144  vout.crucial("Error at %s: unimplemented.\n", __func__);
145  exit(EXIT_FAILURE);
146 }
147 
148 
149 //====================================================================
150 void Force_F_Domainwall::force_udiv(Field& force_, const Field& eta)
151 {
152  const int Nvol = CommonParameters::Nvol();
153  const int Ndim = CommonParameters::Ndim();
154 
155  Field_F zeta(Nvol, m_Ns);
156 
157  m_fopr_dw->set_mode("H");
158  m_fopr_dw->mult(zeta, eta);
159 
160  Field_G force(Nvol, Ndim);
161  force_udiv1(force, zeta, eta);
162  copy(force_, force); // force_ = force;
163 
164  force_udiv1(force, eta, zeta);
165  axpy(force_, 1.0, force); // force_ += force;
166 }
167 
168 
169 //====================================================================
170 void Force_F_Domainwall::force_udiv1(Field& force_, const Field& zeta, const Field& eta)
171 {
172  const int Nc = CommonParameters::Nc();
173  const int Nd = CommonParameters::Nd();
174  const int Nvol = CommonParameters::Nvol();
175  const int Ndim = CommonParameters::Ndim();
176  const int NinF = 2 * Nc * Nd;
177 
178  assert(eta.nin() == NinF);
179  assert(eta.nvol() == Nvol);
180  assert(eta.nex() == m_Ns);
181 
182  assert(zeta.nin() == NinF);
183  assert(zeta.nvol() == Nvol);
184  assert(zeta.nex() == m_Ns);
185 
186  force_.set(0.0);
187 
188  for (int is = 0; is < m_Ns; ++is) {
189  Field_F zeta4;
190  zeta4.setpart_ex(0, zeta, m_Ns - 1 - is);
191 
192  Field_F eta4;
193  eta4.setpart_ex(0, eta, is);
194 
195  scal(eta4, 4.0 - m_M0);
196 
197  Field_G force(Nvol, Ndim);
198  m_force_w->force_udiv1(force, zeta4, eta4);
199  axpy(force_, 1.0, force); // force_ += force;
200  }
201 }
202 
203 
204 //====================================================================
205 //============================================================END=====
Force_F_Domainwall::class_name
static const std::string class_name
Definition: force_F_Domainwall.h:39
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
Force_F_Domainwall::m_Ns
int m_Ns
Definition: force_F_Domainwall.h:49
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Force_F_Domainwall::m_c
std::vector< double > m_c
coefficient c (array)
Definition: force_F_Domainwall.h:52
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Force_F_Wilson_Nf2::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Wilson_Nf2.cpp:103
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
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Force_F_Domainwall::m_b
std::vector< double > m_b
coefficient b (array)
Definition: force_F_Domainwall.h:51
Field::nex
int nex() const
Definition: field.h:128
Force_F_Domainwall::force_udiv1
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Domainwall.cpp:170
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Domainwall::m_M0
double m_M0
Definition: force_F_Domainwall.h:48
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Parameters::set_double_vector
void set_double_vector(const string &key, const vector< double > &value)
Definition: parameters.cpp:42
AFopr_Domainwall::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Domainwall-tmpl.h:513
Field::nin
int nin() const
Definition: field.h:126
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
Force_F_Domainwall::m_fopr_w
Fopr_Wilson * m_fopr_w
Definition: force_F_Domainwall.h:54
Force_F_Domainwall::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Domainwall.cpp:150
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Org::Fopr_Wilson::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Wilson_impl.cpp:127
Force_F_Domainwall::m_fopr_dw
Fopr_Domainwall * m_fopr_dw
Definition: force_F_Domainwall.h:55
Force_F_Domainwall::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Domainwall.h:42
Field::nvol
int nvol() const
Definition: field.h:127
Force_F_Domainwall::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Domainwall.cpp:19
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Force_F_Domainwall::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Domainwall.cpp:59
Force_F_Domainwall::force_core1
void force_core1(Field &force, const Field &zeta, const Field &eta)
Definition: force_F_Domainwall.cpp:141
CommonParameters::Nd
static int Nd()
Definition: commonParameters.h:116
Force_F_Wilson_Nf2::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_Nf2.cpp:19
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
AFopr_Domainwall::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Domainwall-tmpl.h:203
ParameterCheck::non_zero
int non_zero(const double v)
Definition: parameterCheck.cpp:32
Force_F_Domainwall::m_mq
double m_mq
Definition: force_F_Domainwall.h:47
Parameters::set_int
void set_int(const string &key, const int value)
Definition: parameters.cpp:36
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
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_Domainwall::m_boundary
std::vector< int > m_boundary
Definition: force_F_Domainwall.h:50
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
AFopr_Domainwall::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Domainwall-tmpl.h:500
Field
Container of Field-type object.
Definition: field.h:46
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
Parameters::fetch_int
int fetch_int(const string &key, int &value) const
Definition: parameters.cpp:346
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Force_F_Domainwall::m_force_w
Force_F_Wilson_Nf2 * m_force_w
Definition: force_F_Domainwall.h:56
force_F_Domainwall.h
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154