Bridge++  Ver. 1.1.x
 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 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 using std::valarray;
21 
22 //- parameter entries
23 namespace {
24  void append_entry(Parameters& param)
25  {
26  param.Register_double("hopping_parameter", 0.0);
27  param.Register_double("isospin_chemical_potential", 0.0);
28  param.Register_int_vector("boundary_condition", std::valarray<int>());
29 
30  param.Register_string("verbose_level", "NULL");
31  }
32 
33 
34 #ifdef USE_PARAMETERS_FACTORY
35  bool init_param = ParametersFactory::Register("Force.F_Wilson_Nf2_Isochemical", append_entry);
36 #endif
37 }
38 //- end
39 
40 //- parameters class
42 //- end
43 
44 //====================================================================
46 {
47  const string str_vlevel = params.get_string("verbose_level");
48 
49  m_vl = vout.set_verbose_level(str_vlevel);
50 
51  //- fetch and check input parameters
52  double kappa, mu;
53  valarray<int> bc;
54 
55  int err = 0;
56  err += params.fetch_double("hopping_parameter", kappa);
57  err += params.fetch_double("isospin_chemical_potential", mu);
58  err += params.fetch_int_vector("boundary_condition", bc);
59 
60  if (err) {
61  vout.crucial(m_vl, "Force_F_Wilson_Isochemical: fetch error, input parameter not found.\n");
62  abort();
63  }
64 
65 
66  set_parameters(kappa, mu, bc);
67 }
68 
69 
70 //====================================================================
71 void Force_F_Wilson_Nf2_Isochemical::set_parameters(const double kappa, const double mu,
72  const valarray<int> bc)
73 {
74  int Ndim = CommonParameters::Ndim();
75 
76  //- print input parameters
77  vout.general(m_vl, "Parameters of Wilson fermion operator:\n");
78  vout.general(m_vl, " kappa = %8.4f\n", kappa);
79  vout.general(m_vl, " mu = %8.4f\n", mu);
80  for (int mu = 0; mu < Ndim; ++mu) {
81  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
82  }
83 
84  //- range check
85  // NB. kappa,mu == 0 is allowed.
86  assert(bc.size() == Ndim);
87 
88  //- store values
89  m_kappa = kappa;
90  m_mu = mu;
91  m_exp_mu = exp(mu);
92 
93  m_boundary.resize(Ndim);
94  for (int dir = 0; dir < Ndim; ++dir) {
95  m_boundary[dir] = bc[dir];
96  }
97 
98  //- post-process
100 }
101 
102 
103 //====================================================================
105 {
106  int Nc = CommonParameters::Nc();
107  int Nvol = CommonParameters::Nvol();
108  int Ndim = CommonParameters::Ndim();
109  int NinG = 2 * Nc * Nc;
110 
111  Field_G force(Nvol, Ndim);
112  Field_G force1(Nvol, Ndim);
113 
114  force1 = force_udiv(eta);
115 
116  for (int mu = 0; mu < Ndim; ++mu) {
117  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
118  force.at_Field_G(mu);
119  }
120  force *= -2.0;
121 
122  return (Field)force;
123 }
124 
125 
126 //====================================================================
128  const Field& eta)
129 {
130  int Nc = CommonParameters::Nc();
131  int Nvol = CommonParameters::Nvol();
132  int Ndim = CommonParameters::Ndim();
133  int NinG = 2 * Nc * Nc;
134 
135  Field_G force(Nvol, Ndim);
136  Field_G force1(Nvol, Ndim);
137 
138  force1 = force_udiv1(zeta, eta);
139 
140  for (int mu = 0; mu < Ndim; ++mu) {
141  force.mult_Field_Gnn(mu, *m_U, mu, force1, mu);
142  force.at_Field_G(mu);
143  }
144  force *= -2.0;
145 
146  return (Field)force;
147 }
148 
149 
150 //====================================================================
152 {
153  int Nc = CommonParameters::Nc();
154  int Nd = CommonParameters::Nd();
155  int Nvol = CommonParameters::Nvol();
156  int Ndim = CommonParameters::Ndim();
157  int NinG = 2 * Nc * Nc;
158 
159  Field force(NinG, Nvol, Ndim);
160  Field force2(NinG, Nvol, Ndim);
161 
162  Field_F zeta(Nvol, 1);
163 
164  m_fopr_w->set_mode("H");
165  zeta = (Field_F)m_fopr_w->mult(eta);
166 
167  set_mode("H");
168  force = force_udiv1(zeta, (Field_F)eta);
169 
170  set_mode("Hdag");
171  force2 = force_udiv1((Field_F)eta, zeta);
172 
173  force += force2;
174 
175  return (Field)force;
176 }
177 
178 
179 //====================================================================
181  const Field& eta)
182 {
183  return force_udiv1((Field_F)zeta, (Field_F)eta);
184 }
185 
186 
187 //====================================================================
189  const Field_F& eta)
190 {
191  int Nc = CommonParameters::Nc();
192  int Nd = CommonParameters::Nd();
193  int Nvol = CommonParameters::Nvol();
194  int Ndim = CommonParameters::Ndim();
195 
196  Field_G force(Nvol, Ndim);
197  Field_G force1(Nvol, 1);
198 
199  Field_F eta2(Nvol, 1), eta3(Nvol, 1);
200 
201  for (int dir = 0; dir < Ndim - 1; ++dir) {
202  eta2 = m_fopr_w->mult_gm5p(dir, eta);
203  eta3.mult_Field_Gd(0, *m_U, dir, eta2, 0);
204  eta3 *= -m_kappa;
205  tensorProd_Field_F(force1, zeta, eta3);
206  force.setpart_ex(dir, force1, 0);
207  }
208 
209  {
210  int dir = Ndim - 1;
211  eta2 = m_fopr_w->mult_gm5p(dir, eta);
212  eta3.mult_Field_Gd(0, *m_U, dir, eta2, 0);
213  if (m_mode == "H") {
214  eta3 *= -(m_kappa * m_exp_mu);
215  } else if (m_mode == "Hdag") {
216  eta3 *= -(m_kappa / m_exp_mu);
217  } else {
218  vout.crucial(m_vl, "Force_F_Wilson_Nf2_Isochemical: illegal mode.\n");
219  abort();
220  }
221  tensorProd_Field_F(force1, zeta, eta3);
222  force.setpart_ex(dir, force1, 0);
223  }
224 
225  return (Field)force;
226 }
227 
228 
229 //====================================================================
230 //============================================================END=====