00001 #include<config.h>
00002 CPS_START_NAMESPACE
00003
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 CPS_END_NAMESPACE
00026 #include <util/qcdio.h>
00027 #include <alg/alg_wline.h>
00028 #include <util/lattice.h>
00029 #include <util/gjp.h>
00030 #include <util/smalloc.h>
00031 #include <util/vector.h>
00032 #include <util/verbose.h>
00033 #include <util/error.h>
00034 #include <comms/scu.h>
00035 #include <comms/glb.h>
00036 #if TARGET == BGL
00037
00038 #endif
00039 CPS_START_NAMESPACE
00040
00041
00047
00048 AlgWline::AlgWline(Lattice& latt,
00049 CommonArg *c_arg,
00050 NoArg *arg) :
00051 Alg(latt, c_arg)
00052 {
00053 cname = "AlgWline";
00054 const char *fname = "AlgWline";
00055 VRB.Func(cname,fname);
00056
00057
00058
00059 if(arg == 0)
00060 ERR.Pointer(cname,fname, "arg");
00061 alg_wline_arg = arg;
00062
00063 }
00064
00065
00066
00067
00068
00069 AlgWline::~AlgWline() {
00070 const char *fname = "~AlgWline";
00071 VRB.Func(cname,fname);
00072 }
00073
00074
00075
00082
00083 void AlgWline::run()
00084 {
00085 #if TARGET==cpsMPI
00086 using MPISCU::fprintf;
00087 #endif
00088
00089 const char *fname = "run";
00090 VRB.Func(cname,fname);
00091
00092
00093
00094 Lattice& lat = AlgLattice();
00095
00096
00097
00098
00099
00100 Matrix accum_link, in_link, out_link ;
00101 Matrix *gauge=lat.GaugeField() ;
00102
00103 int num_nodes[4]
00104 = { GJP.Xnodes(), GJP.Ynodes(), GJP.Znodes(), GJP.Tnodes() } ;
00105
00106 int node_sites[4]
00107 = { GJP.XnodeSites(), GJP.YnodeSites(), GJP.ZnodeSites(), GJP.TnodeSites() } ;
00108
00109 Float norm[4] ;
00110
00111 norm[0] = 1.0 / (Float)( node_sites[1] * node_sites[2] * node_sites[3]
00112 * num_nodes[1] * num_nodes[2] * num_nodes[3] ) ;
00113 norm[1] = 1.0 / (Float)( node_sites[0] * node_sites[2] * node_sites[3]
00114 * num_nodes[0] * num_nodes[2] * num_nodes[3] ) ;
00115 norm[2] = 1.0 / (Float)( node_sites[0] * node_sites[1] * node_sites[3]
00116 * num_nodes[0] * num_nodes[1] * num_nodes[3] ) ;
00117 norm[3] = 1.0 / (Float)( node_sites[0] * node_sites[1] * node_sites[2]
00118 * num_nodes[0] * num_nodes[1] * num_nodes[2] ) ;
00119
00120
00121 Float norm_factor = 1/GJP.XiBare();
00122
00123
00124 for (int mu=0; mu<4; mu++) {
00125 VRB.Debug(cname, fname, "Begin Direction = %i\n", mu) ;
00126
00127 Complex wline[4] CPS_FLOAT_ALIGN;
00128 wline[0] = 0.0;
00129 wline[1] = 0.0;
00130 wline[2] = 0.0;
00131 wline[3] = 0.0;
00132
00133
00134
00135
00136 int x[4] ;
00137
00138 for (x[(mu+1)%4]=0; x[(mu+1)%4] < node_sites[(mu+1)%4]; x[(mu+1)%4]++)
00139 for (x[(mu+2)%4]=0; x[(mu+2)%4] < node_sites[(mu+2)%4]; x[(mu+2)%4]++)
00140 for (x[(mu+3)%4]=0; x[(mu+3)%4] < node_sites[(mu+3)%4]; x[(mu+3)%4]++) {
00141
00142
00143
00144 accum_link.UnitMatrix() ;
00145
00146 for ( x[mu]=0; x[mu] < node_sites[mu]; x[mu]++ ) {
00147 out_link.DotMEqual(accum_link, gauge[mu+lat.GsiteOffset(x)]) ;
00148
00149
00150 if (GJP.XiBare() != 1.0 && mu == GJP.XiDir())
00151 out_link *= norm_factor;
00152
00153
00154 accum_link = out_link ;
00155 }
00156
00157
00158
00159
00160 for (int node_cntr=1; node_cntr < num_nodes[mu]; node_cntr++) {
00161 getMinusData((IFloat *)&in_link, (IFloat *)&out_link,
00162 sizeof(Matrix)/sizeof(IFloat), mu) ;
00163 out_link.DotMEqual(in_link, accum_link) ;
00164 accum_link = out_link ;
00165 out_link = in_link ;
00166 }
00167
00168
00169
00170 wline[0] += accum_link.Char3() ;
00171 wline[1] += accum_link.Char6() ;
00172 wline[2] += accum_link.Char8() ;
00173 wline[3] += accum_link.Char10() ;
00174
00175 }
00176
00177
00178
00179
00180 slice_sum((Float *)wline, 8, mu) ;
00181
00182
00183
00184 wline[0] *= norm[mu] ;
00185 wline[1] *= norm[mu] ;
00186 wline[2] *= norm[mu] ;
00187 wline[3] *= norm[mu] ;
00188
00189
00190
00191
00192 VRB.Debug(cname, fname, "%0.16e %0.16e %0.16e %0.16e %0.16e %0.16e %0.16e %0.16e\n",
00193 wline[0].real(), wline[0].imag(),
00194 wline[1].real(), wline[1].imag(),
00195 wline[2].real(), wline[2].imag(),
00196 wline[3].real(), wline[3].imag() );
00197
00198 if(common_arg->filename != 0){
00199 FILE *fp;
00200 if( (fp = Fopen(common_arg->filename, "a")) == NULL ) {
00201 ERR.FileA(cname,fname, (char *)common_arg->filename);
00202 }
00203 Fprintf(fp, "%0.16e %0.16e %0.16e %0.16e %0.16e %0.16e %0.16e %0.16e\n",
00204 wline[0].real(), wline[0].imag(),
00205 wline[1].real(), wline[1].imag(),
00206 wline[2].real(), wline[2].imag(),
00207 wline[3].real(), wline[3].imag() );
00208 Fclose(fp);
00209 }
00210
00211 VRB.Debug(cname, fname, "End Direction = %i\n", mu) ;
00212 }
00213 }
00214
00215 CPS_END_NAMESPACE