Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_F_Wilson_Nf2_Isochemical.cpp
Go to the documentation of this file.
1 
15 
16 const std::string Force_F_Wilson_Nf2_Isochemical::class_name = "Force_F_Wilson_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, mu;
27  std::vector<int> bc;
28 
29  int err = 0;
30  err += params.fetch_double("hopping_parameter", kappa);
31  err += params.fetch_double("isospin_chemical_potential", mu);
32  err += params.fetch_int_vector("boundary_condition", bc);
33 
34  if (err) {
35  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
36  exit(EXIT_FAILURE);
37  }
38 
39 
40  set_parameters(kappa, mu, bc);
41 }
42 
43 
44 //====================================================================
45 void Force_F_Wilson_Nf2_Isochemical::set_parameters(const double kappa, const double mu,
46  const std::vector<int> bc)
47 {
48  const 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  vout.general(m_vl, " mu = %12.8f\n", mu);
54  for (int imu = 0; imu < Ndim; ++imu) {
55  vout.general(m_vl, " boundary[%d] = %2d\n", imu, bc[imu]);
56  }
57 
58  //- range check
59  // NB. kappa,mu == 0 is allowed.
60  assert(bc.size() == Ndim);
61 
62  //- store values
63  m_kappa = kappa;
64  m_mu = mu;
65  m_exp_mu = exp(mu);
66 
67  m_boundary.resize(Ndim);
68  m_boundary = bc;
69 
70  //- post-process
72 }
73 
74 
75 //====================================================================
77 {
78  const int Nvol = CommonParameters::Nvol();
79  const int Ndim = CommonParameters::Ndim();
80 
81  Field_F zeta;
82  Field_F eta(eta_);
83 
84  m_fopr_w->set_mode("H");
85  m_fopr_w->mult(zeta, eta);
86 
87  Field_G force(Nvol, Ndim);
88  set_mode("H");
89  force_udiv1_impl(force, zeta, eta);
90  copy(force_, force); // force_ = force;
91 
92  set_mode("Hdag");
93  force_udiv1_impl(force, eta, zeta);
94  axpy(force_, 1.0, force); // force_ += force;
95 }
96 
97 
98 //====================================================================
99 void Force_F_Wilson_Nf2_Isochemical::force_udiv1(Field& force_, const Field& zeta_, const Field& eta_)
100 {
101  const int Nvol = CommonParameters::Nvol();
102  const int Ndim = CommonParameters::Ndim();
103 
104  Field_G force(Nvol, Ndim);
105  Field_F zeta(zeta_);
106  Field_F eta(eta_);
107 
108  force_udiv1_impl(force, zeta, eta);
109 
110  copy(force_, force); // force_ = force;
111 }
112 
113 
114 //====================================================================
116 {
117  const int Ndim = CommonParameters::Ndim();
118 
119  force.set(0.0);
120 
121  for (int dir = 0; dir < Ndim - 1; ++dir) {
122  Field_F eta2;
123  m_fopr_w->mult_gm5p(dir, eta2, eta);
124 
125  Field_F eta3;
126  mult_Field_Gd(eta3, 0, *m_U, dir, eta2, 0);
127  scal(eta3, -m_kappa); // eta3 *= -m_kappa;
128 
129  tensorProd_Field_F(force, dir, zeta, eta3);
130  }
131 
132  {
133  const int dir = Ndim - 1;
134 
135  Field_F eta2;
136  m_fopr_w->mult_gm5p(dir, eta2, eta);
137 
138  Field_F eta3;
139  mult_Field_Gd(eta3, 0, *m_U, dir, eta2, 0);
140 
141  if (m_mode == "H") {
142  scal(eta3, -(m_kappa * m_exp_mu)); // eta3 *= -(m_kappa * m_exp_mu);
143  } else if (m_mode == "Hdag") {
144  scal(eta3, -(m_kappa / m_exp_mu)); // eta3 *= -(m_kappa / m_exp_mu);
145  } else {
146  vout.crucial(m_vl, "Error at %s: illegal mode.\n", class_name.c_str());
147  exit(EXIT_FAILURE);
148  }
149 
150  tensorProd_Field_F(force, dir, zeta, eta3);
151  }
152 }
153 
154 
155 //====================================================================
156 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
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:79
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
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
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Field_G * m_U
Definition: force_F.h:68
void force_udiv1_impl(Field_G &force, const Field_F &zeta, const Field_F &eta)
Class for parameters.
Definition: parameters.h:46
double m_mu
isospin chemical potential
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
Wilson-type fermion field.
Definition: field_F.h:37
SU(N) gauge field.
Definition: field_G.h:38
void set_parameters(const Parameters &params)
void set_parameters(const Parameters &params)
void force_udiv(Field &force, const Field &eta)
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 mult_gm5p(const 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 force_udiv1(Field &force, const Field &zeta, const Field &eta)
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