Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
langevin_Momentum.cpp
Go to the documentation of this file.
1 
14 #include "langevin_Momentum.h"
15 
16 //====================================================================
18 {
19  const int Nc = CommonParameters::Nc();
20 
21  double iP2;
22 
23  if (Nc == 3) {
24  iP2 = set_iP_SU3(iP);
25  // iP2 = set_iP_general_SU_N(iP);
26  // iP2 = set_iP_SU3_alt(iP);
27  // Comment:
28  // if you want to check that set_iP_general_SU_N() works
29  // correctly for Nc=3 case, compare the result with
30  // set_iP_SU3_alt(). [13 Feb 2013 H.Matsufuru]
31  } else {
32  iP2 = set_iP_general_SU_N(iP);
33  }
34 
35  return iP2;
36 }
37 
38 
39 //====================================================================
41 {
42  const int Nin = iP.nin();
43  const int Nvol = iP.nvol(); // local volume (SA)
44  const int Nex = iP.nex();
45 
46  const int Nc = CommonParameters::Nc();
47  const int NcA = Nc * Nc - 1;
48 
49  vout.general(m_vl, " Conjugate momenta for SU(%d) gauge field.\n", Nc);
50 
51  GeneratorSet_Mat_SU_N gen_set(Nc);
52  std::vector<Mat_SU_N *> iT(NcA);
53  for (int i = 0; i < NcA; ++i) {
54  iT[i] = new Mat_SU_N(Nc);
55  *iT[i] = gen_set.get_generator(i);
56  iT[i]->xI();
57  }
58  Mat_SU_N u_tmp(Nc), u_tmp2(Nc);
59 
60  Field Hrand(NcA, Nvol, Nex); // Local random number (SA)
61  m_rand->gauss_lex_global(Hrand); // generate gaussian random number Hrand. (SA)
62 
63  for (int ex = 0; ex < Nex; ++ex) {
64  for (int site = 0; site < Nvol; ++site) {
65  u_tmp = 0.0;
66  for (int i = 0; i < NcA; ++i) {
67  u_tmp2 = *iT[i];
68  u_tmp2 *= 2.0 * Hrand.cmp(i, site, ex);
69  u_tmp += u_tmp2;
70  }
71 
72  iP.set_mat(site, ex, u_tmp);
73  }
74  }
75 
76  for (int i = 0; i < NcA; ++i) {
77  delete iT[i];
78  }
79 
80  const double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
81 
82  return 0.5 * iP2 * iP2;
83 }
84 
85 
86 //====================================================================
88 {
89  // alternative implementation to set_iP_SU3():
90  // this gives the same result as set_iP_general_SU_N() for Nc=3 case.
91 
92  const int Nin = iP.nin();
93  const int Nvol = iP.nvol(); // local volume (SA)
94  const int Nex = iP.nex();
95 
96  const int Nc = CommonParameters::Nc();
97  const int NcA = Nc * Nc - 1;
98 
99  // confirm that now gauge group is SU(3)
100  assert(NcA == 8);
101 
102  Field Hrand(NcA, Nvol, Nex); // Local random number (SA)
103 
104  m_rand->gauss_lex_global(Hrand); // generate gaussian random number Hrand. (SA)
105 
106  const double sq3r = 1.0 / sqrt(3.0);
107  const double sq3r2 = 2.0 * sq3r;
108 
109  for (int ex = 0; ex < Nex; ++ex) {
110  for (int site = 0; site < Nvol; ++site) {
111  //here SU(3) is explicitly assumed. need to generalize.
112  // return (jin,site,ex) component(double) of Hrand. (SA)
113  double hc1 = Hrand.cmp(0, site, ex);
114  double hc2 = Hrand.cmp(1, site, ex);
115  double hc4 = Hrand.cmp(2, site, ex);
116  double hc5 = Hrand.cmp(3, site, ex);
117  double hc6 = Hrand.cmp(4, site, ex);
118  double hc7 = Hrand.cmp(5, site, ex);
119  double hc3 = Hrand.cmp(6, site, ex);
120  double hc8 = Hrand.cmp(7, site, ex);
121 
122  iP.set(0, site, ex, 0.0);
123  iP.set(1, site, ex, hc3 + hc8 * sq3r);
124  iP.set(2, site, ex, hc2);
125  iP.set(3, site, ex, hc1);
126  iP.set(4, site, ex, hc5);
127  iP.set(5, site, ex, hc4);
128  iP.set(6, site, ex, -hc2);
129  iP.set(7, site, ex, hc1);
130  iP.set(8, site, ex, 0.0);
131  iP.set(9, site, ex, -hc3 + hc8 * sq3r);
132  iP.set(10, site, ex, hc7);
133  iP.set(11, site, ex, hc6);
134  iP.set(12, site, ex, -hc5);
135  iP.set(13, site, ex, hc4);
136  iP.set(14, site, ex, -hc7);
137  iP.set(15, site, ex, hc6);
138  iP.set(16, site, ex, 0.0);
139  iP.set(17, site, ex, -hc8 * sq3r2);
140  }
141  }
142 
143  const double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
144 
145  return 0.5 * iP2 * iP2;
146 }
147 
148 
149 //====================================================================
151 {
152  // implementation for SU(3) case: original version.
153 
154  const int Nin = iP.nin();
155  const int Nvol = iP.nvol(); // local volume (SA)
156  const int Nex = iP.nex();
157 
158  const int Nc = CommonParameters::Nc();
159  const int NcA = Nc * Nc - 1;
160 
161  // confirm that now gauge group is SU(3)
162  assert(NcA == 8);
163 
164  Field Hrand(NcA, Nvol, Nex); // Local random number (SA)
165 
166  m_rand->gauss_lex_global(Hrand); // generate gaussian random number Hrand. (SA)
167 
168  const double sq3r = 1.0 / sqrt(3.0);
169  const double sq3r2 = 2.0 * sq3r;
170 
171  for (int ex = 0; ex < Nex; ++ex) {
172  for (int site = 0; site < Nvol; ++site) {
173  //here SU(3) is explicitly assumed. need to generalize.
174  // return (jin,site,ex) component(double) of Hrand. (SA)
175  double hc1 = Hrand.cmp(0, site, ex);
176  double hc2 = Hrand.cmp(1, site, ex);
177  double hc3 = Hrand.cmp(2, site, ex);
178  double hc4 = Hrand.cmp(3, site, ex);
179  double hc5 = Hrand.cmp(4, site, ex);
180  double hc6 = Hrand.cmp(5, site, ex);
181  double hc7 = Hrand.cmp(6, site, ex);
182  double hc8 = Hrand.cmp(7, site, ex);
183 
184  /*
185  iP = i P^a T^a: T^a: Gellmann matrix
186  P=
187  | hc3+hc8/sqrt(3), hc1-i*hc2, hc4-i*hc5 |
188  | hc1+i*hc2, -hc3+hc8/sqrt(3), hc6-i*hc7 |
189  | hc4+i*hc5, hc6+i*hc7, -2*hc8/sqrt(3) |
190  */
191  iP.set(0, site, ex, 0.0);
192  iP.set(1, site, ex, hc3 + hc8 * sq3r);
193  iP.set(2, site, ex, hc2);
194  iP.set(3, site, ex, hc1);
195  iP.set(4, site, ex, hc5);
196  iP.set(5, site, ex, hc4);
197  iP.set(6, site, ex, -hc2);
198  iP.set(7, site, ex, hc1);
199  iP.set(8, site, ex, 0.0);
200  iP.set(9, site, ex, -hc3 + hc8 * sq3r);
201  iP.set(10, site, ex, hc7);
202  iP.set(11, site, ex, hc6);
203  iP.set(12, site, ex, -hc5);
204  iP.set(13, site, ex, hc4);
205  iP.set(14, site, ex, -hc7);
206  iP.set(15, site, ex, hc6);
207  iP.set(16, site, ex, 0.0);
208  iP.set(17, site, ex, -hc8 * sq3r2);
209  }
210  }
211 
212  const double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
213 
214  return 0.5 * iP2 * iP2;
215 }
216 
217 
218 //====================================================================
219 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
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
Container of Field-type object.
Definition: field.h:45
double set_iP_SU3_alt(Field_G &iP)
Alternative of set_iP_SU3() for checking set_iP_general_SU_N().
int nvol() const
Definition: field.h:127
double set_iP(Field_G &iP)
Setting conjugate momenta and returns kinetic part of Hamiltonian.
double cmp(const int jin, const int site, const int jex) const
Definition: field.h:143
double set_iP_SU3(Field_G &iP)
Implementation for SU(3)
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
Set of SU(N) generators.
int nin() const
Definition: field.h:126
Mat_SU_N & xI()
Definition: mat_SU_N.h:390
SU(N) gauge field.
Definition: field_G.h:38
RandomNumbers * m_rand
double set_iP_general_SU_N(Field_G &iP)
Implementation for general value of Nc for SU(Nc) link variables.
double norm() const
Definition: field.h:222
int nex() const
Definition: field.h:128
Mat_SU_N get_generator(const int ica)
Bridge::VerboseLevel m_vl
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160