Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Wilson_SF.cpp
Go to the documentation of this file.
1 
14 #include "force_F_Wilson_SF.h"
15 
16 
17 
18 const std::string Force_F_Wilson_SF::class_name = "Force_F_Wilson_SF";
19 
20 //====================================================================
22 {
23  const string str_vlevel = params.get_string("verbose_level");
24 
25  m_vl = vout.set_verbose_level(str_vlevel);
26 
27  //- fetch and check input parameters
28  double kappa;
29  std::vector<int> bc;
30 
31  int err = 0;
32  err += params.fetch_double("hopping_parameter", kappa);
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, bc);
42 }
43 
44 
45 //====================================================================
46 void Force_F_Wilson_SF::set_parameters(double kappa, const std::vector<int> bc)
47 {
48  int Ndim = CommonParameters::Ndim();
49 
50  //- print input parameters
51  vout.general(m_vl, "%s:\n", class_name.c_str());
52  vout.general(m_vl, " kappa = %12.8f\n", kappa);
53  for (int mu = 0; mu < Ndim; ++mu) {
54  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
55  }
56 
57  //- range check
58  // NB. kappa == 0 is allowed.
59  assert(bc.size() == Ndim);
60 
61  //- store values
62  m_kappa = kappa;
63 
64  m_boundary.resize(Ndim);
65  for (int mu = 0; mu < Ndim; ++mu) {
66  m_boundary[mu] = bc[mu];
67  }
68 
69  //- propagate parameters
71 }
72 
73 
74 //====================================================================
75 void Force_F_Wilson_SF::force_udiv(Field& force_, const Field& eta_)
76 {
77  int Nc = CommonParameters::Nc();
78  int Nd = CommonParameters::Nd();
79  int Nvol = CommonParameters::Nvol();
80  int Ndim = CommonParameters::Ndim();
81 
82  Field_G force(Nvol, Ndim);
83  Field_G force1(Nvol, Ndim);
84 
85  Field_F zeta(Nvol, 1);
86  Field_F eta(eta_);
87 
88  m_fopr_w->set_mode("H");
89  m_fopr_w->mult(zeta, eta);
90 
91  force_udiv1_impl(force, zeta, eta);
92 
93  force_udiv1_impl(force1, eta, zeta);
94  axpy(force, 1.0, force1); // force += force1;
95 
96  Field_G_SF set_wk;
97  set_wk.set_boundary_spatial_link_zero(force);
98 
99  copy(force_, force); // force_ = force;
100 }
101 
102 
103 //====================================================================
104 void Force_F_Wilson_SF::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
105 {
106  int Nvol = CommonParameters::Nvol();
107  int Ndim = CommonParameters::Ndim();
108 
109  Field_G force(Nvol, Ndim);
110  Field_F zeta(zeta_);
111  Field_F eta(eta_);
112 
113  force_udiv1_impl(force, zeta, eta);
114 
115  copy(force_, force); // force_ = force;
116 }
117 
118 
119 //====================================================================
120 void Force_F_Wilson_SF::force_udiv1_impl(Field_G& force, const Field_F& zeta, const Field_F& eta)
121 {
122  int Nc = CommonParameters::Nc();
123  int Nd = CommonParameters::Nd();
124  int Nvol = CommonParameters::Nvol();
125  int Ndim = CommonParameters::Ndim();
126 
127  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
128 
129  force.set(0.0);
130 
131  for (int mu = 0; mu < Ndim; ++mu) {
132  m_fopr_w->mult_gm5p(mu, eta2, eta);
133  mult_Field_Gd(eta3, 0, *m_U, mu, eta2, 0);
134  tensorProd_Field_F(force, mu, zeta, eta3);
135  }
136 
137  scal(force, -m_kappa); // force *= -m_kappa;
138 }
139 
140 
141 //====================================================================
142 //============================================================END=====
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_G_SF.h:33
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:83
BridgeIO vout
Definition: bridgeIO.cpp:495
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void general(const char *format,...)
Definition: bridgeIO.cpp:195
Bridge::VerboseLevel m_vl
Definition: force_F.h:72
Container of Field-type object.
Definition: field.h:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
Class for parameters.
Definition: parameters.h:46
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
Wilson-type fermion field.
Definition: field_F.h:37
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:104
SU(N) gauge field.
Definition: field_G.h:38
Fopr_Wilson_SF * m_fopr_w
static const std::string class_name
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_gm5p(int mu, Field_F &v, const Field_F &w)
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
void set_parameters(const Parameters &params)
void force_udiv(Field &force, const Field &eta)
std::vector< int > m_boundary
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
void force_udiv1(Field &force, const Field &zeta, const Field &eta)
string get_string(const string &key) const
Definition: parameters.cpp:116
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void set_parameters(const Parameters &params)