Bridge++  Ver. 2.0.2
force_F_Wilson_Nf2_Isochemical.cpp
Go to the documentation of this file.
1 
15 
17  = "Force_F_Wilson_Nf2_Isochemical";
18 
19 //====================================================================
21 {
22  std::string vlevel;
23  if (!params.fetch_string("verbose_level", vlevel)) {
24  m_vl = vout.set_verbose_level(vlevel);
25  }
26 
27  //- fetch and check input parameters
28  double kappa, mu;
29  std::vector<int> bc;
30 
31  int err = 0;
32  err += params.fetch_double("hopping_parameter", kappa);
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_impl(kappa, mu, bc);
42 
44  m_fopr_w->set_parameters(params);
46 }
47 
48 
49 //====================================================================
51  const double kappa,
52  const double mu,
53  const std::vector<int> bc)
54 {
55  set_parameters_impl(kappa, mu, bc);
56 
57  Parameters params;
58  get_parameters(params);
59  m_fopr_w->set_parameters(params);
60 }
61 
62 
63 //====================================================================
65  const double kappa,
66  const double mu,
67  const std::vector<int> bc)
68 {
69 #pragma omp barrier
70 
71  const int Ndim = CommonParameters::Ndim();
72  assert(bc.size() == Ndim);
73 
74  int ith = ThreadManager::get_thread_id();
75 
76  if (ith == 0) {
77  m_kappa = kappa;
78  m_mu = mu;
79  m_exp_mu = exp(mu);
80 
81  m_boundary.resize(Ndim);
82  m_boundary = bc;
83  }
84 #pragma omp barrier
85 
86  //- print input parameters
87  vout.general(m_vl, "%s: set parameters\n", class_name.c_str());
88  vout.general(m_vl, " kappa = %12.8f\n", m_kappa);
89  vout.general(m_vl, " mu = %12.8f\n", m_mu);
90  for (int dir = 0; dir < Ndim; ++dir) {
91  vout.general(m_vl, " boundary[%d] = %2d\n", dir, m_boundary[dir]);
92  }
93 }
94 
95 
96 //====================================================================
98 {
99  params.set_double("hopping_parameter", m_kappa);
100  params.set_double("chemical_potential", m_mu);
101  params.set_int_vector("boundary_condition", m_boundary);
102 
103  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
104 }
105 
106 
107 //====================================================================
109 {
110  const int Nvol = CommonParameters::Nvol();
111  const int Ndim = CommonParameters::Ndim();
112 
113  Field_F zeta;
114  Field_F eta(eta_);
115 
116  m_fopr_w->set_mode("H");
117  m_fopr_w->mult(zeta, eta);
118 
119  Field_G force(Nvol, Ndim);
120  set_mode("H");
121  force_udiv1_impl(force, zeta, eta);
122  copy(force_, force); // force_ = force;
123 
124  set_mode("Hdag");
125  force_udiv1_impl(force, eta, zeta);
126  axpy(force_, 1.0, force); // force_ += force;
127 }
128 
129 
130 //====================================================================
131 void Force_F_Wilson_Nf2_Isochemical::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
132 {
133  const int Nvol = CommonParameters::Nvol();
134  const int Ndim = CommonParameters::Ndim();
135 
136  Field_G force(Nvol, Ndim);
137  Field_F zeta(zeta_);
138  Field_F eta(eta_);
139 
140  force_udiv1_impl(force, zeta, eta);
141 
142  copy(force_, force); // force_ = force;
143 }
144 
145 
146 //====================================================================
148 {
149  const int Ndim = CommonParameters::Ndim();
150 
151  force.set(0.0);
152 
153  for (int dir = 0; dir < Ndim - 1; ++dir) {
154  Field_F eta2;
155  m_fopr_w->mult_gm5p(dir, eta2, eta);
156 
157  Field_F eta3;
158  mult_Field_Gd(eta3, 0, *m_U, dir, eta2, 0);
159  scal(eta3, -m_kappa); // eta3 *= -m_kappa;
160 
161  tensorProd_Field_F(force, dir, zeta, eta3);
162  }
163 
164  {
165  const int dir = Ndim - 1;
166 
167  Field_F eta2;
168  m_fopr_w->mult_gm5p(dir, eta2, eta);
169 
170  Field_F eta3;
171  mult_Field_Gd(eta3, 0, *m_U, dir, eta2, 0);
172 
173  if (m_mode == "H") {
174  scal(eta3, -(m_kappa * m_exp_mu)); // eta3 *= -(m_kappa * m_exp_mu);
175  } else if (m_mode == "Hdag") {
176  scal(eta3, -(m_kappa / m_exp_mu)); // eta3 *= -(m_kappa / m_exp_mu);
177  } else {
178  vout.crucial(m_vl, "Error at %s: illegal mode.\n", class_name.c_str());
179  exit(EXIT_FAILURE);
180  }
181 
182  tensorProd_Field_F(force, dir, zeta, eta3);
183  }
184 }
185 
186 
187 //====================================================================
188 //============================================================END=====
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Force_F_Wilson_Nf2_Isochemical::m_mu
double m_mu
isospin chemical potential
Definition: force_F_Wilson_Nf2_Isochemical.h:45
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
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Bridge::BridgeIO::decrease_indent
void decrease_indent()
Definition: bridgeIO.h:86
Bridge::BridgeIO::increase_indent
void increase_indent()
Definition: bridgeIO.h:85
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Force_F_Wilson_Nf2_Isochemical::force_udiv1_impl
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:147
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
mult_Field_Gd
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:76
AFopr_Wilson_Chemical::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Wilson_Chemical-tmpl.h:143
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
tensorProd_Field_F
void tensorProd_Field_F(Field_G &u, const Field_F &v1, const Field_F &v2)
Definition: tensorProd.cpp:32
force_F_Wilson_Nf2_Isochemical.h
Force::m_U
Field_G * m_U
Definition: force_F.h:66
Force_F_Wilson_Nf2_Isochemical::set_parameters
void set_parameters(const Parameters &params)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:20
Force_F_Wilson_Nf2_Isochemical::m_fopr_w
Fopr_Wilson_Chemical * m_fopr_w
Definition: force_F_Wilson_Nf2_Isochemical.h:48
Force_F_Wilson_Nf2_Isochemical::m_vl
Bridge::VerboseLevel m_vl
Definition: force_F_Wilson_Nf2_Isochemical.h:42
Force_F_Wilson_Nf2_Isochemical::get_parameters
void get_parameters(Parameters &params) const
Definition: force_F_Wilson_Nf2_Isochemical.cpp:97
Force_F_Wilson_Nf2_Isochemical::m_boundary
std::vector< int > m_boundary
Definition: force_F_Wilson_Nf2_Isochemical.h:47
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Force_F_Wilson_Nf2_Isochemical::force_udiv
void force_udiv(Field &force, const Field &eta)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:108
Force_F_Wilson_Nf2_Isochemical::m_exp_mu
double m_exp_mu
exp(mu)
Definition: force_F_Wilson_Nf2_Isochemical.h:46
AFopr_Wilson_Chemical::set_mode
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Wilson_Chemical-tmpl.h:241
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Force_F_Wilson_Nf2_Isochemical::m_mode
std::string m_mode
Definition: force_F_Wilson_Nf2_Isochemical.h:52
Force_F_Wilson_Nf2_Isochemical::m_kappa
double m_kappa
hopping parameter
Definition: force_F_Wilson_Nf2_Isochemical.h:44
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
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
AFopr_Wilson_Chemical::mult_gm5p
void mult_gm5p(const int mu, AFIELD &v, const AFIELD &w)
Definition: afopr_Wilson_Chemical-tmpl.h:370
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
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
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
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
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
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
Force_F_Wilson_Nf2_Isochemical::class_name
static const std::string class_name
Definition: force_F_Wilson_Nf2_Isochemical.h:39
Force_F_Wilson_Nf2_Isochemical::set_parameters_impl
void set_parameters_impl(const double kappa, const double mu, const std::vector< int > bc)
Definition: force_F_Wilson_Nf2_Isochemical.cpp:64
AFopr_Wilson_Chemical::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Wilson_Chemical-tmpl.h:255