00001 #include <config.h>
00002 #include <util/lattice.h>
00003 #include <util/gjp.h>
00004 #include <util/verbose.h>
00005 #include <util/error.h>
00006 #include <alg/alg_fix_gauge.h>
00007 #include <alg/do_arg.h>
00008 #include <alg/hmd_arg.h>
00009 #include <alg/common_arg.h>
00010 #include <util/random.h>
00011 #include <math.h>
00012 #include <util/qcdio.h>
00013 #include <util/lattice.h>
00014 #include <util/smalloc.h>
00015 #include <util/vector.h>
00016 #include <comms/scu.h>
00017 #include <comms/glb.h>
00018 #include <alg/alg_plaq.h>
00019 #include <alg/alg_hq_pot.h>
00020 #include <util/time_cps.h>
00021 #include <util/pt.h>
00022 #include <string.h>
00023
00024 #ifdef PARALLEL
00025 #include <comms/sysfunc_cps.h>
00026 #endif
00027
00028 CPS_START_NAMESPACE
00029
00030 #define X_LINK 0
00031 #define Y_LINK 1
00032 #define Z_LINK 2
00033 #define T_LINK 3
00034
00035 Complex I = Complex(0,1);
00036
00037 inline Matrix operator * (const Matrix& m1, const Matrix& m2)
00038 { Matrix r; r.DotMEqual(m1,m2); return r; }
00039
00040 void p(Matrix x)
00041 {
00042 for(int i=0; i<3; i++)
00043 {
00044 for(int j=0; j<3; j++)
00045 {
00046 Complex xx = x(i,j);
00047 if(fabs(real(xx))<1e-10)
00048 xx=Complex(0,imag(xx));
00049 if(fabs(imag(xx))<1e-10)
00050 xx=Complex(real(xx),0);
00051 printf( "(%e,%e)", real(xx), imag(xx));
00052 if(j<2)
00053 printf( " ");
00054 }
00055 printf("\n");
00056 }
00057 printf("\n");
00058 }
00059
00060
00061
00062 #define NX (GJP.XnodeSites())
00063 #define NY (GJP.YnodeSites())
00064 #define NZ (GJP.ZnodeSites())
00065 #define NT (GJP.TnodeSites())
00066
00067 #define INDp(x,y,z,t) (((((t+NT)%NT)*NZ+((z+NZ)%NZ))*NY+ \
00068 ((y+NY)%NY))*NX+((x+NX)%NX))
00069
00070 #define IND(x,y,z,t,l) ((((((t+NT)%NT)*NZ+((z+NZ)%NZ))*NY+ \
00071 ((y+NY)%NY))*NX+((x+NX)%NX))*4+l)
00072
00073
00074
00080
00081 AlgHQPotential::AlgHQPotential(Lattice& latt,
00082 CommonArg *c_arg,
00083 NoArg *arg) :
00084 Alg(latt, c_arg)
00085 {
00086 cname = "AlgHQPotential";
00087 const char *fname = "AlgHQPotential";
00088 VRB.Func(cname,fname);
00089
00090
00091
00092 if(arg == 0)
00093 ERR.Pointer(cname,fname, "arg");
00094 alg_HQPotential_arg = arg;
00095
00096 }
00097
00098
00099
00100
00101
00102 AlgHQPotential::~AlgHQPotential() {
00103 const char *fname = "~AlgHQPotential";
00104 VRB.Func(cname,fname);
00105 }
00106
00107
00108
00109
00110
00111
00112
00113 void AlgHQPotential::run(int dir, int n, int m)
00114 {
00115 const char *fname = "run";
00116 VRB.Func(cname,fname);
00117
00118 if ((dir<0)||(dir>3)){
00119 printf("Error:: direction should be 0,1,2,3\n");
00120 return;
00121 }
00122
00123
00124
00125 Lattice& lat = AlgLattice();
00126
00127
00128
00129
00130 int num_nodes[4]
00131 = { GJP.Xnodes(), GJP.Ynodes(), GJP.Znodes(), GJP.Tnodes() } ;
00132
00133 int node_sites[4]
00134 = { GJP.XnodeSites(), GJP.YnodeSites(), GJP.ZnodeSites(), GJP.TnodeSites() } ;
00135
00136 int Size[4];
00137 for (int i=0; i<4; i++){
00138 Size[i] = num_nodes[i]*node_sites[i];
00139 }
00140
00141 int *plns;
00142 plns = (int*) smalloc(Size[dir]*sizeof(int));
00143
00144 for (int i=0; i<Size[dir]; i++){
00145 plns[i] = i;
00146 }
00147
00148 int npln = Size[dir];
00149
00150 FixGaugeType normdir;
00151
00152 if (dir==3) normdir = FIX_GAUGE_COULOMB_T;
00153 else if (dir==0) normdir = FIX_GAUGE_COULOMB_X;
00154 else if (dir==1) normdir = FIX_GAUGE_COULOMB_Y;
00155 else normdir = FIX_GAUGE_COULOMB_Z;
00156
00157
00158
00159
00160 Matrix *L;
00161 Matrix **Gp;
00162 int ii;
00163
00164 int volume = NX*NY*NZ*NT;
00165
00166 L = (Matrix*) smalloc(4*volume*sizeof(Matrix));
00167 Gp = (Matrix**) smalloc(npln*sizeof(Matrix*));
00168
00169 for(ii=0; ii<npln; ii++)
00170 Gp[ii] = (Matrix*) smalloc(volume/node_sites[dir] * sizeof(Matrix));
00171
00172
00173
00174
00175
00176 Float bf_gf_time = dclock();
00177
00178 VRB.Debug("Fixing . . .\n");
00179
00180 lat.FixGaugeAllocate(normdir,npln,plns);
00181 int itnum = lat.FixGauge(1e-6,20000);
00182 VRB.Debug("Iternum = %d\n", itnum);
00183
00184 VRB.Debug("Resulting Gauge Fixing Matrices:\n\n");
00185
00186 if(itnum > 0)
00187 for (int slice=0; slice<node_sites[dir]; slice++)
00188 for(int cnt=0; cnt<volume/node_sites[dir]; cnt++)
00189 Gp[slice][cnt]=lat.FixGaugePtr()[slice][cnt];
00190
00191 p(Gp[0][0]);
00192
00193 lat.FixGaugeFree();
00194
00195
00196
00197
00198
00199
00200 int tt,xx,yy,zz,temp_ind;
00201 int slice_ind[3];
00202
00203
00204 temp_ind = 0;
00205 for (int i=0; i<4; i++){
00206 if (i!=dir) {
00207 slice_ind[temp_ind] = i;
00208 temp_ind++;
00209 }
00210 }
00211
00212 printf("dir == %d \n",dir);
00213 printf("slice index == %d %d %d\n",slice_ind[0],slice_ind[1],slice_ind[2]);
00214
00215
00216 int NN[4];
00217 NN[0] = node_sites[slice_ind[0]];
00218 NN[1] = node_sites[slice_ind[1]];
00219 NN[2] = node_sites[slice_ind[2]];
00220 NN[3] = node_sites[dir];
00221
00222 int s[4];
00223 for (int i=0; i<3; i++)
00224 s[i] = slice_ind[i];
00225 s[3] = dir;
00226
00227
00228
00229
00230
00231 lat.CopyGaugeField(L);
00232 int x[4];
00233
00234
00235 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00236 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00237 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00238 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00239 {
00240 xx = x[slice_ind[0]];
00241 yy = x[slice_ind[1]];
00242 zz = x[slice_ind[2]];
00243 tt = x[dir];
00244
00245 Matrix g = Gp[tt][(zz*NN[1]+yy)*NN[0]+xx];
00246 Matrix D;
00247
00248 Matrix gg ;
00249 Matrix transmit;
00250
00251
00252 if (tt+1<NN[3]) gg = Gp[tt+1][(zz*NN[1]+yy)*NN[0]+xx];
00253 else {
00254 transmit = Gp[0][(zz*NN[1]+yy)*NN[0]+xx];
00255 getPlusData((IFloat *)&gg, (IFloat *)&transmit,
00256 sizeof(Matrix)/sizeof(IFloat), dir) ;
00257 }
00258 D.Dagger(gg);
00259 L[IND(x[0],x[1],x[2],x[3],dir)] = g*L[IND(x[0],x[1],x[2],x[3],dir)]*D;
00260
00261
00262 if (zz+1<NN[2]) gg = Gp[tt][((zz+1)*NN[1]+yy)*NN[0]+xx];
00263 else {
00264 transmit = Gp[tt][((zz+1)%NN[2]*NN[1]+yy)*NN[0]+xx];
00265 getPlusData((IFloat *)&gg, (IFloat *)&transmit,
00266 sizeof(Matrix)/sizeof(IFloat), slice_ind[2]) ;
00267 }
00268 D.Dagger(gg);
00269 L[IND(x[0],x[1],x[2],x[3],slice_ind[2])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[2])]*D;
00270
00271
00272 if (yy+1<NN[1]) gg = Gp[tt][(zz*NN[1]+(yy+1))*NN[0]+xx];
00273 else {
00274 transmit = Gp[tt][(zz*NN[1]+(yy+1)%NN[1])*NN[0]+xx];
00275 getPlusData((IFloat *)&gg, (IFloat *)&transmit,
00276 sizeof(Matrix)/sizeof(IFloat), slice_ind[1]) ;
00277 }
00278 D.Dagger(gg);
00279 L[IND(x[0],x[1],x[2],x[3],slice_ind[1])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[1])]*D;
00280
00281
00282 if (xx+1<NN[0]) gg = Gp[tt][(zz*NN[1]+yy)*NN[0]+(xx+1)];
00283 else {
00284 transmit = Gp[tt][(zz*NN[1]+yy)*NN[0]+(xx+1)%NN[0]];
00285 getPlusData((IFloat *)&gg, (IFloat *)&transmit,
00286 sizeof(Matrix)/sizeof(IFloat), slice_ind[0]) ;
00287 }
00288 D.Dagger(gg);
00289 L[IND(x[0],x[1],x[2],x[3],slice_ind[0])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[0])]*D;
00290 }
00291
00292
00293 lat.GaugeField(L);
00294
00295 Float af_gf_time = dclock();
00296
00297 printf("gauge fixing takes %f minutes\n",(double)(af_gf_time-bf_gf_time)/60);
00298
00299
00300 sfree(L);
00301
00302 for (ii=0; ii<npln; ii++)
00303 sfree(Gp[ii]);
00304
00305 sfree(Gp);
00306 sfree(plns);
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 int Max = node_sites[0]*num_nodes[0]/2+1;
00318 Max = (Max>9)?9:Max;
00319 int Max2 = Max*Max;
00320 int Max3 = Max*Max2;
00321
00322 Matrix **v;
00323 Matrix **v1,**v2,**v3,**v4;
00324
00325
00326
00327
00328
00329
00330
00331
00332 v = (Matrix**) smalloc(n*sizeof(Matrix*));
00333 v1 = (Matrix**) smalloc(n*sizeof(Matrix*));
00334 v2 = (Matrix**) smalloc(n*sizeof(Matrix*));
00335 v3 = (Matrix**) smalloc(n*sizeof(Matrix*));
00336 v4 = (Matrix**) smalloc(n*sizeof(Matrix*));
00337
00338
00339
00340
00341 for (int i=0; i<n; i++){
00342 v[i] = (Matrix*) smalloc(volume*sizeof(Matrix));
00343 v1[i] = (Matrix*) smalloc(volume*sizeof(Matrix));
00344 v2[i] = (Matrix*) smalloc(volume*sizeof(Matrix));
00345 v3[i] = (Matrix*) smalloc(volume*sizeof(Matrix));
00346 v4[i] = (Matrix*) smalloc(volume*sizeof(Matrix));
00347 }
00348
00349 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00350 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00351 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00352 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00353 v1[0][INDp(x[0],x[1],x[2],x[3])] = 1.0;
00354
00355 ParTransGauge pt(lat);
00356 int DIR;
00357 printf("ParTransGauge Enterted:::::::");
00358
00359
00360 DIR = 2*dir;
00361
00362
00363 for (int i=0; i<m-1; i++){
00364 pt.run(1,&(v2[0]),&(v1[0]),(const int*)&DIR);
00365
00366 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00367 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00368 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00369 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00370 v1[0][INDp(x[0],x[1],x[2],x[3])]=v2[0][INDp(x[0],x[1],x[2],x[3])];
00371 }
00372
00373 for (int i=0; i<n; i++){
00374 pt.run(1,&(v[i]),&(v1[0]),(const int*)&DIR);
00375
00376 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00377 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00378 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00379 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00380 v1[0][INDp(x[0],x[1],x[2],x[3])]=v[i][INDp(x[0],x[1],x[2],x[3])];
00381 }
00382
00383
00384 int tmp[4],local[4],y[4];
00385 int *dist_count;
00386 Float **wline_pair;
00387
00388 wline_pair = (Float**) smalloc(n*sizeof(Float*));
00389 for (int i=0; i<n; i++)
00390 wline_pair[i] = (Float*) smalloc(Max3*sizeof(Float));
00391
00392 dist_count = (int*) smalloc(Max3*sizeof(int));
00393
00394 for (int i=0; i<Max3; i++){
00395 dist_count[i] = 0;
00396 for (int j=0; j<n; j++){
00397 wline_pair[j][i] = 0.0;
00398 }
00399 }
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486 int nn[4];
00487
00488 const int TransMax = 4096;
00489 int trans_N = volume*sizeof(Matrix)/sizeof(Float)/TransMax;
00490 int trans_res = volume*sizeof(Matrix)/sizeof(Float)%TransMax;
00491
00492 printf("??????????????????????????????????\n");
00493
00494 for (int i=0; i<n; i++){
00495
00496
00497 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00498 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00499 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00500 for (x[3]=0; x[3]<node_sites[3]; x[3]++){
00501 v1[i][INDp(x[0],x[1],x[2],x[3])]=v[i][INDp(x[0],x[1],x[2],x[3])];
00502
00503
00504 v4[i][INDp(x[0],x[1],x[2],x[3])]=v[i][INDp(x[0],x[1],x[2],x[3])];
00505 }
00506 }
00507
00508 for (nn[0]=0; nn[0]<num_nodes[s[0]]/2+1;nn[0]++){
00509
00510 for (int i=0; i<n; i++)
00511
00512 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00513 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00514 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00515 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00516 v3[i][INDp(x[0],x[1],x[2],x[3])]=v4[i][INDp(x[0],x[1],x[2],x[3])];
00517
00518
00519 for (nn[1]=0; nn[1]<num_nodes[s[1]]/2+1; nn[1]++){
00520
00521 for (int i=0; i<n; i++)
00522
00523 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00524 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00525 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00526 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00527 v2[i][INDp(x[0],x[1],x[2],x[3])]=v3[i][INDp(x[0],x[1],x[2],x[3])];
00528
00529
00530 for (nn[2]=0; nn[2]<num_nodes[s[2]]/2+1; nn[2]++){
00531
00532 int Dispmnt[3];
00533 Dispmnt[0] = nn[0]*node_sites[s[0]];
00534 Dispmnt[1] = nn[1]*node_sites[s[1]];
00535 Dispmnt[2] = nn[2]*node_sites[s[2]];
00536
00537
00538 for(x[s[0]]=0; x[s[0]]<node_sites[s[0]]; x[s[0]]++)
00539 for(x[s[1]]=0; x[s[1]]<node_sites[s[1]]; x[s[1]]++)
00540 for(x[s[2]]=0; x[s[2]]<node_sites[s[2]]; x[s[2]]++)
00541 for(y[s[0]]=0; y[s[0]]<node_sites[s[0]]; y[s[0]]++)
00542 for(y[s[1]]=0; y[s[1]]<node_sites[s[1]]; y[s[1]]++)
00543 for(y[s[2]]=0; y[s[2]]<node_sites[s[2]]; y[s[2]]++){
00544
00545 tmp[0] = y[s[0]]-x[s[0]]+Dispmnt[0];
00546 tmp[1] = y[s[1]]-x[s[1]]+Dispmnt[1];
00547 tmp[2] = y[s[2]]-x[s[2]]+Dispmnt[2];
00548 int sum = tmp[0]+tmp[1]+tmp[2];
00549
00550 if ((tmp[0]>=0)&&(tmp[1]>=0)&&(tmp[2]>=0)&&(sum>0)&&(tmp[0]<Max)&&(tmp[1]<Max)&&(tmp[2]<Max)) {
00551 int change;
00552 for (int i=0; i<2;i++)
00553 for (int j=i+1; j<3; j++)
00554 if (tmp[i]<tmp[j]) {
00555 change = tmp[i];
00556 tmp[i] = tmp[j];
00557 tmp[j] = change;
00558 }
00559
00560 dist_count[tmp[0]*Max2+tmp[1]*Max+tmp[2]]++;
00561
00562 for (int i=0; i<n; i++){
00563 for (y[dir]=0; y[dir]<node_sites[dir]; y[dir]++){
00564 x[dir]=y[dir];
00565 Matrix AAA;
00566 AAA.Dagger((const Float*)&(v2[i][INDp(y[0],y[1],y[2],y[3])]));
00567 Matrix BBB;
00568 BBB.DotMEqual(v[i][INDp(x[0],x[1],x[2],x[3])],AAA);
00569 wline_pair[i][tmp[0]*Max2+tmp[1]*Max+tmp[2]] += (BBB.Char3()).real()/node_sites[dir];
00570 }
00571 }
00572
00573 }
00574 }
00575
00576 for (int i=0; i<n; i++){
00577 for (int pp=0; pp<trans_N; pp++)
00578 getPlusData((IFloat *)((IFloat*)v1[i]+pp*TransMax), (IFloat *)((IFloat*)v2[i]+pp*TransMax),TransMax, s[2]) ;
00579
00580 if (trans_res>0)
00581 getPlusData((IFloat *)((IFloat*)v1[i]+trans_N*TransMax), (IFloat *)((IFloat*)v2[i]+trans_N*TransMax),
00582 volume*sizeof(Matrix)/sizeof(Float)-trans_N*TransMax, s[2]) ;
00583 }
00584
00585 for (int i=0; i<n; i++)
00586
00587 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00588 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00589 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00590 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00591 v2[i][INDp(x[0],x[1],x[2],x[3])]=v1[i][INDp(x[0],x[1],x[2],x[3])];
00592 }
00593
00594 for (int i=0; i<n; i++){
00595 for (int pp=0; pp<trans_N; pp++){
00596 getPlusData((IFloat *)((IFloat*)v1[i]+pp*TransMax), (IFloat *)((IFloat*)v3[i]+pp*TransMax),TransMax, s[1]) ;
00597 }
00598 if (trans_res>0)
00599 getPlusData((IFloat *)((IFloat*)v1[i]+trans_N*TransMax), (IFloat *)((IFloat*)v3[i]+trans_N*TransMax),
00600 volume*sizeof(Matrix)/sizeof(Float)-trans_N*TransMax, s[1]) ;
00601 }
00602
00603 for (int i=0; i<n; i++)
00604
00605 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00606 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00607 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00608 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00609 v3[i][INDp(x[0],x[1],x[2],x[3])]=v1[i][INDp(x[0],x[1],x[2],x[3])];
00610 }
00611
00612 for (int i=0; i<n; i++){
00613 for (int pp=0; pp<trans_N; pp++){
00614 getPlusData((IFloat *)((IFloat*)v1[i]+pp*TransMax), (IFloat *)((IFloat*)v4[i]+pp*TransMax),TransMax, s[0]) ;
00615 }
00616 if (trans_res>0)
00617 getPlusData((IFloat *)((IFloat*)v1[i]+trans_N*TransMax), (IFloat *)((IFloat*)v4[i]+trans_N*TransMax),
00618 volume*sizeof(Matrix)/sizeof(Float)-trans_N*TransMax, s[0]) ;
00619 }
00620
00621
00622 for (int i=0; i<n; i++)
00623
00624 for (x[0]=0; x[0]<node_sites[0]; x[0]++)
00625 for (x[1]=0; x[1]<node_sites[1]; x[1]++)
00626 for (x[2]=0; x[2]<node_sites[2]; x[2]++)
00627 for (x[3]=0; x[3]<node_sites[3]; x[3]++)
00628 v4[i][INDp(x[0],x[1],x[2],x[3])]=v1[i][INDp(x[0],x[1],x[2],x[3])];
00629 }
00630
00631 printf("??????????????????????????????????\n");
00632
00633 for (int k=0; k<n; k++)
00634 for (int i=0; i<Max3;i++)
00635 glb_sum((Float *)(wline_pair[k]+i));
00636
00637
00638 for (int k=0; k<n; k++)
00639 for (int i=0; i<Max3; i++)
00640 wline_pair[k][i] /= (Float)num_nodes[0]*num_nodes[1]*num_nodes[2]*num_nodes[3];
00641
00642
00643 int ind = 0;
00644 int* d2;
00645 Float** crltor;
00646
00647
00648 crltor = (Float**) smalloc(n*sizeof(Float*));
00649 for (int k=0; k<n; k++)
00650 crltor[k] = (Float*) smalloc(Max3*sizeof(Float));
00651 d2 = (int*) smalloc(Max3*sizeof(int));
00652
00653 FILE *fp;
00654 fp = Fopen(common_arg->filename,"w");
00655
00656 VRB.Debug("begin to print out the results::::::::::::\n");
00657 printf("print out the results---------\n");
00658
00659 for (x[0]=1;x[0]<Max;x[0]++)
00660 for (x[1]=0;x[1]<x[0]+1;x[1]++)
00661 for (x[2]=0;x[2]<x[1]+1;x[2]++)
00662 {
00663 int pos = x[0]*Max2+x[1]*Max+x[2];
00664 d2[ind] = x[0]*x[0]+x[1]*x[1]+x[2]*x[2];
00665 for (int k=0; k<n; k++)
00666 crltor[k][ind] = wline_pair[k][pos]/dist_count[pos];
00667
00668 Fprintf(fp, "%0.16e %d ", sqrt((Float)d2[ind]),
00669 dist_count[pos]);
00670
00671 for (int k=0; k<n; k++)
00672 Fprintf(fp, " %0.16e ", crltor[k][ind]);
00673
00674 Fprintf(fp, "\n");
00675
00676 ind++;
00677 }
00678
00679 printf("finished printing to file------------\n");
00680
00681 Fclose(fp);
00682
00683 Float af_cal_time = dclock();
00684
00685 printf("wilson correlator takes %f minutes\n",(double)(af_cal_time-af_gf_time)/60);
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696 for (int i=0; i<n; i++){
00697 sfree(v1[i]);
00698 sfree(v2[i]);
00699 sfree(v3[i]);
00700 sfree(v4[i]);
00701 sfree(v[i]);
00702 }
00703
00704 sfree(v1);
00705 sfree(v2);
00706 sfree(v3);
00707 sfree(v4);
00708 sfree(v);
00709
00710 sfree(d2);
00711
00712 for (ii=0; ii<n; ii++)
00713 sfree(crltor[ii]);
00714
00715 sfree(crltor);
00716
00717 for (ii=0; ii<n; ii++)
00718 sfree(wline_pair[ii]);
00719
00720 sfree(wline_pair);
00721 sfree(dist_count);
00722
00723 }
00724
00725 CPS_END_NAMESPACE