Bridge++  Version 1.4.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  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  int Nin = iP.nin();
43  int Nvol = iP.nvol(); // local volume (SA)
44  int Nex = iP.nex();
45 
46  int Nc = CommonParameters::Nc();
47  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  double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
81  iP2 = 0.5 * iP2 * iP2; // |iP|^2/2 (SA)
82 
83  return iP2;
84 }
85 
86 
87 //====================================================================
89 {
90  // alternative implementation to set_iP_SU3():
91  // this gives the same result as set_iP_general_SU_N() for Nc=3 case.
92 
93  int Nin = iP.nin();
94  int Nvol = iP.nvol(); // local volume (SA)
95  int Nex = iP.nex();
96 
97  int Nc = CommonParameters::Nc();
98  int NcA = Nc * Nc - 1;
99 
100  // confirm that now gauge group is SU(3)
101  assert(NcA == 8);
102 
103  Field Hrand(NcA, Nvol, Nex); // Local random number (SA)
104 
105  m_rand->gauss_lex_global(Hrand); // generate gaussian random number Hrand. (SA)
106 
107  double sq3r = 1.0 / sqrt(3.0);
108  double sq3r2 = 2.0 * sq3r;
109 
110  for (int ex = 0; ex < Nex; ++ex) {
111  for (int site = 0; site < Nvol; ++site) {
112  //here SU(3) is explicitly assumed. need to generalize.
113  // return (jin,site,ex) component(double) of Hrand. (SA)
114  double hc1 = Hrand.cmp(0, site, ex);
115  double hc2 = Hrand.cmp(1, site, ex);
116  double hc4 = Hrand.cmp(2, site, ex);
117  double hc5 = Hrand.cmp(3, site, ex);
118  double hc6 = Hrand.cmp(4, site, ex);
119  double hc7 = Hrand.cmp(5, site, ex);
120  double hc3 = Hrand.cmp(6, site, ex);
121  double hc8 = Hrand.cmp(7, site, ex);
122 
123  iP.set(0, site, ex, 0.0);
124  iP.set(1, site, ex, hc3 + hc8 * sq3r);
125  iP.set(2, site, ex, hc2);
126  iP.set(3, site, ex, hc1);
127  iP.set(4, site, ex, hc5);
128  iP.set(5, site, ex, hc4);
129  iP.set(6, site, ex, -hc2);
130  iP.set(7, site, ex, hc1);
131  iP.set(8, site, ex, 0.0);
132  iP.set(9, site, ex, -hc3 + hc8 * sq3r);
133  iP.set(10, site, ex, hc7);
134  iP.set(11, site, ex, hc6);
135  iP.set(12, site, ex, -hc5);
136  iP.set(13, site, ex, hc4);
137  iP.set(14, site, ex, -hc7);
138  iP.set(15, site, ex, hc6);
139  iP.set(16, site, ex, 0.0);
140  iP.set(17, site, ex, -hc8 * sq3r2);
141  }
142  }
143 
144  double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
145  iP2 = 0.5 * iP2 * iP2; // |iP|^2/2 (SA)
146 
147  return iP2;
148 }
149 
150 
151 //====================================================================
153 {
154  // implementation for SU(3) case: original version.
155 
156  int Nin = iP.nin();
157  int Nvol = iP.nvol(); // local volume (SA)
158  int Nex = iP.nex();
159 
160  int Nc = CommonParameters::Nc();
161  int NcA = Nc * Nc - 1;
162 
163  // confirm that now gauge group is SU(3)
164  assert(NcA == 8);
165 
166  Field Hrand(NcA, Nvol, Nex); // Local random number (SA)
167 
168  m_rand->gauss_lex_global(Hrand); // generate gaussian random number Hrand. (SA)
169 
170  double sq3r = 1.0 / sqrt(3.0);
171  double sq3r2 = 2.0 * sq3r;
172 
173  for (int ex = 0; ex < Nex; ++ex) {
174  for (int site = 0; site < Nvol; ++site) {
175  //here SU(3) is explicitly assumed. need to generalize.
176  // return (jin,site,ex) component(double) of Hrand. (SA)
177  double hc1 = Hrand.cmp(0, site, ex);
178  double hc2 = Hrand.cmp(1, site, ex);
179  double hc3 = Hrand.cmp(2, site, ex);
180  double hc4 = Hrand.cmp(3, site, ex);
181  double hc5 = Hrand.cmp(4, site, ex);
182  double hc6 = Hrand.cmp(5, site, ex);
183  double hc7 = Hrand.cmp(6, site, ex);
184  double hc8 = Hrand.cmp(7, site, ex);
185 
186  /*
187  iP = i P^a T^a: T^a: Gellmann matrix
188  P=
189  | hc3+hc8/sqrt(3), hc1-i*hc2, hc4-i*hc5 |
190  | hc1+i*hc2, -hc3+hc8/sqrt(3), hc6-i*hc7 |
191  | hc4+i*hc5, hc6+i*hc7, -2*hc8/sqrt(3) |
192  */
193  iP.set(0, site, ex, 0.0);
194  iP.set(1, site, ex, hc3 + hc8 * sq3r);
195  iP.set(2, site, ex, hc2);
196  iP.set(3, site, ex, hc1);
197  iP.set(4, site, ex, hc5);
198  iP.set(5, site, ex, hc4);
199  iP.set(6, site, ex, -hc2);
200  iP.set(7, site, ex, hc1);
201  iP.set(8, site, ex, 0.0);
202  iP.set(9, site, ex, -hc3 + hc8 * sq3r);
203  iP.set(10, site, ex, hc7);
204  iP.set(11, site, ex, hc6);
205  iP.set(12, site, ex, -hc5);
206  iP.set(13, site, ex, hc4);
207  iP.set(14, site, ex, -hc7);
208  iP.set(15, site, ex, hc6);
209  iP.set(16, site, ex, 0.0);
210  iP.set(17, site, ex, -hc8 * sq3r2);
211  }
212  }
213 
214  double iP2 = iP.norm(); //calculate global norm sqrt(|iP2|^2) (SA)
215  iP2 = 0.5 * iP2 * iP2; // |iP|^2/2 (SA)
216 
217  return iP2;
218 }
219 
220 
221 //====================================================================
222 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:495
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
void general(const char *format,...)
Definition: bridgeIO.cpp:195
Container of Field-type object.
Definition: field.h:39
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:116
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:132
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:115
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:211
int nex() const
Definition: field.h:117
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:159