CHROMA
t_g5eps_bj.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <sstream>
4 #include <iomanip>
5 #include <string>
6 
7 #include <cstdio>
8 
9 #include <stdlib.h>
10 #include <sys/time.h>
11 #include <math.h>
12 
13 #include "chroma.h"
14 
15 using namespace Chroma;
16 
17 struct App_input_t {
18  ChromaProp_t param;
19  Cfg_t cfg;
20 };
21 
22 // Reader for input parameters
23 void read(XMLReader& xml, const std::string& path, App_input_t& input)
24 {
25  XMLReader inputtop(xml, path);
26 
27  // Read the input
28  try
29  {
30  // The parameters holds the version number
31  read(inputtop, "Param", input.param);
32 
33  // Read in the gauge configuration info
34  read(inputtop, "Cfg", input.cfg);
35  }
36  catch (const std::string& e)
37  {
38  QDPIO::cerr << "Error reading data: " << e << std::endl;
39  throw;
40  }
41 }
42 
43 
44 int main(int argc, char **argv)
45 {
46  // Put the machine into a known state
47  Chroma::initialize(&argc, &argv);
48 
49  App_input_t input;
50  XMLReader xml_in(Chroma::getXMLInputFileName());
51 
52  try {
53  read(xml_in, "/ovlapTest", input);
54  }
55  catch( const std::string& e) {
56  QDPIO::cerr << "Caught Exception : " << e << std::endl;
57  QDP_abort(1);
58  }
59 
60 
61  // Setup the lattice
62  Layout::setLattSize(input.param.nrow);
63  Layout::create();
64 
65  multi1d<LatticeColorMatrix> u(Nd);
66  XMLReader gauge_file_xml, gauge_xml;
67  gaugeStartup(gauge_file_xml, gauge_xml, u, input.cfg);
68 
69  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
70  push(xml_out,"t_g5eps_bj");
71 
72 
73  // Measure the plaquette on the gauge
74  MesPlq(xml_out, "Observables", u);
75  xml_out.flush();
76 
77  // Create a FermBC
79 
80 
81  QDPIO::cout << "FERM_ACT_ZOLOTAREV_4D" << std::endl;
82  const Zolotarev4DFermActParams& zolo4d = dynamic_cast<const Zolotarev4DFermActParams& > (*(input.param.FermActHandle));
83 
84  // Construct Fermact -- now uses constructor from the zolo4d params
85  // struct
86  Zolotarev4DFermAct S(fbc, zolo4d, xml_out);
87 
88  Handle<const ConnectState> connect_state(S.createState(u, zolo4d.StateInfo, xml_out,zolo4d.AuxFermActHandle->getMass()));
89 
90  // Make me a linop (this callls the initialise function)
91  Handle<const LinearOperator<LatticeFermion> > D_op(S.linOp(connect_state));
92 
93  // Make me an epsilon
94  Handle<const LinearOperator<LatticeFermion> > g5eps(S.lgamma5epsH(connect_state));
95 
96  int G5 = Ns*Ns - 1;
97 
98  LatticeFermion psi;
99  gaussian(psi);
100 
101  LatticeFermion chi1, chi2, tmp, g5_psi;
102  (*D_op)(chi1, psi, PLUS);
103  (*g5eps)(chi2, psi, PLUS);
104 
105  // chi2 = gamma_5 eps(H) psi
106  //
107  // now form (1/2)(( 1 + mu ) + (1-mu)gamma_5 eps(H)) psi
108  chi2 *= (Real(1) - input.param.FermActHandle->getMass());
109  chi2 += (Real(1) + input.param.FermActHandle->getMass())*psi;
110  chi2 *= 0.5;
111 
112 
113 
114  LatticeFermion diff = chi2 - chi1;
115  Double norm_diff = sqrt(norm2(diff));
116 
117  QDPIO::cout << "||PLUS: lovlapms - explicit epsilon construct ||=" << norm_diff << std::endl;
118 
119  (*D_op)(chi1, psi, MINUS);
120 
121  g5_psi = Gamma(G5)*psi;
122 
123  (*g5eps)(tmp, g5_psi, PLUS);
124 
125  // Do
126  // chi2 = 1/2 ( ( 1 + mu) psi + (1 - mu) epsilon gamma_5 psi
127  //
128  // = 1/2 ( ( 1 + mu ) psi + (1 - mu ) gamma_5 g5_eps gamma_5 psi)
129  // = 1/2 ( ( 1 + mu ) psi + (1 - mu ) gamma_5 tmp;
130  chi2 = Gamma(G5)*tmp;
131  chi2 *= (Real(1) - input.param.FermActHandle->getMass());
132  chi2 += (Real(1) + input.param.FermActHandle->getMass())*psi;
133  chi2 *= 0.5;
134 
135  diff = chi1 - chi2;
136  norm_diff = sqrt(norm2(diff));
137 
138  QDPIO::cout << "||MINUS: lovlapms - explicit epsilon construct ||=" << norm_diff << std::endl;
139 
140 
141  // Now do U^dagger = epsilon^dagger gamma_5
142  (*g5eps)(chi2, psi, MINUS);
143 
144  // chi2 = 1/2( (1 + mu) + (1 - mu) epsilon^{dagger} gamma_5 psi
145  // = 1/2( (1 + mu) + (1 - mu) gamma_5 epsilon gamma_5 gamma_5
146  chi2 *= (Real(1) - input.param.FermActHandle->getMass());
147  chi2 += (Real(1) + input.param.FermActHandle->getMass())*psi;
148  chi2 *= 0.5;
149 
150  diff = chi1 - chi2;
151  norm_diff = sqrt(norm2(diff));
152 
153  QDPIO::cout << "||MINUS2: lovlapms - explicit epsilon construct ||=" << norm_diff << std::endl;
154 
155 
156  // Test unitarity
157  (*g5eps)(chi1, psi, PLUS);
158  (*g5eps)(chi2, chi1, MINUS);
159 
160  diff = psi - chi2;
161  norm_diff = sqrt(norm2(diff));
162 
163  QDPIO::cout << "||UNITARITY: 1 - U^{dag} U ||=" << norm_diff << std::endl;
164 
165  (*g5eps)(chi1, psi, PLUS);
166  (*g5eps)(chi2, psi, MINUS);
167  diff = chi1 - chi2;
168  norm_diff = sqrt(norm2(diff));
169 
170  QDPIO::cout << "||HERMITICITY: U - U^{dag} ||=" << norm_diff << std::endl;
171 
172 
173  chi1 = Gamma(G5)*psi;
174  (*g5eps)(tmp, chi1, PLUS);
175  chi1 = Gamma(G5)*tmp;
176 
177  (*g5eps)(chi2, psi, MINUS);
178  diff = chi1 - chi2;
179  norm_diff = sqrt(norm2(diff));
180 
181  QDPIO::cout << "||gamma_5 HERMITICITY: g5 U g5 - U^+||=" << norm_diff << std::endl;
182 
183  chi1 = Gamma(G5)*psi;
184  (*g5eps)(tmp, chi1, MINUS);
185  chi1 = Gamma(G5)*tmp;
186 
187  (*g5eps)(chi2, psi, PLUS);
188  diff = chi1 - chi2;
189  norm_diff = sqrt(norm2(diff));
190 
191  QDPIO::cout << "||gamma_5 HERMITICITY: g5 U^+ g5 - U ||=" << norm_diff << std::endl;
192 
193  // Get g5 (g5 eps) psi = eps psi
194  (*g5eps)(tmp, psi, PLUS);
195  chi1 = Gamma(G5)*tmp;
196 
197  // Get (g5 eps)^{dag} g5 psi = eps^{dag} psi
198  tmp = Gamma(G5)*psi;
199  (*g5eps)(chi2, tmp, MINUS);
200 
201  diff = chi1 - chi2;
202  norm_diff = sqrt(norm2(diff));
203 
204  QDPIO::cout << "|| sgn HERMITICITY: eps - eps^{dag} || = " << norm_diff <<std::endl;
205 
206 
207  // Chi2 is eps^{dag}
208  // get tmp = gamma_5 eps eps^{dag} psi
209  (*g5eps)(tmp, chi2, PLUS);
210 
211  // chi2 = gamma_5 tmp = eps eps^{dag} psi
212  chi2 = Gamma(G5)*tmp;
213 
214  diff = psi - chi2;
215  norm_diff = sqrt(norm2(diff));
216 
217  QDPIO::cout << "||sgn UNITARITY: 1 - eps eps^{dag} || = " << norm_diff << std::endl;
218  pop(xml_out);
220 
221  exit(0);
222 }
Primary include file for CHROMA in application codes.
Class for counted reference semantics.
Definition: handle.h:33
Concrete class for all gauge actions with simple boundary conditions.
Definition: simple_fermbc.h:42
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
int G5
Definition: pbg5p_w.cc:57
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
ChromaProp_t param
Definition: t_bicgstab.cc:19
Gauge configuration structure.
Definition: cfgtype_io.h:16
Propagator parameters.
Definition: qprop_io.h:75
int main(int argc, char **argv)
Definition: t_g5eps_bj.cc:44