CHROMA
t_aniso_sym_force.cc
Go to the documentation of this file.
1 #include "chroma.h"
2 
3 #include <iostream>
10 
11 using namespace Chroma;
12 
13 
14 int main(int argc, char *argv[])
15 {
16  // Initialise QDP
17  Chroma::initialize(&argc, &argv);
18 
19  // Setup a small lattice
20  const int nrow_arr[] = {2, 2, 2, 2};
21  multi1d<int> nrow(Nd);
22  nrow=nrow_arr;
23  Layout::setLattSize(nrow);
24  Layout::create();
25 
26 
27  multi1d<LatticeColorMatrix> u(Nd);
28  {
29  XMLReader file_xml;
30  XMLReader config_xml;
32  // Cfg_t foo; foo.cfg_type=CFG_TYPE_SZIN; foo.cfg_file="./CFGIN";
33  gaugeStartup(file_xml, config_xml, u, foo);
34  }
35 
36  XMLFileWriter xml_out("./XMLDAT");
37  push(xml_out, "t_forces");
38 
39  // Get Periodic Gauge Boundaries
40  typedef multi1d<LatticeColorMatrix> P;
41  typedef P Q;
42 
44  Real beta = Real(2.0);
45  Real u_s = Real(0.78);
46  Real u_t = Real(0.96);
47 
48  Real u_s_2 = u_s*u_s;
49  Real u_s_4 = u_s_2*u_s_2;
50 
51  Real u_t_2 = u_t*u_t;
52  Real u_t_4 = u_t_2*u_t_2;
53  Real u_s_6 = u_s_2*u_s_4;
54 
55  // Coefficients for the plaquette term (eq 4 in hep-lat/9911003)
56  Real plaq_c_s = beta * Real(5) / ( Real(3) * u_s_4 );
57 
58  // I want to set up a plaquette and rectangle gauge action...
59  Real plaq_c_t = beta * Real(4) / ( Real(3) * u_s_2 * u_t_2 );
60 
61 
62  Real rect_c_s = - beta / ( Real(12)*u_s_6 );
63  Real rect_c_t_2 = - beta / ( Real(12)*u_s_4*u_t_2);
64 
65  Real rect_c_t_1 = - beta / ( Real(12)*u_s_2*u_t_4);
66 
67  bool no_temporal_2link = true; // Do temporal 2 links for testing.
68 
69  AnisoParam_t aniso;
70  aniso.anisoP = false;
71  aniso.t_dir = 2;
72  aniso.xi_0 = 2.6;
73  aniso.nu = 0.8;
74 
75 
77  Handle<PlaqGaugeAct> plaq = new PlaqGaugeAct(cgs, plaq_c_s, plaq_c_t, aniso);
78  Handle<RectGaugeAct> rect = new RectGaugeAct(cgs, rect_c_s, rect_c_t_1, rect_c_t_2, no_temporal_2link, aniso);
79 
80  // Create a gauge state
81  Handle< GaugeState<P,Q> > gs = plaq->createState(u);
82 
83  // Get the force from the plaquette
84  P ds_plaq;
85  P ds_rect;
86 
87  plaq->deriv(ds_plaq, gs);
88  rect->deriv(ds_rect, gs);
89 
90  for(int mu=0; mu < Nd; mu++) {
91  ds_plaq[mu] += ds_rect[mu];
92  }
93 
94  P ds_u;
95 
96 
97  ds_u.resize(Nd);
98  ds_u = zero;
99 
100 
101  Real c_munu_plaq;
102  Real c_munu_rect;
103 
104  const Q& u_bc = gs->getLinks();
105 
106  Real xi_0;
107 
108  if( aniso.anisoP == true ) {
109  xi_0 = aniso.xi_0;
110  }
111  else {
112  xi_0 = Real(1);
113  }
114 
115  multi1d<LatticeColorMatrix> ds_tmp(Nd);
116  ds_tmp = zero;
117 
118 
119  for(int mu = 0; mu < Nd; mu++) {
120  for(int nu = 0 ; nu < Nd; nu++) {
121  if( mu == nu ) continue;
122 
123 
124 
125  if( mu != aniso.t_dir && nu != aniso.t_dir ) {
126  // both mu and nu are spatial
127  c_munu_plaq = plaq_c_s/xi_0;
128  c_munu_rect = rect_c_s/xi_0;
129  }
130  else if( mu == aniso.t_dir ) {
131  // nu is spatial mu is temporal (2 link in time dir)
132  c_munu_plaq = plaq_c_t * xi_0;
133  c_munu_rect = rect_c_t_1 * xi_0;
134  }
135  else {
136  // mu is spatial nu is temporal (1 link in time dir)
137  c_munu_plaq = plaq_c_t * xi_0;
138  c_munu_rect = rect_c_t_2 * xi_0;
139  }
140 
141 
143  nu,
144  aniso.t_dir,
145  c_munu_plaq,
146  c_munu_rect,
147  no_temporal_2link,
148  ds_tmp,
149  u_bc);
150 
151 
152  }
153  }
154 
155  for(int mu=0; mu < Nd; mu++) {
156  ds_u[mu] += u_bc[mu]*ds_tmp[mu];
157  }
158 
159 
160  P diff_plaq;
161  P diff_rect;
162 
163  diff_plaq.resize(Nd);
164  diff_rect.resize(Nd);
165 
166  for(int mu=0; mu < Nd; mu++) {
167  diff_plaq[mu] = ds_plaq[mu] - ds_u[mu];
168  }
169 
170  write(xml_out, "DIFF_PLAQ", diff_plaq);
171 
172  for(int mu=0; mu < Nd; mu++) {
173  QDPIO::cout << "Diff Plaq["<<mu<<"] = " << norm2(diff_plaq[mu]) << std::endl;
174  }
175 
176 
177  LatticeReal lgimp=zero;
178 
179  // Check on actions:
180  for(int mu = 0; mu < Nd; mu++) {
181  for(int nu = 0 ; nu < Nd; nu++) {
182  if( mu == nu ) continue;
183 
184 
185 
186  if( mu != aniso.t_dir && nu != aniso.t_dir ) {
187  // both mu and nu are spatial
188  c_munu_plaq = plaq_c_s/xi_0;
189  c_munu_rect = rect_c_s/xi_0;
190  }
191  else if( mu == aniso.t_dir ) {
192  // nu is spatial mu is temporal (2 link in time dir)
193  c_munu_plaq = plaq_c_t * xi_0;
194  c_munu_rect = rect_c_t_1 * xi_0;
195  }
196  else {
197  // mu is spatial nu is temporal (1 link in time dir)
198  c_munu_plaq = plaq_c_t * xi_0;
199  c_munu_rect = rect_c_t_2 * xi_0;
200  }
201 
202 
204  nu,
205  aniso.t_dir,
206  c_munu_plaq,
207  c_munu_rect,
208  no_temporal_2link,
209  lgimp,
210  u_bc);
211 
212  }
213  }
214 
215  Double s_manual = sum(lgimp);
216  s_manual *= -Double(1)/Double(Nc);
217 
218  Double s_old = plaq->S(gs) + rect->S(gs);
219 
220 
221  QDPIO::cout << "Manual S= " << s_manual << std::endl;
222  QDPIO::cout << "New S= " << s_old << std::endl;
223  QDPIO::cout << "Diff = " << s_old - s_manual << std::endl;
224  // Finish
226 
227  exit(0);
228 }
229 
Spatial part of Tree level LW action.
Temporal Part of Tree Level LW gauge action.
Primary include file for CHROMA in application codes.
Create a simple gauge connection state.
Class for counted reference semantics.
Definition: handle.h:33
Rect gauge action.
Definition: rect_gaugeact.h:54
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
@ CFG_TYPE_DISORDERED
Double plaq
Definition: meslate.cc:58
Nd
Definition: meslate.cc:74
void deriv_part(const int mu, const int nu, const int t_dir, const Real &c_plaq_munu, const Real &c_rect_munu, const bool noTemporal2Link, multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeColorMatrix > &u)
void S_part(int mu, int nu, int t_dir, Real c_plaq_munu, Real c_rect_munu, bool noTemporal2Link, LatticeReal &lgimp, const multi1d< LatticeColorMatrix > &u)
multi1d< LatticeColorMatrix > P
static const LatticeInteger & beta(const int dim)
Definition: stag_phases_s.h:47
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
static Real xi_0()
Definition: coulgauge.cc:15
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
Double zero
Definition: invbicg.cc:106
FloatingPoint< double > Double
Definition: gtest.h:7351
Plaquette gauge action.
Double sum
Definition: qtopcor.cc:37
Rectangle gauge action.
Simple gauge state and a creator.
Parameters for anisotropy.
Definition: aniso_io.h:24
Gauge configuration structure.
Definition: cfgtype_io.h:16
CfgType cfg_type
Definition: cfgtype_io.h:17
int main(int argc, char *argv[])
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13