CHROMA
t_aniso_gaugeact.cc
Go to the documentation of this file.
1 #include "chroma.h"
8 
9 using namespace QDP;
10 
11 typedef multi1d<LatticeColorMatrix> U;
12 
13 int main(int argc, char **argv)
14 {
15 // Initialise QDP
16  Chroma::initialize(&argc, &argv);
17 
18  multi1d<int> nrow(Nd);
19 
20  nrow[0] = nrow[1] = nrow[2] = 4;
21  nrow[3] = 8;
22 
23  Layout::setLattSize(nrow);
24  Layout::create();
25 
26 
27 
28  multi1d<LatticeColorMatrix> u(Nd);
29  {
30  XMLReader file_xml;
31  XMLReader config_xml;
33  // Cfg_t foo; foo.cfg_type=CFG_TYPE_SZIN; foo.cfg_file="./CFGIN";
34  gaugeStartup(file_xml, config_xml, u, foo);
35  }
36 
39 
40 
41  AnisoParam_t aniso;
42  aniso.anisoP = true;
43  aniso.t_dir = 2;
44  aniso.xi_0 = 3;
45 
46  Real coeff_p_s = -0.5;
47  Real coeff_p_t = -0.4;
48  Real coeff_2plaq = -0.6;
49 
50  PlaqGaugeAct S_plaq(cgs, coeff_p_s, coeff_p_t, aniso);
51  SpatialTwoPlaqGaugeAct S_pp(cgs, coeff_2plaq, aniso);
52 
53  PlaqPlusSpatialTwoPlaqGaugeAct S_all(cgs, coeff_p_s, coeff_p_t, coeff_2plaq, aniso);
54 
55  Handle< GaugeState<U,U> > gstate = S_plaq.createState(u);
56 
57  Double S_all_S = S_all.S(gstate);
58  Double S_old_S = S_plaq.S(gstate)+S_pp.S(gstate);
59 
60  Double norm_diff = ( S_all_S - S_old_S ) / S_old_S;
61 
62  QDPIO::cout <<"( S_new - S_old ) / S_old = " << norm_diff << std::endl;
63 
64  U F_old(Nd);
65  U F_new(Nd);
66  U F_tmp(Nd);
67 
68  S_all.deriv(F_new, gstate);
69  S_plaq.deriv(F_old, gstate);
70  S_pp.deriv(F_tmp, gstate);
71  for(int mu=0; mu < Nd; mu++) {
72  F_old[mu] += F_tmp[mu];
73  }
74 
75  for(int mu=0; mu < Nd; mu++) {
76  LatticeColorMatrix f_d = F_new[mu]- F_old[mu];
77 
78  QDPIO::cout <<" F_old = " << sqrt(norm2(F_old[mu])) << " F_new=" << sqrt(norm2(F_new[mu])) << " (F_new-F_old) = " << sqrt(norm2(f_d)) << " (F_new - F_old) / F_old = " << sqrt(norm2(f_d)/norm2(F_old[mu]))<< std::endl;
79  }
80 
81 
82  Real u_s = Real(0.75793);
83  Real u_t = Real(1);
84  Real beta = Real(1.5);
85  Real omega = Real(3);
86 
87  Real u_s_2 = u_s * u_s;
88  Real u_s_4 = u_s_2 * u_s_2;
89  Real u_s_6 = u_s_4 * u_s_2;
90  Real u_s_8 = u_s_4 * u_s_4;
91 
92  // temporal powers
93  Real u_t_2 = u_t * u_t;
94  Real u_t_4 = u_t_2 * u_t_2;
95 
96  // Coefficients for the plaquette term (eq 4 in hep-lat/9911003)
97  Real plaq_c_s = beta * Real(5) * ( Real(1) + omega ) / ( Real(3) * u_s_4 );
98  Real plaq_c_t = beta * Real(4) / ( Real(3) * u_s_2 * u_t_2 );
99  coeff_2plaq = Real(-5)*beta*omega/(Real(3)*u_s_8);
100  Real rect_c_s = - beta / ( Real(12)*u_s_6 );
101  Real rect_c_t_2 = - beta / ( Real(12)*u_s_4*u_t_2);
102 
103  // Loops that are long int the time direction ought to be ommitted
104  bool no_temporal_2link = true;
105  Real rect_c_t_1 = 0; // Specify a zero coefficient (skipped anyway)
106 
107  PlaqGaugeAct S_p_1(cgs, plaq_c_s, plaq_c_t, aniso);
108  SpatialTwoPlaqGaugeAct S_pp_1(cgs, coeff_2plaq, aniso);
109  RectGaugeAct S_r(cgs, rect_c_s, rect_c_t_1, rect_c_t_2, no_temporal_2link, aniso);
110 
112  g_p.beta = beta;
113  g_p.u_s = u_s;
114  g_p.u_t = u_t;
115  g_p.omega = omega;
116  g_p.aniso = aniso;
117 
118  AnisoSpectrumGaugeAct S_aniso(cgs, g_p);
119 
120  Double S_candidate = S_p_1.S(gstate)+S_pp_1.S(gstate)+S_r.S(gstate);
121  Double S_ref = S_aniso.S(gstate);
122 
123  QDPIO::cout << " S_candidate ="<< S_candidate << " S_aniso=" << S_ref << " diff =" << S_candidate - S_ref << " Rel_diff=" << (S_candidate - S_ref)/S_ref << std::endl;
124 
125  S_aniso.deriv(F_new, gstate);
126  S_p_1.deriv(F_old, gstate);
127  S_pp_1.deriv(F_tmp, gstate);
128  for(int mu=0; mu < Nd; mu++) {
129  F_old[mu] += F_tmp[mu];
130  }
131  S_r.deriv(F_tmp, gstate);
132  for(int mu=0; mu < Nd; mu++) {
133  F_old[mu] += F_tmp[mu];
134  }
135 
136  for(int mu=0; mu < Nd; mu++) {
137  LatticeColorMatrix f_d = F_new[mu]- F_old[mu];
138 
139  QDPIO::cout <<" F_old = " << sqrt(norm2(F_old[mu])) << " F_new=" << sqrt(norm2(F_new[mu])) << " (F_new-F_old) = " << sqrt(norm2(f_d)) << " (F_new - F_old) / F_old = " << sqrt(norm2(f_d)/norm2(F_old[mu]))<< std::endl;
140  }
141 
143 
144  exit(0);
145 }
Anisotropic gaugeact useful for spectrum from hep-lat/9911003.
Primary include file for CHROMA in application codes.
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
Create a simple gauge connection state.
virtual GaugeState< P, Q > * createState(const Q &q) const
Given links, create the state.
Definition: gaugeact.h:40
Class for counted reference semantics.
Definition: handle.h:33
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
Rect gauge action.
Definition: rect_gaugeact.h:54
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
Double S(const Handle< GaugeState< P, Q > > &state) const
Compute the actions.
void deriv(multi1d< LatticeColorMatrix > &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
int mu
Definition: cool.cc:24
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
@ CFG_TYPE_DISORDERED
Nd
Definition: meslate.cc:74
static const LatticeInteger & beta(const int dim)
Definition: stag_phases_s.h:47
static multi1d< LatticeColorMatrix > u
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
Complex omega
Definition: invbicg.cc:97
FloatingPoint< double > Double
Definition: gtest.h:7351
Periodic gauge boundary conditions.
Plaquette gauge action.
Simple gauge state and a creator.
Plaquette gauge action.
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 > U